This question is locked. New answers and comments are not allowed.
Hello,
i am experimenting a little bit with the ItemWidthPercent property of the ChartArea. I would like to define a histogram chart where all bars are next to each other. The labels should be between each bar and not under them. So i setup the following things to generate a simple histogram:
Result picture: screen1.png
You can see, the bar width is not 100 percent. If i change the LayoutMode of the AxisX from Normal to Between, the correct result (corresponding to the bar width) is shown in screen2.png
But also with this setting i can get an incorrect result if i use a different Step value of the AxisX. Normally this is 1, but in my case i must set this depending on my data. So it could be anything greater than 0. Changing the step value to 1.5 (this is the class width of a histogram) and use histogram data for classes which have a width of 1.5 results in the following changed code:
and chart visualization: screen3.png
I think there is an issue with the internal calculation of the bar with (this also includes wrong width if user zooms into the chart). But maybe you have any workaround or solution for me :)
Currently i use the RadChart from the Silverlight 2011 Q1 release with the version 2011.1.315.1040.
Thanks for your help!
i am experimenting a little bit with the ItemWidthPercent property of the ChartArea. I would like to define a histogram chart where all bars are next to each other. The labels should be between each bar and not under them. So i setup the following things to generate a simple histogram:
this.chartControl.DefaultView.ChartLegend.Visibility = Visibility.Collapsed;ChartArea chartArea = this.chartControl.DefaultView.ChartArea;chartArea.ItemWidthPercent = 100;chartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;chartArea.ZoomScrollSettingsY.ScrollMode = ScrollMode.ScrollAndZoom;chartArea.AxisX.LabelRotationAngle = -45;chartArea.AxisX.MinorTickPointMultiplier = 1;chartArea.AxisX.LayoutMode = AxisLayoutMode.Normal;chartArea.AxisX.AutoRange = false;chartArea.AxisX.Step = 1;chartArea.AxisX.MinValue = 1;chartArea.AxisX.MaxValue = 6;DataSeries lineSeries = new DataSeries();lineSeries.Definition = new BarSeriesDefinition();lineSeries.Add(new DataPoint() { XValue = 1.5, YValue = 1 });lineSeries.Add(new DataPoint() { XValue = 2.5, YValue = 2 });lineSeries.Add(new DataPoint() { XValue = 3.5, YValue = 3 });lineSeries.Add(new DataPoint() { XValue = 4.5, YValue = 4 });lineSeries.Add(new DataPoint() { XValue = 5.5, YValue = 3 });chartControl.DefaultView.ChartArea.DataSeries.Add(lineSeries);Result picture: screen1.png
You can see, the bar width is not 100 percent. If i change the LayoutMode of the AxisX from Normal to Between, the correct result (corresponding to the bar width) is shown in screen2.png
But also with this setting i can get an incorrect result if i use a different Step value of the AxisX. Normally this is 1, but in my case i must set this depending on my data. So it could be anything greater than 0. Changing the step value to 1.5 (this is the class width of a histogram) and use histogram data for classes which have a width of 1.5 results in the following changed code:
chartArea.AxisX.LayoutMode = AxisLayoutMode.Beetween;
chartArea.AxisX.Step = 1.5;chartArea.AxisX.MinValue = 0;chartArea.AxisX.MaxValue = 7.5;lineSeries.Add(new DataPoint() { XValue = 0.75, YValue = 1 });lineSeries.Add(new DataPoint() { XValue = 2.25, YValue = 2 });lineSeries.Add(new DataPoint() { XValue = 3.75, YValue = 3 });lineSeries.Add(new DataPoint() { XValue = 5.25, YValue = 4 });lineSeries.Add(new DataPoint() { XValue = 6.75, YValue = 3 });I think there is an issue with the internal calculation of the bar with (this also includes wrong width if user zooms into the chart). But maybe you have any workaround or solution for me :)
Currently i use the RadChart from the Silverlight 2011 Q1 release with the version 2011.1.315.1040.
Thanks for your help!