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

ChartView label posisition

4 Answers 154 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Rinno
Top achievements
Rank 1
Rinno asked on 21 Sep 2014, 03:24 PM
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 ?






4 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Sep 2014, 03:11 PM
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.
 
0
Rinno
Top achievements
Rank 1
answered on 26 Sep 2014, 05:18 PM
It helped, thanks a lot for your help !
0
Rinno
Top achievements
Rank 1
answered on 26 Sep 2014, 05:42 PM
Please see my attach, why the node length is continue to growing with the progress bar value ?
0
Dimitar
Telerik team
answered on 01 Oct 2014, 08:39 AM
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.
 
Tags
ChartView
Asked by
Rinno
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Rinno
Top achievements
Rank 1
Share this question
or