Hi Infragistics,I am having issues in getting the StackColumnSeries working through Binding. A very similar issue has already been raised at https://ko.infragistics.com/community/forums/f/retired-products-and-controls/64311/is-any-way-of-creating-dynamically-stackedfragmentseries-of-a-stackedcolumnseries/352486#352486
I have followed the same set of steps but did not get it working. It works only if the Group is sourced from the static resource not through the Binding. Please find the sample project that I would like to please review and suggest the way out.Many ThanksAmir Bakhsh
Hi Stefan,
here is a clear example
if i am using a codebehind like this (method) one:
private void FillChart(object sender) { if (xmDataChart != null) { ColorsHelper colors = new ColorsHelper();
foreach (Series s in xmDataChart.Series) { AnimatePropertyTo(s, 0, "Opacity", 4); }
//clear the linegrid series xmDataChart.Series.Clear();
//go through whole DataContext and add series brushNum = 0; XamDataChart dc = (XamDataChart)sender; ChartData cData = (ChartData)dc.DataContext;
int interval = getInterval(cData);
foreach (ChartDataSeries ds in cData.ChartDataSeries) { StackedColumnSeries xmSeries = new StackedColumnSeries(); //xmSeries.ValueMemberPath = "Value"; #region Working Area var fragment = new StackedFragmentSeries { ValueMemberPath = "Value", Title = ds.SeriesKey };
xmSeries.Series.Add(fragment);
//xmSeries.AutoGenerateSeries = true;
#endregion
xmSeries.Title = ds.SeriesName; xmSeries.Brush = new SolidColorBrush(colors.Series1[brushNum]); ; xmSeries.Style = App.Current.Resources.MergedDictionaries[0]["StackedColumnSeriesStyle"] as Style; ToolTip newtooltip = new ToolTip(); newtooltip.Style = App.Current.Resources.MergedDictionaries[0]["ToolTipStyle"] as Style; xmSeries.ToolTip = newtooltip; xmSeries.XAxis = (CategoryXAxis)xmDataChart.Axes[0]; xmSeries.YAxis = (NumericYAxis)xmDataChart.Axes[1]; xmSeries.YAxis.Interval = interval; xmSeries.ItemsSource = ds.ChartDataPoints; xmSeries.Legend = TitleLegend; xmDataChart.Series.Add(xmSeries);
AnimatePropertyTo(xmSeries, fullOpacityVal, "Opacity", 3);
brushNum++; } } }
then how do i get my ' group by' to work ?
Hi stephan,
thanks for the sample project it worked brilliantly...and sorry i have to ask the same question as amir, but how do you set the Groupby in codebehind ? because i can see you are using a static resource to call the object instance in xaml of the constructor of the Seriesdata class...which then adds all the datapoints observable collection.
but i have an object in code behind and also will like the option of using it in my view Model later on how would i do this ?
Thanks
thank you so much i figured the rest out...all i needed to do is to add additional datapoints for the rest of the months in the year to the Series Data and the chart automatically generated the additional stacked columns for the x-axis.
thanks so much!!!!
Basically my question is how to 'categorise' each column on the X-axis, the sample code for the link i sent you does not show this, if you can modify the sample you sent to me showing at least 2 stacked column on the x-axis and categorised or "grouped as shown according to "countries" in the linked but i suppose in the sample you sent to me it will be accorind to Dates, that would really be helpful thank you so much.
Hi thanks Stephan, it is working i dont see it 'stacked' or is it beacuse it is only one column ?
this is the look i am trying to achieve
https://ko.infragistics.com/samples/silverlight/data-chart/#/gallery-category-series
exactly like this link above.thank you