zhangzy0193 / visifire

Automatically exported from code.google.com/p/visifire
1 stars 4 forks source link

AxisLabels are not displayed properly while changing chart types at real-time #326

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Visifire Version           : <Copy from: 'about:version'>
Silverilght / WPF          :
Managed Code / JavaSctipt  :
Browser and its Version    :

AxisLabels are not displayed properly while changing chart types at 
real-time(It happened only when Zooming is enabled).

public void CreateChart()
        {
            chart = new Chart() { Height = 250, Width = 560 };
            chart.ZoomingEnabled = true;
            chart.View3D = true;

            chart.PlotArea = new PlotArea();
            chart.MouseLeftButtonUp += new MouseButtonEventHandler(chart_MouseLeftButtonUp);

            Title title = new Title();
            title.Text = "Visifire Sample Chart";
            chart.Titles.Add(title);

            DataSeries dataSeries = new DataSeries();
            dataSeries.RenderAs = RenderAs.Spline;

            DataPoint dataPoint;
            dataSeries.XValueType = ChartValueTypes.DateTime;
            dt1 = new DateTime(2007, 8, 1);

            for (int i = 0; i < 100; i++)
            {
                dataPoint = new DataPoint();
                dataPoint.XValue = dt1;
                dt1 = dt1.AddHours(1);
                dataPoint.YValue = rand.Next(0, 100);

                dataSeries.DataPoints.Add(dataPoint);
            }

            chart.Series.Add(dataSeries);

            LayoutRoot.Children.Add(chart);
        }

        void chart_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (k == 1)
            {
                chart.Series[0].RenderAs = RenderAs.Column;
            }
            else if (k == 2)
            {
                chart.Series[0].RenderAs = RenderAs.StepLine;
            }
            else if (k == 3)
            {
                chart.Series[0].RenderAs = RenderAs.Bar;
            }
            else if (k == 4)
            {
                chart.Series[0].RenderAs = RenderAs.Doughnut;
            }
            else
            {
                chart.Series[0].RenderAs = RenderAs.StackedColumn100;

                k = 0;
            }

            k++;
        }

        Chart chart;
        Int32 k = 1;
        Random rand = new Random(DateTime.Now.Millisecond);
        DateTime dt1;
   }
}

Original issue reported on code.google.com by shoaibi...@gmail.com on 14 Mar 2011 at 2:24