Page 1 of 1

Levels in contour plots

Posted: Wed Jan 14, 2009 11:07 am
by 9531247
Hello,

I'm a little confused: in th following code segment (C++)

Serie1.FillSampleValues(20);
Serie1.GetAsContour().SetAutomaticLevels(true);
Serie1.GetAsContour().SetNumLevels(15);
long lNumLevels=Serie1.GetAsContour().GetNumLevels();
//
Serie1.GetAsContour().SetAutomaticLevels(false);
Serie1.GetAsContour().SetNumLevels(15);
lNumLevels=Serie1.GetAsContour().GetNumLevels();

"serie1" is a contour serie. I try to get the Number of contour levels. In the first case (SetAutomaticLevels(true) ) the function GetNumLevels() returns the correct value 15.
In the second case (SetAutomaticLevels(false)) the function GetNumLevels() returns 0.

What happens here, what I'm doing wrong?

Raimund

Posted: Wed Jan 14, 2009 12:18 pm
by narcis
Hi Raimund,

I'm afraid this is a bug. I've added it (TV52013723) to the defect list to be investigated for next releases.

Posted: Tue Mar 17, 2009 3:14 pm
by narcis
Hi Raimund,

I've been investigating the issue now and found that if you set AutomaticLevels to false you need to create the levels before retrieving its value, for example:

Code: Select all

Private Sub Form_Load()
    TChart1.Aspect.View3D = False
    
    TChart1.AddSeries scContour
    TChart1.Series(0).FillSampleValues 10
    
    TChart1.Series(0).asContour.AutomaticLevels = False
    TChart1.Series(0).asContour.Levels.AddLevel -1, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel -0.8, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel -0.6, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel -0.4, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel -0.2, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel 0, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel 0.2, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel 0.4, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel 0.5, clTeeColor
    TChart1.Series(0).asContour.Levels.AddLevel 0.8, clTeeColor

    TChart1.Header.Text.Clear
    TChart1.Header.Text.Add CStr(TChart1.Series(0).asContour.NumLevels)
End Sub
So I don't consider this being a bug and therefore closed the issue in the defect list.