Enum values on the y-axis

6 posts, 1 answers
  1. Autolog
    Autolog avatar
    12 posts
    Member since:
    Jun 2010

    Posted 02 Jul 2010 Link to this post

    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
  2. Answer
    Nikolay
    Admin
    Nikolay avatar
    397 posts

    Posted 07 Jul 2010 Link to this post

    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
  3. Autolog
    Autolog avatar
    12 posts
    Member since:
    Jun 2010

    Posted 07 Jul 2010 Link to this post

    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
  4. 1897
    1897 avatar
    24 posts
    Member since:
    Aug 2010

    Posted 29 Aug 2010 Link to this post

    how to remove following items from the image ?

    help me please.
  5. Nikolay
    Admin
    Nikolay avatar
    397 posts

    Posted 01 Sep 2010 Link to this post

    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
  6. 1897
    1897 avatar
    24 posts
    Member since:
    Aug 2010

    Posted 01 Sep 2010 Link to this post

    thanks Nikolay , I already found it :))
Back to Top