I'm currently testing out IG's DataVisualizaion and Charting tools, xamDataChart looks very nice, and I'm wondering if it can emulate, in xaml, a sort of DataTemplate wrapper for a Series (Line particularly). I've had success with a different Charting toolkit with an external wrapper class, and it's code looked something like this:
<multiChart:MultiChart> <multiChart:MultiChart.SeriesTemplate> <DataTemplate> <chartingToolkit:LineSeries /> </DataTemplate> </multiChart:MultiChart.SeriesTemplate> </multiChart:MultiChart>
The DataTemplate's the crucial part, as I do not know how many series I'll need to render until runtime. I don't see any kind of DataTemplate in the XamDataChart class, would there be another way to achieve this kind of behavior?
Hi,
Please see this post.
http://community.infragistics.com/forums/p/40011/242380.aspx#242380
Its possible it may need a small adjustment for the WPF version due to some different ways that DataContext is handled. Let me know if you have any problems or questions. I'll try to test this out later today myself and see if it needs any WPF adjustments.
We have been considering adding this feature natively. If you are interested in it, you could make a feature request to lodge your vote for it.
Hope this helps!
-Graham
The version I linked is a bit complicated, but very flexible, because it does everything with attached properties. You could also approach it with a just wrapper class instead which may simplify some things, but decrease the flexibility an amount.
As I feared it may need a few adjustments for WPF, I'll get back to you.
WPF works differently in some binding aspects compared to Silverlight. To get the linked sample to work for WPF, adjust your xaml like so:
<ig:XamDataChart Name="xamDataChart1" > <ig:XamDataChart.Axes> <ig:CategoryXAxis x:Name="xAxis" ItemsSource="{Binding ElementName=xamDataChart1, Path=Series[(System:Int32)0].ItemsSource}" Label="{}{Label}"/> <ig:NumericYAxis x:Name="yAxis" /> </ig:XamDataChart.Axes> <local:SeriesBinder.BindingInfo> <local:SeriesBindingInfo ItemsSource="{Binding}"> <local:SeriesBindingInfo.SeriesTemplate> <DataTemplate> <ig:LineSeries ItemsSource="{Binding Item.Data}" ValueMemberPath="{Binding Item.ValueMemberPath}" XAxis="{Binding Path=Owner.Axes[(System:Int32)0]}" YAxis="{Binding Path=Owner.Axes[(System:Int32)1]}" > </ig:LineSeries> </DataTemplate> </local:SeriesBindingInfo.SeriesTemplate> </local:SeriesBindingInfo> </local:SeriesBinder.BindingInfo> </ig:XamDataChart>
Let me know if this helps.
Hi Graham
I'm currently testing out IG's tools to decide each buy it or not.The sample features in this post are very important for us. But I have some trouble with the xaml.I get an XamlParseException -Declaration of a value for \"System.Windows.Baml2006.TypeConverterMarkupExtension\" release an Exception-
on
<ig:CategoryXAxis x:Name="xAxis" ItemsSource="{Binding ElementName=xamDataChart1, Path=Series[(System:Int32)0].ItemsSource}" Label="{}{Label}"/>
please, what can be the reason.
Toni
Have you defined the System namespace on the root element?
It should look like this:
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:System="clr-namespace:System;assembly=mscorlib"
rather, Capital S.
Thanks for your reply. I have temporarily moved on to a different project and have not been able to come back to this. However, part of my post was answered in another post. Graham Murray posted a reply on 08/06/2012 @9:30am to "Cannot add 2 lineSeries to 1 xamDataChart" which says:
"when using the CategoryDateTimeXAxis, unless each series has exactly the same number of entries with the same dates in the same order, you should use a seperate CategoryDateTimeXAxis per series."
That answers the first part of my post where the values on the second series are being ignored and are using the ones from the first data series.
I think the answer to the second part of my question as to the second data series not displaying in the chart at all is to not use the CatageoryDateTimeXAxis. It just seems to be doing a lot of stuff on it's own that I don't want. (Like the above as well as "the CategoryDateTimeXAxis handles reordering of unordered data and auto-min/max") I wasn't aware it behaved that way. I will most likely have to go to a basic CategoryXAxis.
Hello Michael,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post, but it seems like that I am missing something in your scenario, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Feel free to write me if you have further questions.
I know this post is pretty old, but I'm hoping I can still get a little help. I am having the exact same problem that tzieger did. I'll see if I can explain it.The data items I am displaying have a Price on the Y-Axis and a DateTime on the X-Axis. When I add a single series, everything displays correctly. However, when I add a second series, the new data points are not displayed correctly. The DateTime values from the second series are ignored and are plotted at the same X-Axis values as the first series that was added to the collection.For example: Series 1 has two items: ($2.34, 9:34:23) ($2.35, 9:37:13) Series 2 has two items: ($2.38, 9:35:51) ($2.36, 9:36:44)The data points from Series 2 display at the points from Series 1. Thus, Series 2 effectively becomes ($2.38, 9:34:23) ($2.36, 9:37:13)I have tried your workaround by creating an axis per series, but not matter what I do, the chart comes up blank. The Y-Axis label displays correctly, but there is nothing displayed for the X-Axis labels and no series are displayed on the chart.I'm using XamDataChart Version 12.1. Here is the before and after xaml.Before:<igXaml:XamDataChart x:Name="igdcOrderUpdates"> <igXaml:XamDataChart.Axes> <igXaml:CategoryDateTimeXAxis x:Name="xAxisOrderUpdates" ItemsSource="{Binding ElementName=igdcOrderUpdates, Path=Series[(System:Int32)0].ItemsSource}" DateTimeMemberPath="OrderTimeStamp" Label="{}{OrderTimeStamp:HH:mm:ss}"> <igXaml:CategoryDateTimeXAxis.LabelSettings> <igXaml:AxisLabelSettings Extent="55" VerticalAlignment="Center" Angle="45" /> </igXaml:CategoryDateTimeXAxis.LabelSettings> </igXaml:CategoryDateTimeXAxis> <igXaml:NumericYAxis x:Name="yAxisOrderUpdates" Label="{}{0:C}" MaximumValue="{Binding Path=MaxYAxisValue, Mode=TwoWay}" MinimumValue="{Binding Path=MinYAxisValue, Mode=TwoWay}"> <igXaml:NumericYAxis.LabelSettings> <igXaml:AxisLabelSettings Extent="50" HorizontalAlignment="Center" /> </igXaml:NumericYAxis.LabelSettings> </igXaml:NumericYAxis> </igXaml:XamDataChart.Axes> <glpCharts:SeriesBinder.BindingInfo> <glpCharts:SeriesBindingInfo ItemsSource="{Binding Path=OrderSeries}"> <glpCharts:SeriesBindingInfo.SeriesTemplate> <DataTemplate> <igXaml:LineSeries ItemsSource="{Binding Item.Data}" ValueMemberPath="{Binding Item.ValueMemberPath}" XAxis="{Binding Path=Owner.Axes[(System:Int32)0]}" YAxis="{Binding Path=Owner.Axes[(System:Int32)1]}" /> </DataTemplate> </glpCharts:SeriesBindingInfo.SeriesTemplate> </glpCharts:SeriesBindingInfo> </glpCharts:SeriesBinder.BindingInfo></igXaml:XamDataChart>After:<igXaml:XamDataChart x:Name="igdcOrderUpdates"> <igXaml:XamDataChart.Axes> <igXaml:NumericYAxis x:Name="yAxisOrderUpdates" Label="{}{0:C}" MaximumValue="{Binding Path=MaxYAxisValue, Mode=TwoWay}" MinimumValue="{Binding Path=MinYAxisValue, Mode=TwoWay}"> <igXaml:NumericYAxis.LabelSettings> <igXaml:AxisLabelSettings Extent="50" HorizontalAlignment="Center" /> </igXaml:NumericYAxis.LabelSettings> </igXaml:NumericYAxis> </igXaml:XamDataChart.Axes> <glpCharts:SeriesBinder.BindingInfo> <glpCharts:SeriesBindingInfo ItemsSource="{Binding Path=OrderSeries}"> <glpCharts:SeriesBindingInfo.SeriesTemplate> <DataTemplate> <igXaml:LineSeries ItemsSource="{Binding Item.Data, Mode=OneWay}" ValueMemberPath="{Binding Item.ValueMemberPath}" YAxis="{Binding Path=Owner.Axes[(System:Int32)0]}"> <igXaml:LineSeries.XAxis> <igXaml:CategoryDateTimeXAxis x:Name="xAxisOrderUpdates" DateTimeMemberPath="{Binding OrderTimeStamp}" Label="{}{OrderTimeStamp:HH:mm:ss}"> <igXaml:CategoryDateTimeXAxis.LabelSettings> <igXaml:AxisLabelSettings Extent="55" VerticalAlignment="Center" Angle="45" /> </igXaml:CategoryDateTimeXAxis.LabelSettings> </igXaml:CategoryDateTimeXAxis> </igXaml:LineSeries.XAxis> </igXaml:LineSeries> </DataTemplate> </glpCharts:SeriesBindingInfo.SeriesTemplate> </glpCharts:SeriesBindingInfo> </glpCharts:SeriesBinder.BindingInfo></igXaml:XamDataChart>
Unfortunately I don't believe you can currently download a service release for a trial product. If you contact developer support or product management, they may be able to get you a work around.
It seems to go! Except the synchronization of CategoryDateTimeXAxis.In my trial version (actual version 10.3) CategoryDateTimeXAxis has not a MinimumValue or MaximumValue property. Can you tell me, where I can download the Service Release for the actual trial version?(In "My IG"/"My Keys and Downloads" I can only download the Service Release for a registered version)