This is a migrated thread and some comments may be shown as answers.

Border color for shape

3 Answers 71 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Valery
Top achievements
Rank 1
Veteran
Valery asked on 15 Apr 2020, 04:40 AM

I am creating ScatterSeries

                    var scatterSeria = new ScatterSeries
                    {
                        XValueMember = "COLUMN0", YValueMember = "COLUMN1", 
                        HorizontalAxis = horizontalAxis1, 
                        VerticalAxis = verticalAxis1,
                        Shape = new CircleShape(),
                        BackColor = Color.Red,
                        BorderColor = Color.Black,
                        PointSize = new SizeF(10.0f, 10.0f),
                        IsVisibleInLegend = true
                    };
But the border of the shape is not drawn in black on the chart. But the same shape is drawn in the legend with a black border.

In a legend, I draw a shape using

        private void LegendElement_VisualItemCreating(object sender, LegendItemElementCreatingEventArgs e)
        {
            e.ItemElement = new LegendItemElement(e.LegendItem);
            if (!(e.LegendItem.Element is ScatterSeries seria)) return;
            e.ItemElement.MarkerElement.Shape = seria.Shape;
        }

How to set the border color for the shape on the chart?

3 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 15 Apr 2020, 01:31 PM

Hello Valery,

In order to see the border over the ScatterPointElements in ScatterSeria, you should set the ScatterPointElement.BorderWidth property:

ScatterSeries scatterSeries = new ScatterSeries()
            {
                BackColor = Color.Red,
                BorderColor = Color.Black,
                Shape = new CircleShape()
            };
foreach (ScatterPointElement point in scatterSeries.Children)
            {
                point.BorderWidth = 1;
            }
            this.radChartView1.Series.Add(scatterSeries);

I hope this helps. If you need any further assistance do not hesitate to ask.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Valery
Top achievements
Rank 1
Veteran
answered on 17 Apr 2020, 07:51 AM

Yes it works. But the problem still remains.

I set the BorderWidth to 0.5f

point.BorderWidth = 0.5f;

but in the legend this BorderWidth is clearly drawn thicker

 

0
Nadya | Tech Support Engineer
Telerik team
answered on 21 Apr 2020, 10:09 AM

Hello Valery,

If you want to adjust the border width of the legend elements, you should set the BorderWidth property of the LegendItemElements as well. It is recommended to do this in the Load event of the form:

private void RadForm2_ScatterSeria_Load(object sender, EventArgs e)
        {
            foreach (LegendItemElement item in this.radChartView1.ChartElement.LegendElement.StackElement.Children)
            {
                item.MarkerElement.BorderWidth = 0.5f;
                item.TitleElement.Text = "Legend";
            }
        }

I hope this helps. Should you have further questions I will be glad to help.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
ChartView
Asked by
Valery
Top achievements
Rank 1
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Valery
Top achievements
Rank 1
Veteran
Share this question
or