ChartView label posisition

5 posts, 0 answers
  1. Rinno
    Rinno avatar
    6 posts
    Member since:
    Sep 2014

    Posted 21 Sep 2014 Link to this post

    I have Winforms application with ChartView that received real time data and i have label the show the data value. After each point received inside my Timer tick all the points remove in order to show my label only once:private AreaSeries series;

    private void timerStatistics_Tick(object sender, EventArgs e)
    {
           try
         {
            chartPoints.Add(AdapterStatistics.BitsPerSecond * 0.000001);
            series.DataPoints.Add(new Telerik.Charting.CategoricalDataPoint(AdapterStatistics.BitsPerSecond * 0.000001));

           RemoveLabels();
           series.DataPoints[series.DataPoints.Count - 1].Label = AdapterStatistics.TrafficStatistics;
         }
           catch (Exception)
           { }
    }

    private void RemoveLabels()
    {
         for (int i = 0; i < series.DataPoints.Count - 1; i++)
         series.DataPoints[i].Label = "";
    }

    my problem is that me label i in the right side of the lase point so almost all the label is hide (see attach file)
    Any idea if it possible to remove the label to the left of the last point inside my chart ?






  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 24 Sep 2014 Link to this post

    Hello Rinno,

    Thank you for writing.

    By default the labels are centered according to the datapoint. To change the label position you can use the PositionOffset property. The label element properties can be accessed in the LabelFormatting event:
    private void radChartView1_LabelFormatting(object sender, ChartViewLabelFormattingEventArgs e)
    {           
        Size textSize = TextRenderer.MeasureText(e.LabelElement.Text, e.LabelElement.Font);
        PointLabelElement el = e.LabelElement as PointLabelElement;
        el.PositionOffset = new PointF(-textSize.Width / 2, 0);          
    }

    Let me know if you have additional questions.
     
    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Rinno
    Rinno avatar
    6 posts
    Member since:
    Sep 2014

    Posted 26 Sep 2014 in reply to Dimitar Link to this post

    It helped, thanks a lot for your help !
  5. Rinno
    Rinno avatar
    6 posts
    Member since:
    Sep 2014

    Posted 26 Sep 2014 in reply to Rinno Link to this post

    Please see my attach, why the node length is continue to growing with the progress bar value ?
  6. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 01 Oct 2014 Link to this post

    Hello Rinno,

    Thank you for writing back.

    I think you have posted in the wrong thread. So lets continue to discuss the custom nodes in the in the other thread.

    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready