Draw contour lines in surface grid series 3D chart

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
Felix
Posts: 72
Joined: Tue Oct 29, 2013 8:10 am

Draw contour lines in surface grid series 3D chart

Post by Felix » Tue Oct 29, 2013 8:35 am

Hello,

I created a Grid Series 3D Surface diagram and would like draw contour lines. The lines should be drawn to a particular Y value.
I also want to determine the color and the width of the lines themselves.

How can I realize this?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Draw contour lines in surface grid series 3D chart

Post by ArctionPasi » Wed Oct 30, 2013 12:38 pm

Use ContourPalette of surface series. Each step in the palette represents a pair of color and Y value.

Code: Select all

            ValueRangePalette vrp = new ValueRangePalette(gridSeries); 
            vrp.Steps.Clear();
            vrp.MinValue = 0; 
            vrp.Steps.Add(new PaletteStep(vrp, Color.Reds, 0));
            vrp.Steps.Add(new PaletteStep(vrp, Colors.Yellow, 30));
            vrp.Steps.Add(new PaletteStep(vrp, Colors.Lime, 60));
            vrp.Steps.Add(new PaletteStep(vrp, Colors.White, 100));
            gridSeries.ContourPalette = vrp;

            //Hide the wireframe so it doesn't disturb here
            gridSeries.WireframeType = SurfaceWireframeType.None; 

            gridSeries.ContourLineType = ContourLineType.ColorLine;
            gridSeries.ContourLineColor = Colors.Black; 
            gridSeries.Fill = SurfaceFillStyle.Paletted; 

Then it uses a palette fill, and black contour line in the Y position of each palette step.
Palette fill, black contour lines
Palette fill, black contour lines
PaletteFillBlackContourLines.jpg (87.94 KiB) Viewed 16491 times
If you want to show palette-colored contour lines instead, use a single tone color fill, and select ContourLineType = PalettedLine:

Code: Select all

gridSeries.ContourLineType = ContourLineType.PalettedLine;
            gridSeries.Fill = SurfaceFillStyle.Toned;
            gridSeries.ContourLineWidth = 3f;
            gridSeries.ToneColor = Colors.White; 
White fill, palette-colored contour lines
White fill, palette-colored contour lines
WhiteFillPaletteContourLines.jpg (99.18 KiB) Viewed 16491 times

Different contouring and fill styles can be seen quickly at http://www.arction.com/download/lightni ... manual.pdf, page 129 onwards.
LightningChart Support Team, PT

Felix
Posts: 72
Joined: Tue Oct 29, 2013 8:10 am

Re: Draw contour lines in surface grid series 3D chart

Post by Felix » Wed Nov 06, 2013 9:17 am

Unfortunately I have the problem that I want to show very different contour values​​, as I have stated in the "Value Range range," also will get a different color each contour line.

Compilation of the "Value Range range":

Code: Select all

double averageValue = (rangeMaxValue - rangeMinValue) / 2.0 + rangeMinValue;
double stepValue = (rangeMaxValue - rangeMinValue) / 6.0;

palette.Steps.Clear();
palette.MinValue = rangeMinValue;
palette.Type = PaletteType.Gradient;
palette.Steps.Add(new PaletteStep(palette, Color.Transparent, -1));
palette.Steps.Add(new PaletteStep(palette, Color.Black, 0));
palette.Steps.Add(new PaletteStep(palette, Color.Blue, stepValue));
palette.Steps.Add(new PaletteStep(palette, Color.Teal, stepValue * 2));
palette.Steps.Add(new PaletteStep(palette, Color.LimeGreen, averageValue));
palette.Steps.Add(new PaletteStep(palette, Color.Yellow, stepValue * 4));
palette.Steps.Add(new PaletteStep(palette, Color.Red, stepValue * 5));
palette.Steps.Add(new PaletteStep(palette, Color.White, rangeMaxValue));
These steps are needed for a beautiful display, but will not be displayed as contour lines.

As contour lines are 3 values ​​are shown, A Min-an average and a maximum value.

How can I implement this?

I have her example, Try to my 3D chart, but I get the following display:
PS: The display of the 3D chart looks at redrawing of exactly like the picture, even without contour lines.
3D Chart draw contour lines
3D Chart draw contour lines
Chart3DBugRepaint.jpg (130.75 KiB) Viewed 16462 times
Without contour lines, it looks like this:
3D Chart without contur lines
3D Chart without contur lines
Chart3D.jpg (140.6 KiB) Viewed 16462 times
Why?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Draw contour lines in surface grid series 3D chart

Post by ArctionPasi » Wed Nov 06, 2013 10:28 am

Because I don't have all your code, I can't say what's the problem related to black-white picture.

So you are trying to render the surface with a gradient palette, consisting of 9 steps? And then use 3 contour lines in that? LightningChart can render contour lines only in the step positions, so that would mean 9 contour lines.

To achieve gradient fill of 9 steps, and 3 contour line levels, use two surfaces (with same data).

Surface 1:
Fill = Paletted
ContourLineType = None
ContourPalette: your 9 steps here

Surface 2:
Fill = None
ContourLineType = PalettedLines
ContourPalette: 3 contour levels

That way you should get the result you are looking for.
LightningChart Support Team, PT

Felix
Posts: 72
Joined: Tue Oct 29, 2013 8:10 am

Re: Draw contour lines in surface grid series 3D chart

Post by Felix » Tue Nov 12, 2013 8:37 am

I solved the problem, had passed the wrong object in the allocation of "ValueRangeRange". :idea:

Thanks for the help. :D

Post Reply