Coder Posted January 19, 2009 Report Share Posted January 19, 2009 When creating a multi-pane chart where one pane has an X-Values axis line chart and another pane has a categorical X-Axis bar chart, the bar chart is mislabeled. For example... int[] dataBar = { 100, 200, 300, 400 };string[] labelBar = { "100", "200", "300", "400" };DataPoint[] dataLine = { new DataPoint(new DateTime(2000, 1, 1), 400), new DataPoint(new DateTime(2001, 1, 1), 100), new DataPoint(new DateTime(2002, 1, 1), 300), new DataPoint(new DateTime(2003, 1, 1), 200) };Chart chart = new Chart();Pane pane1 = new Pane();Axis axisX1 = new Axis();Axis axisY1 = new Axis();foreach (string label in labelBar){ axisX1.Labels.Items.Add(label);}axisX1.Labels.HorizontalAlignment = HorizontalAlignment.Right;axisX1.Labels.Position = AxisLabelPosition.Center;axisY1.Min = 0;axisY1.Max = 500;pane1.AxesX.Add(axisX1);pane1.AxesY.Add(axisY1);SeriesAttributes sa1 = new SeriesAttributes();sa1.Gallery = Gallery.Bar;sa1.ItemsSource = dataBar;sa1.AxisX = axisX1;sa1.AxisY = axisY1;pane1.Series.Add(sa1);chart.Series.Add(sa1);chart.Panes.Add(pane1);Pane pane2 = new Pane();Axis axisX2 = new Axis();Axis axisY2 = new Axis();axisX2.DataFormat.Format = AxisFormat.Date;axisX2.Labels.Format = AxisFormat.Date;axisX2.Min = dataLine[0].Date;axisX2.Max = dataLine[3].Date;axisY2.Min = 0;axisY2.Max = 500;axisY2.AxisStyle = AxisStyles.ShowEnds | AxisStyles.AutoFirstLabel;pane2.AxesX.Add(axisX2);pane2.AxesY.Add(axisY2);SeriesAttributes sa2 = new SeriesAttributes();sa2.Gallery = Gallery.Line;sa2.Marker.Visibility = Visibility.Hidden;sa2.ItemsSource = dataLine;sa2.BindingPath = "Value";sa2.BindingPathX = "Date";sa2.AxisX = axisX2;sa2.AxisY = axisY2;pane2.Series.Add(sa2);chart.Series.Add(sa2);chart.Panes.Add(pane2);If I comment out the second pane... //chart.Series.Add(sa2);//chart.Panes.Add(pane2);Or, if I add a second categorical pane, then the labels render correctly. Am I doing something wrong, or is this a bug? Quote Link to comment Share on other sites More sharing options...
JuanC Posted January 21, 2009 Report Share Posted January 21, 2009 Currently we do not support combining categorical and non-categorical X axes in the same chart. We are about to release a new beta build (Beta 3) so it was not possible to include a fix on it but we have a different branch where a fix has been implemented. Please contact our support department (wpf at softwarefx dot com) and include a link to this thread. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.