0
votes

I have an MSCHart control in my windows Form, coding in C#. I have an array of Data to populate the chart. I was needing to do the following with these:

  1. Make the chart show in 10 second frames, basically my data would total up to around 15 minutes or more, but I want my chart to show the X axis on a 10 second scale.

  2. I needed to implement a scroll bar on the bottom of my chart, so that I could click this to show me the next 10 second frame. this would start off showing the first 10 second frame, then the next ones, like (10 - 20, 20 - 30, etc)

  3. In each 10 second frame I need to plot 170 data items from my array. then the next 10 second frame to show the next 170 data items, and this would continue to the end.

here is a snipplet of what I done so far

#region SetupChart()
    public bool SetupChart()
    {
        try
        {
            this.view.chart.ChartAreas[0].AxisX.ScaleView.Size = 10;
            return true;
        }
        catch { return false; }

    }
    #endregion

    #region Draw()
    public bool Draw()
    {
        try
        {
            view.Data = this.dllCall.GetData(1);

            int startSecond = 0;
            foreach (Int16 item in view.Data)
            {

                //this.view.chart.Series["MySeries"].Points.AddXY(startSecond, item);

                    this.view.chart.Series["MySeries"].Points.Add(item);
        startSecond++;

            }
            return true;
        }
        catch (Exception ex)
        {
            this.ErrorMessage = ex.Message;
            return false;
        }
    }
1

1 Answers

0
votes

It's some time ago, since i worked with this chart. But the chart is capable of zooming and padding. So i would put the whole data into the chart and then zoom to a ten second frame and at last pad to the position i need.

The zooming normally provides you with scrollbars automaticallly. So no need to do anything on yourself for this functionality.