Hello Everyone,I have been trying to databind my XamChart (stackedColumn) to display a chart based on a custom data that I have.UI consist of a XamChart and a selector control which allows user to select what data should be displayed.Though it works for me when I just do it in code-behind by removing the series (calling clear) on a property change for CurrentGraph in my ViewModel and then adding the data again, but if I set the DataContext on XamChart and then set the DataSource for my Series, it just displays the data for first chart but does not refreshes it again when new option is selected.Seems like the chart is not being refreshed or reloaded.I have tried the solutions mentioned an http://news.infragistics.com/forums/t/15543.aspx but it still does not work for me.This is how I am doing data binding : <Grid MinHeight="100" Name="ChartGrid" > <igCA:XamChart Name="DataChart" RefreshEnabled="True" Style="{StaticResource XamChartStyle}" DataContext="{Binding Path=CurrentGraph.Results}" > <igCA:XamChart.Scene> <igCA:Scene BorderBrush="Black"> <igCA:Scene.GridArea> <igCA:GridArea Style="{StaticResource GridAreaStyle}"/> </igCA:Scene.GridArea> </igCA:Scene> </igCA:XamChart.Scene> <!-- Series --> <igCA:XamChart.Series> <igCA:Series ChartType="StackedColumn" DataSource="{Binding Path=ZAxisValues}" DataMapping="Label = XAxisValue; Value = YAxisValue" UseDataTemplate="True"> <igCA:Series.Marker> <igCA:Marker Foreground="RosyBrown"/> </igCA:Series.Marker> </igCA:Series> </igCA:XamChart.Series> <igCA:XamChart.Axes> <igCA:Axis AxisType="PrimaryX" Animation="{StaticResource AxisAnimation}" MajorGridline="{StaticResource AnimationMarkX}" Label="{StaticResource AnimationLabelsX}"/> <igCA:Axis AxisType="PrimaryY" Animation="{StaticResource AxisAnimation}" MajorGridline="{StaticResource AnimationMarkY}" Label="{StaticResource AnimationLabelsY}"> <igCA:Axis.Stripes> <igCA:Stripe Style="{StaticResource StripeStyle}"/> </igCA:Axis.Stripes> </igCA:Axis> </igCA:XamChart.Axes> </igCA:XamChart> </Grid>I also have put a property change listener in my code behind just in case it might help : void viewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName.Equals("CurrentGraphDisplay")) { DataChart.DataSourceRefresh(); DataChart.Refresh(); } }
Any clues about how to make it reload the chart
Thanks
i don't think it's possible for the chart to refresh the data without re-querying the database in some way. as for the styles, etc, they should change as soon as the style property values are changed, and failing that, a refresh can be forced using the chart's Refresh() method.
How to refresh the data which is already binded, how to force the chart to refresh data, styles, foramats, Axis labels, Axis titles without re-quering the data from the back end server/ database.
~Narayan B
NarayanNB,
did you have a question, or are you demonstrating something with this source code?
public
Window
{
Window2()
InitializeComponent();
}
e)
PopulatePieChart(MyChartControl);
PopulateBarChart(MyChartControl);
<summary>
Populate pie chart with datasource in xaml
</summary>
<param name="chart"></param>
chart)
chart.TextValue =
;
chart.DataSource =
.ConstructTestData();
chart.SeriesMapLabel =
chart.SeriesMapValue =
chart.SeriesMapToolTip =
chart.Legend =
chart.ChartControlType = Infragistics.Windows.Chart.
.Pie;
Populate bar chart with datasource dynamically
*** This code create series dynamically.
Infragistics.Windows.Chart.
();
series.DataSource =
.GetValues();
series.ChartType = Infragistics.Windows.Chart.
.Cylinder ;
series.DataMapping =
colln.Add(series);
series =
.Cylinder;
chart.SeriesList = colln;
#region
Data for Pie Chart
total)
FundType = type;
Total = total;
; }
> ConstructTestData()
>();
assetClasses.Add(
, 2.56));
, 4.92));
, 8.92));
assetClasses;
#endregion
Estimates
Estimates() { }
seriesValueTemp)
.SeriesLabel = seriesLabel;
.SeriesValue = seriesValue;
SeriesValueTemp = seriesValueTemp;
Assign the value to Series datamaping label
Assign the value to Series datamaping Value
> GetValues()
(250);
i = 0; i < 10; i++)
values.Add(
.Now.Date.ToString(), i ,rnd.Next(20)));
values;
it sounds just like the problem mentioned in the other thread which you referred to. however, i haven't been able to reproduce this problem. in every case I've seen, calling the Refresh() method is enough to update the chart. do you have a sample project or steps to reproduce?