Jump to content
Software FX Community

Zoom stripe not working correctly everytime in Bar charts


Coder

Recommended Posts

I have version 8.0.3629.29517. 

I have noticed that sometimes when I zoom my bar chart the stripe scroller doesn't work.  It seems to be based soley on the number of data items in my data set.  Here is an example where 'Chart1', when zoomed with 122 data items, doesn't work.  'Chart2' is identical to 'Chart1' except 200 data items are in the series.  When 'Chart2' is zoomed, it works fine.  Double-click of the chart starts the zoom selection.

With this object defined...

private class LabelValue{   public string Label { get; set; }   public double Value { get; set; }   public LabelValue(string label, double value)   {   Label = label;   Value = value;   }}

This sets up the charts in a TabControl...

TabControl tc = new TabControl();TabItem tab1 = new TabItem();TabItem tab2 = new TabItem();Chart chart1 = new Chart();Chart chart2 = new Chart();

 

tab1.Header =

"Chart 1";tab2.Header = "Chart 2";chart1.Width = 1024.0;chart1.Height = 768.0;chart1.LegendBox.Visibility = Visibility.Collapsed;chart2.Width = 1024.0;chart2.Height = 768.0;chart2.LegendBox.Visibility = Visibility.Collapsed;Random rnd = new Random(123);List<LabelValue> list1 = new List<LabelValue>();List<LabelValue> list2 = new List<LabelValue>();for (int i = 0; i < 122; i++){   list1.Add(new LabelValue(i.ToString(), (double)rnd.Next(0, 200)));}for (int i = 0; i < 200; i++){   list2.Add(new LabelValue(i.ToString(), (double)rnd.Next(0, 200)));}Axis axisX = new Axis();Axis axisY = new Axis();axisX.AxisStyle |= AxisStyles.Categorical;axisX.Labels.HorizontalAlignment = HorizontalAlignment.Right;axisX.Labels.Position = AxisLabelPosition.Center;axisX.Labels.BindingPath = "Label";axisX.FontSize = 14;axisX.Title.Content = "Test";axisX.Title.FontSize = 14.0;axisY.Min = 0.0;axisY.Max = 200.0;axisY.AxisStyle = AxisStyles.ShowEnds | AxisStyles.AutoFirstLabel;axisY.Labels.Decimals = 1;chart1.AxesX.Clear();chart1.AxesY.Clear();chart1.AxesX.Add(axisX);chart1.AxesY.Add(axisY);SeriesAttributes sa = new SeriesAttributes();sa.Gallery = chart1.Gallery = Gallery.Bar;sa.ItemsSource = list1;sa.BindingPath = "Value";sa.Content = "Test";sa.AxisX = axisX;sa.AxisY = axisY;sa.PointLabels.HorizontalAlignment = HorizontalAlignment.Center;sa.PointLabels.VerticalAlignment = VerticalAlignment.Top;sa.PointLabels.Visibility = Visibility.Visible;chart1.Series.Add(sa);chart1.MouseDoubleClick += delegate { chart1.Zoom.Mode = ZoomMode.Selection; };axisX = new Axis();axisY = new Axis();axisX.AxisStyle |= AxisStyles.Categorical;axisX.Labels.HorizontalAlignment = HorizontalAlignment.Right;axisX.Labels.Position = AxisLabelPosition.Center;axisX.Labels.BindingPath = "Label";axisX.FontSize = 14;axisX.Title.Content = "Test";axisX.Title.FontSize = 14.0;axisY.Min = 0.0;axisY.Max = 200.0;axisY.AxisStyle = AxisStyles.ShowEnds | AxisStyles.AutoFirstLabel;axisY.Labels.Decimals = 1;chart2.AxesX.Clear();chart2.AxesY.Clear();chart2.AxesX.Add(axisX);chart2.AxesY.Add(axisY);sa = new SeriesAttributes();sa.Gallery = chart2.Gallery = Gallery.Bar;sa.ItemsSource = list2;sa.BindingPath = "Value";sa.Content = "Test";sa.AxisX = axisX;sa.AxisY = axisY;sa.PointLabels.HorizontalAlignment = HorizontalAlignment.Center;sa.PointLabels.VerticalAlignment = VerticalAlignment.Top;sa.PointLabels.Visibility = Visibility.Visible;chart2.Series.Add(sa);chart2.MouseDoubleClick += delegate { chart2.Zoom.Mode = ZoomMode.Selection; };tab1.Content = chart1;tab2.Content = chart2;tc.Items.Add(tab1);tc.Items.Add(tab2);
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...