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,Could anyone please help me with the above issues. It is holding me back.Much appreciated.
Amir
Hello Amir,
Thank you for your post. I have been looking into it and the sample you have provided and I modified it, so now it works as you want. Basically I set the StackedColumnSeries’ AutoGenerateSeries Property to True and changed the structure of the DataSource you use. I also put comments in the XAML for your reference. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Hi Stephan, also can the sample you put up be in silverlight ? the TilesTest.zip you have is actually in WPF i thought it would be in silverlight as this is a silverlight forum? thanks
Hello,
Thank you for your post. Since the Amir’s sample was on WPF, I modified it and uploaded it, because the XamDataChart is a cross-platform control and any code in WPF will compile in Silverlight, too. I also attached a sample (“TilesTest2.zip”), which has the same functionality as the other one, but it is built on Silverlight.
Hope this helps you.
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
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 ?
I have modified the sample I sent you before, so now the GroupBy is created in code behind instead of in XAML.
I will answer to your other post as soon as possible
Thanks Stefan that is great i understand!
But i have a situation where i want to use a DataTemplate for this Label as well as set the Value how will i do both ?
please see my post on this here:
https://ko.infragistics.com/community/forums/f/retired-products-and-controls/70221/setting-the-value-and-datatemplate-label-attribute-of-the-categoryxaxis-element
The Label Property of the CategoryXAxis is for formatting the Axis' Labels, like the Format Property of an Editor for example. The "{}" are for escaping, when you set this Property in XAML. If you want to set it in code behind you should set it to "{Key}" only. Also if there is a Property from the underlying object that is set as ItemsSource, its will be mapped to it (like Binding) and the corsonding Values will be showed.
Hi Stefan
what does the value { } { Key } mean in
<CategoryXAxis name=xmaxis Label="{ } {Key}" />
i have never seen this expression .Other than it setting the x-axis in a CategoryXAxis element
can you explain ?