开发者

MSChart Scroll Bar issue :S

开发者 https://www.devze.com 2023-02-16 19:05 出处:网络
im using a scroll bar to view my data in 10 sec frames, when I scroll forward through the data for the FIRST time, the x-axis is messed up.

im using a scroll bar to view my data in 10 sec frames, when I scroll forward through the data for the FIRST time, the x-axis is messed up.

goes from 0 -10 to 9.994 to 19.994,

yet if I click to scroll back to beginning then forward again

it goes from 0 - 10 to 10 - 20 and will continue to work properly after that,

any idea why this o happens on first click? I really cant figure it out:( any advice would be greatly a开发者_StackOverflowppreciated and thank you in advance

here is the code

    #region SetupChart()
    public bool SetupChart(List<Int16> data)
    {
        try
        {
            this.view.chart.ChartAreas[0].AxisX.Minimum = 0;//start X-Axis off from 0 seconds

            var chartArea = this.view.chart.ChartAreas[0];
            chartArea.CursorX.AutoScroll = true;
            chartArea.AxisX.ScaleView.Zoomable = true;

            int winOffset = 0;
            int winLength = 10;


            foreach(Int16 element in data)
            {
                this.view.chart.Series["series"].Points.AddXY((double)i/100, (double)element/41);
            }

            chartArea.AxisX.ScaleView.Zoom(winOffset, winLength);//zoom to 10 sec frame
            chartArea.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;//disable zoom reset button
            chartArea.AxisX.ScaleView.SmallScrollSize = winLength; //should show in frames of 10 secs (winLength)
            return true;
        }
        catch (Exception ex)
        {
            this.ErrorMessage = ex.Message;
            return false;
        }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消