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 Reply Children
  • 34430
    Verified Answer
    Offline posted in reply to Rob Den

    Hello Rob,

    The code-base of 15.2 and 15.1 with respect to the XamDataChart is largely the same, but there were a few things added. You can see the features that were added here: http://help.infragistics.com/doc/WPF/2015.2/CLR4.0/?page=Whats_New_in_2015_Volume_2.html. Also, the 15.2 product is still very young in its product lifecycle with much development still to come for it, whereas 15.1 is a little bit older and has a little bit less development scheduled for it. For these reasons, I would recommend upgrading to 15.2 over 15.1 at the moment.

    Regarding the custom tooltip, you can set the Tooltip property on your series in your XamDataChart to a new ContentControl and set the content of that ContentControl to be what you would like to show on hover of the markers. This tooltip's data context will be that of an Infragistics.Controls.Charts.DataContext item, which will have access to the Series and the data item that is used. So, for example, if you bind a TextBlock's Text property to Series.Title or Item.PropertyNameOnDataItem, you can show your data item properties or the title of the series in the tooltip on the markers of your series.

    On terms of modifying the sample project to get the string label from the data context of the NumericYAxis label rather than a list from the ViewModel, I have been speaking with my colleagues about doing this, and unfortunately, every path to doing this will lead to essentially the same thing that is done in the UpdateLabel method of the CustomLabel class in the sample I had sent you. The numeric axes in the XamDataChart don't really have any concept of a "data item." They work directly with the series itself and display the parts of the series that correspond to certain values as designated by the ValueMemberPath of the series. For you to get the data items directly from the data context of the labels, this would require you to correlate your data source with the label somehow, which would almost certainly involve bringing in the ViewModel and the collections contained in it, which is what is currently being done in the sample.

    I have attached a modified version of the sample project that I had sent you to demonstrate the custom tooltips on the markers of the StepLineSeries. I hope this helps.

    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