I am trying to display a vertical stacked bar graph with dates and have taken the example from this thread:
http://es.infragistics.com/community/forums/t/64311.aspx
Which shows a CategoryXAxis being used. I have modified this example to use CategoryDateTimeXAxis but only one stacked bar is shown and the X-Axis does not seem to have the correct labeling. I moved most of the XAML declarations into the code-behind, but the only real difference is switching out:
CategoryXAxis xAxis = new CategoryXAxis();
with:
CategoryDateTimeXAxis xAxis = new CategoryDateTimeXAxis(); xAxis.DateTimeMemberPath = "Date";
What other changes have to be made for this to display like the original CategoryXAxis version?
This should be in the WPF controls forum, not sure how to move this there, but it may still apply to Silverlight also ...
Any idea why this happens?
Another weirdness I found was using a bracket in the value resolved by KeyMemberPath will exclude that data from being drawn.
For example:
Add(new InstalationEmissionDateInformation("A[]", 5, new DateTime(2012, 1, 1, 0, 0, 0), 1));
instead of
Add(new InstalationEmissionDateInformation("A", 5, new DateTime(2012, 1, 1, 0, 0, 0), 1));
Will exclude the "A" data set from being drawn with the rest of the data. Any idea why this is?
Thanks Andrew, that makes sense, in my example, I changed:
xAxis.DateTimeMemberPath = "Date";
to
xAxis.DateTimeMemberPath = "A_Date";
And it works as expected, thanks!
Hello Gary,
Thank you for your post!
The reason that you are seeing the behavior you are seeing is because now that you are using a GroupBy as your ItemsSource for your CategoryDateTimeXAxis, you are no longer using a collection of type InstallationEmissionDateInformation, but rather a collection of the GroupBy's groups. Each of these groups will have properties that will look something along the lines of "KeyMemberPathValue_ValueOfPropertyOnDataItem." This will happen for each of the properties on your data item.
For instance, the first element in your collection of type InstallationEmissionDateInformation has properties "A", 5, 1/1/2012, and 1" for Installation, Emission, Date, and Assignation, respectively. This means that each of the groups in your case will have properties A_Date, A_Installation, A_Emission, and A_Assignation, since the KeyMemberPath is the value for Installation in this case. If you change your DateTimeMemberPath to A_Date, B_Date, or C_Date, you will see the behavior you are looking for.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support