Guys,
I'm getting following error when I'm trying to Implement xamDataChart with RIA Services
Here is my xaml code
<Grid x:Name="LayoutRoot" Background="White">
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:vwTranDtl, CreateList=true}" Height="0" LoadedData="vwTranDtlDomainDataSource_LoadedData" Name="vwTranDtlDomainDataSource" QueryName="GetVwTranDtlsQuery" Width="0">
<riaControls:DomainDataSource.DomainContext>
<my:CSFContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<igChart:XamDataChart
DataContext="{Binding ElementName=vwTranDtlDomainDataSource, Path=Data}"
Name="xamDataChart1">
<igChart:XamDataChart.Axes>
<igChart:CategoryDateTimeXAxis x:Name="XAxis1" VerticalAlignment="Top"
ItemsSource="{Binding}" DateTimeMemberPath="TransactionDate"
Label="{}{Date:d}">
</igChart:CategoryDateTimeXAxis>
</igChart:XamDataChart.Axes>
<igChart:XamDataChart.Series>
<igChart:LineSeries
Title="277"
Legend="{Binding ElementName=Legend1}"
XAxis="{Binding ElementName=XAxis1}"
YAxis="{Binding ElementName=YAxis1}"
MarkerType="None"
Brush="Aqua"
BorderThickness="2"
ItemsSource="{Binding}"
ValueMemberPath="C277"/>
<igChart:LineSeries Title="278"
Brush="Black"
ValueMemberPath="C278"/>
</igChart:XamDataChart.Series>
</igChart:XamDataChart>
</Grid>
When I'm executing this I'm getting error as follows
I'm using following references to my silverlight project.
InfragisticsSL4.Controls.Charts.XamDataChart.v10.2
InfragisticsSL4.DataVisualization.v10.2
InfragisticsSL4.v10.2
Silverlight Toolkit Common Controls.Toolkit
Please let me know what's wrong with this..?
I'm using Infragistics NetAdvantage 2010.2 Silverlight DV
InfragisticsSL4.Controls.Charts.XamDataChart.v10.2.dll
Thanks & Regards,
Sandip
Hi,
Could you please either provide the stack trace from that exception or a sample project that replicates the issue. There are a bit too many moving parts to make any conclusions from your description alone.
Thanks,
Graham
Which version are you running, and which is the exception that you get? Are you making sure that any interaction with the chart is marshalled through the chart's Dispatcher?
-Graham
I get the same exception when I use the "thread-safe datamodel" for multithread-environment described at http://shevaspace.blogspot.com/2007/03/databinding-multi-threading-in-wpf-part_3600.html
with a xamdatachart including a financialseries, xaxis and yaxis. If the worker-task runs in the main-thread, I don't get the exception. What is the issue? Is that fixed in some release? If not, when will it be fixed? Could you provide a minimalistic work-around, more simple than what you sent before?
Thank you in advance!
Jeromerg
Here's one way to go about working around the issue with the RTM build. It displays a loading splash in place of the chart until the data is ready.The Xaml:
<UserControl.Resources> <local:TestData x:Key="data" /> <local:VisibilityConverter x:Key="visibilityConverter" /> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <Border Background="Gray" Visibility="{Binding Source={StaticResource data}, Path=IsLoading, Converter={StaticResource visibilityConverter}}" > <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="Loading" Foreground="White" FontSize="40" /> </Border> <igChart:XamDataChart x:Name="theChart" Visibility="{Binding Source={StaticResource data}, Path=IsLoaded, Converter={StaticResource visibilityConverter}}"> <igChart:XamDataChart.Axes> <igChart:NumericYAxis x:Name="yAxis" /> <igChart:CategoryDateTimeXAxis x:Name="dateAxis" DateTimeMemberPath="Date" Label="{}{Date:MM/dd/yy hh:mm:ss}" ItemsSource="{StaticResource data}"/> </igChart:XamDataChart.Axes> <igChart:XamDataChart.Series> <igChart:LineSeries x:Name="lineSeries" XAxis="{Binding ElementName=dateAxis}" YAxis="{Binding ElementName=yAxis}" ItemsSource="{StaticResource data}" ValueMemberPath="Value" /> </igChart:XamDataChart.Series> </igChart:XamDataChart> </Grid>
And the code behind:
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); ThreadStart start = new ThreadStart(DoAddData); Thread thread = new Thread(start); thread.Start(); } public void DoAddData() { System.Threading.Thread.Sleep(5000); Dispatcher.BeginInvoke( AddData); } public void AddData() { var testData = Resources["data"] as TestData; testData.Add( new TestDataItem() { Date = DateTime.Now.AddDays(-5), Value = 1 }); testData.Add( new TestDataItem() { Date = DateTime.Now.AddDays(-4), Value = 2 }); testData.Add( new TestDataItem() { Date = DateTime.Now.AddDays(-3), Value = 3 }); testData.Add( new TestDataItem() { Date = DateTime.Now.AddDays(-2), Value = 4 }); testData.Add( new TestDataItem() { Date = DateTime.Now.AddDays(-1), Value = 5 }); testData.IsLoading = false; testData.IsLoaded = true; } } public class VisibilityConverter : IValueConverter { public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value is bool && targetType == typeof(Visibility)) { if ((bool)value) { return Visibility.Visible; } else { return Visibility.Collapsed; } } return null; } public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } public class TestData : ObservableCollection<TestDataItem> { public TestData() { IsLoaded = false; IsLoading = true; } private bool _isLoading; public bool IsLoading { get { return _isLoading; } set { _isLoading = value; OnPropertyChanged( new PropertyChangedEventArgs("IsLoading")); } } private bool _isLoaded; public bool IsLoaded { get { return _isLoaded; } set { _isLoaded = value; OnPropertyChanged( new PropertyChangedEventArgs("IsLoaded")); } } } public class TestDataItem { public DateTime Date { get; set; } public double Value { get; set; } }
Hope this helps! Let me know if you have any questions.-Graham
The trial represents the RTM version of the chart where the issue existed. If I can reproduce the issue here I'll see if I can find you a work around for that version. I may not be recalling correctly, but I don't think this issue occurred if the chart initially had some data assigned to it. When you are using RIA services, because the access is asynchronous, you create a case where the chart is displayed before there is data assigned to it. I believe the initial version of the CategoryDateTimeXAxis may have had some issues with this scenario in some situations. You could also try deferring the initial display of the chart until you are notified that the data has arrived. Also, the CategoryXAxis does not exhibit this error, if it is possible to use that axis for your evaluation.
Hi Graham,
I have downloaded the trials just a few days ago. The InfragisticsSL4.Controls.Charts.XamDataChart.v10.2.dll shows 10.2.20102.1029 as the file version....