Hello,
I am using the XamDataChart from the new release of WPF DV (v11.1).
I am having a hard time finding out how to set the property ItemsSource on CategoryDateTimeXAxis in the following case:
On a single chart (with CategoryDateTimeXAxis as X-Axis) I'd like to display two series whose sources are different. I am using the new properties MinimumValue and MaximumValue to specify the X-Axis range I want to display. Apparently, I also need to set the ItemsSource to something if I want to see series on the chart, but I have two questions regarding this:
First, what is the purpose of ItemsSource, how is it used?
Second, what should I set ItemsSource to in order to see my two series correctly drawn? (I tried to set it to different things like the source of one of the series or the concatenation of the serie' sources or a list made of only the minimum and maximum values, etc... but it did not work)
Any help will be really appreciated,
Thanks a lot,
Carole
Carole,
The ItemsSource on the CategoryDateTimeXAxis works in conjuction with the DateTimeMemberPath to alert the axis to what property on your data items represents the date value for the item. Since the CategoryDateTimeXAxis will display the points spaced depending on the amount of time between them, etc. It needs to know the Date value for each item.
So, for example, if the class for your data items looked like this:
public class DataItem
{
public double Value { get; set; }
public DateTime Date { get; set; }
}
And you had the data set up as the DataContext for the chart, you might set up your CategoryDateTimeXAxis like this:
<igChart:CategoryDateTimeXAxis x:Name="xAxis" ItemsSource="{Binding} DateTimeMemberPath="Date" Label="{Date}" />
or something of that nature.
If you have 2 different series that are using the CategoryDateTimeXAxis, it really depends on how your data is aligned and sorted. If your data is in the same order for the two series and there are the same number of items, you may be able to share the same CategoryDateTimeXAxis, otherwise, you will need to create a CategoryDateTimeXAxis for each series (binding the same data to the itemssource for each as the itemssource for the series). Then, to make the time spans align, you should set the minimum and maximum values for each CategoryDateTimeXAxis to be equal.
I hope this helps. Please ask me to elaborate if something is unclear.
-Graham
Hi Graham,
Thanks a lot for your quick reply. Everything is clear, thank you.
I have last question about that: I understand that is possible to define multiple axis and hence plotting many series on the same chart. However, from a user perspective it would be very nice to be able to share the same CategoryDateTimeXAxis among many series that contains the same type of item (for comparison purpose for instance). Is this something that Infragistics is planning on implementing in the future?
Thanks a lot,Carole
Ah ok, I understand.
I'll be watching new release then, in case it comes up!
HI Carole,
I have sent you information in a private support case regarding the feature request that has been logged:
Excellent, thanks Francis!
Urgent : Has this feature been added in the 2011.2 release i.e. Multiple data series (from multiple sources) sharing the same X Axis?
Hi,
I am stuck, i do not success to make a chart with two data collection on datetime axis, with a different number of items on different datetime.
Can you send an example of Chart with two different data collection 2 CategoryDateTimeXAxis + 2 NumericYAxis binding in codebehind on 2 Observablecollection.
Common data collection structure:
public class GraphDataPoint { public DateTime Label { get; set; } public double Value { get; set; } }
Also Same question as VaibhavChadia.
Jean-Luc
[Solved]