Hi, I posted it by mistake in the XamPivotGrid forum... I am posting it again here.
I am trying to set a StackedColumnSeries on a xamDataChart with OlapXAxis.The only examples i found were in Silverlight like :http://forums.infragistics.com/forums/p/62282/315479.aspxandhttp://blogs.infragistics.com/forums/t/66579.aspxMy problem is when trying to set the ValueMemberPath of the StackedFragmentedSeries like in the examples above : ValueMemberPath = e.SeriesInfo.Title, I get a blank value.When I try to set the value like ValueMemberPath = ((AnchoredCategorySeries)e.Series).ValueMemberPath, I get the correct value for the first fragment in the Stacked series, and the rest of the fragments are duplicated with the same value.I am using WPF4 v12.1Any help will be appriciatedthanks
Hi,
I've attached a complete sample. Bellow you can find the interesting bits explained.
You need to catch the SeriesInitializing event of the OlapAxis and create your StackedColumnSeries there. You need just one series created, as the stacked series group together several values with its StackedFragmentSeries fragments.
Then every time the SeriesCreating event is fired you need to pass the StackedColumnSeries object you have earlier created as the series you want used instead. This is done by setting the Series property of the event arguments.
Then you need to merge the individual item sources into a single one used by the stacked series. For this I have created a class called StackSeriesData which has properties for each measure(the different values the chart is presenting).
Here is how the code looks.
//a private member to store the stacked series
StackedColumnSeries series;
private void olapXAxis_SeriesInitializing(object sender,
SeriesInitializingEventArgs e)
{
//create the stacked series when the series initialization begin
series = new StackedColumnSeries();
}
private void olapXAxis_SeriesCreating(object sender,
SeriesCreatingEventArgs e)
//replace the generated series with our custom series
//use the same every time
e.Series = series;
//initialize the stacked series ItemSource with a list of StackSeriesData items
//the list has the length of the first ItemSource that we are given
if (series.ItemsSource == null)
series.ItemsSource =
Enumerable
.Range(0, e.SeriesInfo.ItemsSource.Count)
.Select(i => new StackSeriesData())
.ToList();
//merge the current ItemSource into the stacked series ItemSource
List<StackSeriesData> seriesItemsSource = (List<StackSeriesData>)series.ItemsSource;
for (int i = 0; i < seriesItemsSource.Count; i++)
//set the appropriate property
switch (e.SeriesInfo.Title)
case "SoldNewUnits":
seriesItemsSource[i].SoldNewUnits = (int)e.SeriesInfo.ItemsSource[i].Cell.Value;
break;
case "SoldUsedUnits":
seriesItemsSource[i].SoldUsedUnits = (int)e.SeriesInfo.ItemsSource[i].Cell.Value;
case "SoldTotalUnits":
seriesItemsSource[i].SoldTotalUnits = (int)e.SeriesInfo.ItemsSource[i].Cell.Value;
default:
//create a new fragment
series.Series.Add(
new StackedFragmentSeries
Title = e.SeriesInfo.Title,
ValueMemberPath = e.SeriesInfo.Title
});
If you have any questions please let us know.
Thanks,
hi Angel,
The August SR has been released. Couldn't find any documentation on the subject. I hope that you can help me to find the right direction to solve this issue.Thanks
Thanks again Angel,
I will wait for the August SR.
Hi amos_silberman,
I'm sorry to inform you that the changes allowing the implementation of StackedColumnSeries have not been included in the July SR, they will be available in the August SR.
I'll post an example when the SR is released. A blog post will also be available then.
Angel
thanks Angel,
I have just installed the latest SR build 20121.2059