in

Software FX Community

Discuss and find help for all Software FX products.

Zoom stripe not working correctly everytime in Bar charts

Last post 01-13-2010 10:47 AM by Coder. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 01-13-2010 10:47 AM

    • Coder
    • Top 200 Contributor
    • Joined on 12-30-2008

    Zoom stripe not working correctly everytime in Bar charts

    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);

    Filed under: , ,
Page 1 of 1 (1 items)
Copyright 2008 Software FX, Inc.