Border color for shape

4 posts, 0 answers
  1. Valery
    Valery avatar
    65 posts
    Member since:
    May 2011

    Posted 14 Apr 2020 Link to this post

    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?

  2. Nadya
    Admin
    Nadya avatar
    481 posts

    Posted 15 Apr 2020 Link to this post

    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.
  3. Valery
    Valery avatar
    65 posts
    Member since:
    May 2011

    Posted 17 Apr 2020 in reply to Nadya Link to this post

    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

     

  4. Nadya
    Admin
    Nadya avatar
    481 posts

    Posted 21 Apr 2020 Link to this post

    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.
Back to Top