Page 1 of 1

How do you use contour custom levels

Posted: Sun Jan 01, 2006 11:26 am
by 8120845
How do you use contour custom levels? I have looked at the example in
Contour_CustLev.cs and they way that it works seems messy. First it
draws a contour plot using automatic levels. Then to use custom levels
you turn off automatic levels then manually fill in the Levels values.

Is there a way to draw a contour plot straight off with custom levels
without drawing an automatic level plot first? The problem is that if you
try to assign your custom levels before drawing the plot the Levels
ArrayList has not been allocated. I have gotton this to work by setting
AutomaticLevels then changing the levels to custome levels in the
BeforeDrawValues event. That's extremely messy and cryptic. And I'm
not sure that my levels won't get overwritten anyway.

Posted: Mon Jan 02, 2006 2:57 pm
by Chris
Hi -
First it
draws a contour plot using automatic levels. Then to use custom levels
you turn off automatic levels then manually fill in the Levels values.
This is because a number of important Contour/Custom3DPalette calculations are made internally as the chart is painted.
Is there a way to draw a contour plot straight off with custom levels without drawing an automatic level plot first?
Because of the above, the answer to this is yes and no. Yes a chart can be drawn straight off but no, it can't be done without painting the chart first.

The following code should be of help to you (the constructor in Contour_CustLev.cs):

Code: Select all

public Contour_Levels()
		{
			// This call is required by the Windows Form Designer.
			InitializeComponent();

			this.contour1.ColorEach = false;
			this.contour1.FillSampleValues(20);
			Bitmap bmp = tChart1.Bitmap; //do an "internal" repaint
			this.contour1.AutomaticLevels = false;
			AddCustomLevels();
		}

Posted: Mon Jan 02, 2006 11:18 pm
by 8120845
That bitmap code is handy to know about. Cheers