Hello,
I've been trying to solve the riddle of setting my chart's LegendLabel items. What I have is a query that provides a result set from a database. Two of the items are mapped (see code below) and I'm trying to figure out how to get the LegendLabel to display the appropriate info.
Here is my code segment:
radChart.DefaultView.ChartLegend.Header = "Series";
radChart.DefaultView.ChartArea.DataSeries.Clear();
radChart.SeriesMappings.Clear();
radChart.ItemsSource = this.getChartData();
radChart.DefaultView.ChartTitle.Content = _chartTitle;
//radChart.DefaultSeriesDefinition.LegendDisplayMode = LegendDisplayMode.DataPointLabel;
//radChart.DefaultView.ChartLegend.Items.Add(new ItemMapping("Series"));
radChart.DefaultView.ChartLegend.UseAutoGeneratedItems = false;
SeriesMapping seriesMapping = new SeriesMapping();
//seriesMapping.LegendLabel = "Series";
seriesMapping.SeriesDefinition = new BarSeriesDefinition();
//seriesMapping.ItemMappings.Add(new ItemMapping("Series", DataPointMember.LegendLabel));
seriesMapping.ItemMappings.Add(new ItemMapping("Scenario_name", DataPointMember.XCategory));
seriesMapping.ItemMappings.Add(new ItemMapping("Overall_RC0_Pct", DataPointMember.YValue));
radChart.SeriesMappings.Add(seriesMapping);
I scoured numerous simliar posts to my query but haven't been successful yet. I was a bit confused as to what property I needed but as you can see I've set my Legend Header to the word "Series"
I want the items below to display the actual content of the underlying result set that comes from a column named "Series". So what the only time I see anything generated is when I set the "UseAutoGeneratedItems" to true and all I see is 'Series 0'
I tried mapping to the LegendLabel but I am not sure if that is correct or if I need to map to the ChartLegend.Items? If that is how I need to go what is the actual syntax to do that.
Thanks again for your help!
Tony
I've been trying to solve the riddle of setting my chart's LegendLabel items. What I have is a query that provides a result set from a database. Two of the items are mapped (see code below) and I'm trying to figure out how to get the LegendLabel to display the appropriate info.
Here is my code segment:
radChart.DefaultView.ChartLegend.Header = "Series";
radChart.DefaultView.ChartArea.DataSeries.Clear();
radChart.SeriesMappings.Clear();
radChart.ItemsSource = this.getChartData();
radChart.DefaultView.ChartTitle.Content = _chartTitle;
//radChart.DefaultSeriesDefinition.LegendDisplayMode = LegendDisplayMode.DataPointLabel;
//radChart.DefaultView.ChartLegend.Items.Add(new ItemMapping("Series"));
radChart.DefaultView.ChartLegend.UseAutoGeneratedItems = false;
SeriesMapping seriesMapping = new SeriesMapping();
//seriesMapping.LegendLabel = "Series";
seriesMapping.SeriesDefinition = new BarSeriesDefinition();
//seriesMapping.ItemMappings.Add(new ItemMapping("Series", DataPointMember.LegendLabel));
seriesMapping.ItemMappings.Add(new ItemMapping("Scenario_name", DataPointMember.XCategory));
seriesMapping.ItemMappings.Add(new ItemMapping("Overall_RC0_Pct", DataPointMember.YValue));
radChart.SeriesMappings.Add(seriesMapping);
I scoured numerous simliar posts to my query but haven't been successful yet. I was a bit confused as to what property I needed but as you can see I've set my Legend Header to the word "Series"
I want the items below to display the actual content of the underlying result set that comes from a column named "Series". So what the only time I see anything generated is when I set the "UseAutoGeneratedItems" to true and all I see is 'Series 0'
I tried mapping to the LegendLabel but I am not sure if that is correct or if I need to map to the ChartLegend.Items? If that is how I need to go what is the actual syntax to do that.
Thanks again for your help!
Tony