Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
485
XamDataChat StepLineSeries to show binded string property value on Y-Axis.
posted

Hello,

I have a xamdatachart that needs to show both Line Series (Numeric y-Axis and DateTime on X-axis) and StepLineSeries (Strings on Y-Axis and DateTime on X-axis).

Line series is fine, but with StepLineSeries I have some problems.

1.) Right now I am mapping string values to some numeric values like 0,1,2 ... etc. to plot it againts Datetime x-axis. Is this the only way or can I bind the string values directly to y axis keeping datetime x-axis as it is?
2.) If I use the numeric y axis, to support both series on the same chart (using above mentioned way), I am having trouble with y-axis labels. How to bind the y-axis label with the 'Label' property (string type) that I have in the model class the series is binded with the collection of?

PS: I know the Y2 axis as well and that too needs to be handled the same way Y1 axis will be.

Please answer ASAP. Thanks in advance.

Parents
  • 34430
    Offline posted

    Hello Rob,

    Thank you for your post.

    I have been investigating into this issue that you are having, and to my knowledge, I don't believe you can currently bind the Label property of the Numeric axes to a string value. They expect numeric values. However, there is still a way that you can achieve your requirement by continuing with the string value mapping.

    The axes in the XamDataChart have an event named FormatLabel, and this fires when the XamDataChart loads and the labels for that particular axis are created. This event will be fired for each label that is created for that particular axis, and you can get what the label normally would be from the parameters of the event handler. The event handler for this event is not a void, though, as it expects a string to be returned to be used for the label.

    With the above in mind, I would recommend that you continue with the string mapping and query the collection that you have bound to the XamDataChart based on the value that would normally exist for your particular label. This will allow you to get the string that you have mapped to that particular number that would normally be displayed as the label for the YAxis and return the string representation of it. That string will then be shown in its place. This should work for usage of multiple y axes in for multiple series as well, as I have demonstrated in the attached sample project.

    I hope this helps you. Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamDataChartYAxisLabelsCase.zip
Reply Children