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
115
Defining CategoryDatetime axis in code behind
posted

Hello All,

In my first scenario, I had to build a chart with numeric Xaxis and numeric Yaxis (in the code behind). It worked like a charm when I defined it as:

series = new ScatterSeries();
series.ItemsSource = model.CDFResults[i].DataPoints;
series.MarkerType = MarkerType.Circle;
series.XMemberPath = "dt";
series.YMemberPath = "value";
series.XAxis = (NumericXAxis)NEWCHART.Axes.Where(x => x.Name == "thisisX").FirstOrDefault() as NumericXAxis;
series.YAxis = (NumericYAxis)NEWCHART.Axes.Where(x => x.Name == "thisisY").FirstOrDefault() as NumericYAxis;
series.ShowDefaultTooltip = true;

NEWCHART.Series.Add(series);

Now in the second case, the X axis needs to be datetime or Date. 

I couldn't find any option as series.CATEGORYDATETIME.. how do I define X axis as datetime type in the code behind? Please advice. Thanks!

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello Priyank,

    Thank you for your post!

    For the series in the XamDataChart, there are not separate properties for setting certain types of axes. This is done via the XAxis and YAxis properties only. However, there are two main types of series - Category and Numeric, and these series types define the types of axes that you can assign to those XAxis and YAxis properties. The ScatterSeries is of a numeric series type, and so it can only be used directly with the NumericXAxis and NumericYAxis. Usage of the CategoryDateTime-related axes with a ScatterSeries is currently unsupported.

    This is not to say that you cannot have your chart display Dates as the labels for those axes though. I would like you to take a look at this blog post which outlines the way you can display dates as your labels for NumericX or NumericY axes: http://ko.infragistics.com/community/blogs/kiril_matev/archive/2010/07/14/using-date-labels-with-scatter-series-in-the-xamdatachart.aspx.

    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

Children