Dashed border

2 posts, 0 answers
  1. Pauli
    Pauli avatar
    15 posts
    Member since:
    Nov 2009

    Posted 28 Apr 2015 Link to this post


    How can I get dashed line around pink part of the pie and bar in the attached picture?


  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3891 posts

    Posted 29 Apr 2015 Link to this post

    Hello Pauli,

    Thank you for writing.

    You can subscribe to the RadChartView.CreatePointElement event and apply the desired style regarding the border. Here is a sample code snippet demonstrating how customize the BarPointElement and the PiePointElement:
    public Form1()
        this.radChartView1.CreatePointElement += radChartView1_CreatePointElement;
        BarSeries barSeries = new BarSeries("Performance", "RepresentativeName");
        barSeries.Name = "Q1";          
        barSeries.DataPoints.Add(new CategoricalDataPoint(177, "Harley"));
        barSeries.DataPoints.Add(new CategoricalDataPoint(128, "White"));
        barSeries.DataPoints.Add(new CategoricalDataPoint(143, "Smith"));
        barSeries.CombineMode = ChartSeriesCombineMode.Stack;
        BarSeries barSeries2 = new BarSeries("Performance", "RepresentativeName");
        barSeries2.Name = "Q2";
        barSeries2.DataPoints.Add(new CategoricalDataPoint(153, "Harley"));
        barSeries2.DataPoints.Add(new CategoricalDataPoint(141, "White"));
        barSeries2.DataPoints.Add(new CategoricalDataPoint(130, "Smith"));
        barSeries2.CombineMode = ChartSeriesCombineMode.Stack;
        this.radChartView2.CreatePointElement += radChartView2_CreatePointElement;
        this.radChartView2.AreaType = ChartAreaType.Pie;
        PieSeries series = new PieSeries();       
        series.DataPoints.Add(new PieDataPoint(50, "Germany"));
        series.DataPoints.Add(new PieDataPoint(70, "United States"));
        series.DataPoints.Add(new PieDataPoint(40, "France"));
        series.DataPoints.Add(new PieDataPoint(25, "United Kingdom"));
    private void radChartView2_CreatePointElement(object sender, ChartViewCreatePointElementEventArgs e)
        PieDataPoint pieDatPoint = e.DataPoint as PieDataPoint ;
        if (pieDatPoint != null && pieDatPoint.LegendTitle == "United States")
            PiePointElement pieElement = new PiePointElement(pieDatPoint);
            e.DataPointElement = pieElement;
            pieElement.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            pieElement.BorderColor = Color.Black;
            pieElement.BackColor = Color.Fuchsia;
    private void radChartView1_CreatePointElement(object sender, ChartViewCreatePointElementEventArgs e)
        CategoricalDataPoint c = e.DataPoint as CategoricalDataPoint;
        if (c != null & e.Series is BarSeries & e.Series.Name == "Q2" & c.Category == "White")
            BarPointElement barElement = new BarPointElement(e.DataPoint);
            barElement.BorderWidth = 2;
            barElement.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            barElement.BackColor = Color.Fuchsia;
            barElement.BorderColor = Color.Black;
            e.DataPointElement = barElement;           

    I hope this information helps. Should you have further questions, I would be glad to help.

    See What's Next in App Development. Register for TelerikNEXT.

Back to Top