Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
925
Bar chart - Multiple X-Axis
posted

Hi,

I am trying to create a bar chart for two metrics (with the same set of categorical values) and want two axis top and bottom for the bar chart. I create the chart and add a PrimaryX, SecondaryX and PrimaryY axis.

I then add two series, both of ChartType.Bar and add to the chart. When I set the AxisY and AxisX values of the bar chart I am unable to get the bars to work as standard series values and instead the bars sit on top of each other. If I point both series at the same X axis (PrimaryX for example) this works fine, but obviously I only then have one axis displaying.

Here is the code I am using to create the series:

var barSeries1 = new Series
                                 {
                                     ChartType = ChartType.Bar,
                                     DataSource = seriesData1,
                                     DataMapping = "Value = Value1; Label = ShortLabel1",
                                     Label = seriesData1.Title + ", " + seriesData1.Measure1,
                                     AxisX = "PrimaryX",
                                     DataPointStyle = Application.Current.Resources["BarChart"as Style,
                                     Fill = brush
                                 };

var barSeries2 = new Series
                                 {
                                     ChartType = ChartType.Bar,
                                     DataSource = seriesData2,
                                     DataMapping = "Value = Value2; Label = ShortLabel2",
                                     Label = seriesData2.Title + ", " + seriesData2.Measure2,
                                     AxisX = "SecondaryX",
                                     DataPointStyle = Application.Current.Resources["BarChart"as Style,
                                     Fill = brush
                                 };

And the resulting chart:

 
Please advice if this is a known bug, or any possible workaround for the problem.

Thanx,
Chris
Parents
  • 27093
    posted

    Hello Chris,

     

    Excuse me for the late reply on this. I have been looking into your requirement, however this is the designed behavior of the XamDataChart also when using LineSeries. With LineSeries the series are again one behind the other, however there is no big surface that would show off the arrangement like with the ColumnSeries. This being said I also tried figuring out some custom approach, but to no avail. If you have something in mind that can we can implement, in coherence with the CategoryAxis’s architecture, I’d be to log in on your behalf as new Product Idea for the XamDataChart.

     

    Please let me know if I can be of any further assistance on the matter.

Reply Children