Page 1 of 1

Contour Intraction with trackbar

Posted: Wed Jul 23, 2014 12:58 pm
by 9526439
Hi Steema Support,
We want to create contour and its interaction with the track bar with the chart(contour) when we scroll it.
imgs1.jpg
Fig 1 image
imgs1.jpg (40.04 KiB) Viewed 5500 times
As shown in fig-1, when we scroll the track bar then contour properties changes as shown in fig-2 below
img2.jpg
Fig.2 image
img2.jpg (111.06 KiB) Viewed 5497 times
It will so helpful for us if you please provide any alternative solution.

Thanks in advance.

Thanks and Regards
Planoresearch

Re: Contour Intraction with trackbar

Posted: Thu Jul 24, 2014 1:10 pm
by Christopher
amol wrote: It will so helpful for us if you please provide any alternative solution.
I'm afraid I'm not entirely sure how I can help you here. Windows Forms has a TrackBar Class which you can use for the TrackBar. The question is: which property of the Contour series do you want to change when the trackbar is changed? I'm afraid I cannot make that decision for you.

It seems to me that the trackbar could represent "levels" of a dataset, the dataset being a 3-dimensional surface, say, and the contour being a 2-dimensional representation of it at different levels. A very simple example of what I mean could look like this:

Code: Select all

    Contour contour;
    List<List<double>> yValues;
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      contour = new Contour(tChart1.Chart);
      Random rnd = new Random();
      yValues = new List<List<double>>();

      for (int i = 0; i < 10; i++)
      {
        yValues.Add(new List<double>());

        for (int j = 0; j < 100; j++)
        {
          yValues[i].Add(rnd.NextDouble());
        }
      }

      AddValues(0);

      trackBar1.Minimum = 0;
      trackBar1.Maximum = 9;
      trackBar1.LargeChange = 1;
      trackBar1.ValueChanged += trackBar1_ValueChanged;
    }

    private void AddValues(int index)
    {
      for (int x = 0; x < 10; x++)
      {
        for (int z = 0; z < 10; z++)
        {
          contour.Add(x, yValues[index][x * z], z);
        }
      }
    }

    void trackBar1_ValueChanged(object sender, EventArgs e)
    {
      contour.Clear();
      AddValues(trackBar1.Value);
    }