Question on Contour series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Question on Contour series

Post by Frances » Thu Apr 21, 2011 3:00 pm

Hello,

I would like to use a contour serie in my software, using the filled levels property, but I'm not sure it's possible.
Is it possible to use this serie with uneven data ? What I mean is my Xdata does not increase one by one for example :

m_ContourData.IrregularGrid = true;
m_ContourData.FillLevels = true;
Random rand = new Random();
rand.Next();
for(int i=0;i<36;i++)
{
for(int j = 0; j<32; j++)
{
UpdateData(i, j, rand.Next(-80, -70));
}
}

m_ContourData.YValues.RemoveAt(0);
m_ContourData.NumLevels = 7;

works fine

m_ContourData.IrregularGrid = true;
m_ContourData.FillLevels = true;
Random rand = new Random();
rand.Next();
for(int i=0;i<36;i+=2)
{
for(int j = 0; j<32; j+=2)
{
UpdateData(i, j, rand.Next(-80, -70));
}
}

m_ContourData.YValues.RemoveAt(0);
m_ContourData.NumLevels = 7;

displays the contour, but does not fill the levels :(. (the difference is about the i and j incrementation).
In reality I will have a 360 X axis, a 110 Z axis and will add some values, with an increment of 10 for the X axis and 5 for the Y axis for example.
Is it possible to fill those levels for this kind of data, and if yes how ?

Kind Regards

Anton
Newbie
Newbie
Posts: 5
Joined: Mon Apr 11, 2011 12:00 am

Re: Question on Contour series

Post by Anton » Fri Apr 22, 2011 9:24 am

Ahh!

I am also very interested in the answer to your question.

However, awaiting the 'correct solution', you might be able to workaround your problem by plotting the data with "one" increment and then use custom labels to put on correct labels.

Code: Select all

TChart2.Axes.Left.Labels.Items.Clear()
TChart2.Axes.Left.CalcMinMax(min, max)
imin = Math.Truncate(min)
imax = Math.Ceiling(max)
For i  = imin To imax
      TChart2.Axes.Left.Labels.Items.Add(i, <your custom transformation fx(i) here>)'e.g.  Format(i*2.0, "f2")
Next

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Question on Contour series

Post by Sandra » Tue Apr 26, 2011 10:43 am

Hello Frances and Aton,

About this question:
I would like to use a contour serie in my software, using the filled levels property, but I'm not sure it's possible.
Is it possible to use this serie with uneven data ?
You could use X, Y and Z values to populate a contour series as described here. If this doesn't help please give us more detailed information about what you are trying to do.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Re: Question on Contour series

Post by Frances » Tue Apr 26, 2011 11:15 am

Hello Sandra,

No it doesn't help, the link you gave me describe the code I posted above. I'll try to be more clear about what I want. I'm trying to use the contour serie to display data added every let's say, 10 X axis units, 7 Y axis units below 90, and 5 Y axis unit above 90.
X axis maximum is 360, Y axis maximum is 120.
Just adding the data like that does display the contour but NOT the colored levels. Why ?

After struggling with that I decided to try a couple of more things :

- Adding the same data a certain number of times to have every point added (so for example when adding a new point on the X axis, adding it 10 times to fill the "gap" before the next point). This works, but unfortunately makes the chart pretty slow when doing anything afterwards, too slow for my requirements (is there a downsampling method maybe ?).

-As Aton suggested adding data every "1" and use custom labels. This is the closer I could get to what I want, but it doesn't work 100% because after 90 on the Y axis the incrementation changes, and the ratio between the two incrementations isn't necessary an integer, which prevents me from scaling my data properly (if using a double for the Y index I will end up with color for data added on integer indexes, and no color on datat added on double indexes).

Any help would be appreciated


edit : after reading some other posts I realized the problem might come from the fact that my incrementation does not respect the "Data has to describe a grid of (X, Z) values that have the same spaces between them". What does that exactly means ? But still, this :

m_ContourData.IrregularGrid = true;
m_ContourData.FillLevels = true;
Random rand = new Random();
rand.Next();
for(int i=0;i<36;i+=2)
{
for(int j = 0; j<32; j+=2)
{
UpdateData(i, j, rand.Next(-80, -70));

should be working ? (right now it displays the contour, but not the filled levels)

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Question on Contour series

Post by Sandra » Tue Apr 26, 2011 2:09 pm

Hello Frances,
No it doesn't help, the link you gave me describe the code I posted above. I'll try to be more clear about what I want. I'm trying to use the contour serie to display data added every let's say, 10 X axis units, 7 Y axis units below 90, and 5 Y axis unit above 90.
X axis maximum is 360, Y axis maximum is 120.
Just adding the data like that does display the contour but NOT the colored levels. Why ?
Could you check if next code can reproduce same problem do you have? If it doesn't reproduce your problem please modify the code, so we can see your problem exactly.

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart1.Dock = DockStyle.Fill;

            Steema.TeeChart.Styles.Contour m_ContourData = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
            m_ContourData.IrregularGrid = true;
            m_ContourData.FillLevels = true;

            Random rand = new Random();
            rand.Next();

            for (int i = 0; i < 36; i += 2)
            {
                for (int j = 0; j < 32; j += 2)
                {
                    m_ContourData.Add(i, rand.Next(-80, -70), j);
                }
            }
        }
edit : after reading some other posts I realized the problem might come from the fact that my incrementation does not respect the "Data has to describe a grid of (X, Z) values that have the same spaces between them". What does that exactly means ? But still, this :
I think you can try to fixing the property TChart1.Axes.Left.Increment. Please, check if it solve your problem. If it doesn't help you, please try to arrange a simple code we can run "is-as" here because we can try to solve your problem.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply