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

Enum values on the y-axis

5 Answers 123 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Autolog
Top achievements
Rank 1
Autolog asked on 02 Jul 2010, 12:12 PM
Hi,

I some simple data with a date and an enum value, and I want a graph showing this data over time, with date on the x-axis and the enum value on the y-axis.

However simply specifying the field name as normal

<telerik:ItemMapping DataPointMember="YValue" FieldName="BrakeSwitch" ...

does not work. The graph shows nothing on the y-axis.

Any ideas?

brgds,
Thomas Scheelhardt

5 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 07 Jul 2010, 08:53 AM
Hello Thomas,

Mapping enum values to the Y-Axis would not display any data, as YValue DataPointMember expects a numeric value, which would define the position of the point in the graph.The numeric value is usually measured by one of the axes and the criteria - placed along the other one. 

A possible work-around would be introducing a fake YValue for your items, which would refer to the specific values you want to display along the Y-Axis and then customizing the axis so that it show these values as labels. You can customize the Y-Axis by setting the AutoRange property to false, then call the AddRange method and finally loop through axis' Ticks collection to update their labels.

Hope this helps.

All the best,
Nikolay
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Autolog
Top achievements
Rank 1
answered on 07 Jul 2010, 10:17 AM
Hi,

Thanks for the reply.
Technically speaking enums are numeric values, but simply showing the name of the enum values would likely not satisfy requirements, so setting the tick labels explicitly is much better.

In other words the suggested solution does exactly what I needed.

A minor correction is that it is obviously the Y-axis TickPoints that the labels should be changed for.
It also has to be done in code behind after the InitializeComponent so that the TickPoints are actually there. Doing it in xaml will fail.

brgds,
Thomas Scheelhardt
0
1897
Top achievements
Rank 1
answered on 29 Aug 2010, 09:38 PM
how to remove following items from the image ?

help me please.
0
Nikolay
Telerik team
answered on 01 Sep 2010, 01:07 PM
Hi 1897,

Here is a an example code snippet demonstrating how to hide the labels and point-marks :
LineSeriesDefinition lineDef = new LineSeriesDefinition();
lineDef.ShowPointMarks = false;
lineDef.ShowItemLabels = false;

For more information, here is an example demonstrating how to hide labels, and in this example you can see how to hide the point-marks.

Hope this helps.

Best wishes,
Nikolay
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
1897
Top achievements
Rank 1
answered on 01 Sep 2010, 05:25 PM
thanks Nikolay , I already found it :))
Tags
Chart
Asked by
Autolog
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Autolog
Top achievements
Rank 1
1897
Top achievements
Rank 1
Share this question
or