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

Labels over current values

1 Answer 74 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 11 Sep 2015, 07:44 PM
I have been asked to implement functionality so that as the user moves over a chart comprised of line series, that not only does an ellipse get drawn at the datapoints in the same vertical area of the chart but a label above the datapoints as well. To help visualize, imagine the "Zooming and Scrolling" ChartView example. In the top chart there is an area series being rendered in blue. As you move the mouse over the chart a dot is rendered over the point closest to the cursor. The users have asked for not only a dot, but the chart Y value displayed above the dot (in this example, the price). I recognize that this example is utilizing the trackball functionality of the chart, but I can't quite figure out how to get a label to appear above each series dot with the values. Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 16 Sep 2015, 03:35 PM
Hi David,

You can achieve your requirement using the approach with the trackball from the Zooming and Scrolling example along with custom LabelDefinition for the series. Basically, you can show the labels of the series, then define a property in the data points view model that tells if a point's label should be visible. After, this you can define a Template for the custom label definition and bind the Visibility of the element int he template to the property in the view model. You can use the TrackInfoUpdated event of the trackball behavior to get the highlighted data points and set the property that determines the visibility of the label. 

For your convenience I attached a sample project demonstrating this approach. Please give it a try and let me know if you need any further assistance.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ChartView
Asked by
David
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or