How to draw on the chartview

3 posts, 1 answers
  1. Vincent
    Vincent avatar
    9 posts
    Member since:
    Sep 2014

    Posted 08 Apr 2015 Link to this post

    I'm trying to have a range of my chart. The range as a slope of y = ax+b, plus a tolerance for the width of the band.

    I know that I can draw a line with 2 points, but I'm trying to achieve something like the picture attached knowing that the user will be able to change the slope and tolerance via two spineditor.




  2. Answer
    Dimitar avatar
    2907 posts

    Posted 09 Apr 2015 Link to this post

    Hi Vincent,

    Thank you for contacting us.

    The easiest way to achieve this is to add an additional RangeSeries to the chart. For example:
    public RadForm1()
        LineSeries lineSeries = new LineSeries();
        lineSeries.DataPoints.Add(new CategoricalDataPoint(20, 30));
        lineSeries.DataPoints.Add(new CategoricalDataPoint(22, 40));
        lineSeries.DataPoints.Add(new CategoricalDataPoint(12, 50));
        lineSeries.DataPoints.Add(new CategoricalDataPoint(19, 60));
        lineSeries.DataPoints.Add(new CategoricalDataPoint(6, 70));
        lineSeries.DataPoints.Add(new CategoricalDataPoint(35, 80));
        lineSeries.DataPoints.Add(new CategoricalDataPoint(60, 90));
        lineSeries.PointSize = new SizeF(10f,10f);
        lineSeries.BorderColor = Color.Transparent;
    double tolernace = 10;
    public RangeSeries BuildRange()
        var series = radChartView1.Series[0];
        RangeSeries rangeSeries = new RangeSeries();
        for (int i = 0; i < series.DataPoints.Count; i++)
            CategoricalDataPoint point = series.DataPoints[i] as CategoricalDataPoint;
            rangeSeries.DataPoints.Add(new RangeDataPoint((double)point.Value + tolernace, (double)point.Value - tolernace,point.Category));
        return rangeSeries;

    The result is shown in the attached image.

    Please let me know if there is something else I can help you with. 

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

  3. Vincent
    Vincent avatar
    9 posts
    Member since:
    Sep 2014

    Posted 10 Apr 2015 in reply to Dimitar Link to this post

    Thanks for the help, it's working!
Back to Top