Display Boolean Indicators in Y-axis

2 posts, 0 answers
  1. Terry
    Terry avatar
    19 posts
    Member since:
    Feb 2014

    Posted 07 Oct 2014 Link to this post

    I have a chartview with a vertical linear axis. I have a dropdown that can be toggled changing the item that is graphed. Typically the item that is graphed is a numeric value that is not bound to any specific range. The chartview component handles this really well and adjusts the Y-axis values/ticks appropriately. No issues. Works well. 

    However, I am now getting items that are True/False and I would like to display the as either on/off, or even 1 or 0. Thus I want 2 ticks with the first tick having the value of 0 (minimum) and the second tick have a value of 1. And that is it. How can I do that?

    Also, when a new item is selected to graph, I would like to resort to the charts default behavior of readjusting the ticks and values to scale to the values being graphed.

  2. Petar Marchev
    Petar Marchev avatar
    999 posts

    Posted 08 Oct 2014 Link to this post

    Hi Terry,

    Our chartview does not have a built-in true-false series. We have a similar control in our Sparklines set, the RadWinLossSparkline.

    With the chartview you can use a work around. You can set the ValueBinding property of the series to be a GenericDataPointBinding<YourDataItem, int> and use a ValueSelector that returns a 0 when the value is false, and returns 1 when the value is true. If you are using bar series, you may want to return -1 if the value is false, this highly depends on the desired results. You may need to set a static Minimum and Maximum for the axis. If you want to see "Ture" and "False" labels instead of "1" and "-1" labels on the axis, you can use a LabelTemplate or the LabelTemplateSelector to adjust a desired look.

    I hope this inormation helps. Let us know if you need more information.

    Petar Marchev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top