fixing color range min and max

TeeChart for ActiveX, COM and ASP
Post Reply
Andras
Newbie
Newbie
Posts: 40
Joined: Thu Oct 14, 2004 4:00 am
Location: Hungary

fixing color range min and max

Post by Andras » Mon Nov 22, 2004 2:48 pm

Dear Support

I'm using a colored countour and a coloured grid series to represent some animated data in 2D. I use a color range legend to indicate the values of the colors. Unfortunately I cannot fix the minimum and the maxixmum value of the color range. So displaying a distribution the min and max values of the color legend automatically adjust themselvs to the current slide, i.e. the min and the max values change, as I display different slides. This in ot ok, since in this way I cannot compare to slides to show the user what's going on. My question: is there a way to fix the min and max values of the color range legend? I can change set the steps between min and max, but cannot set min and max itself.

Tx in advance, best regards

Andras

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Nov 25, 2004 12:29 pm

Hi Andras,

you should be able to set a specific color for the Min and Max values using :
TChart1.Series(0).asContour.StartColor = vbRed
TChart1.Series(0).asContour.EndColor = vbYellow

Andras
Newbie
Newbie
Posts: 40
Joined: Thu Oct 14, 2004 4:00 am
Location: Hungary

Post by Andras » Thu Nov 25, 2004 9:48 pm

This is clear Pep, but how can I assign a fixed number to the selected color? E.g. red should be always 100, blue should be always 0.

regards

Andras

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Nov 26, 2004 8:30 am

Hi Andras,

in that case you can use the AddPallete :

From the TeeChart Pro Help file under the Index 'AddPalette':

*****************************************************
ICustom3DPaletteSeries.AddPalette
ICustom3DPaletteSeries

Function AddPalette(Value: Double; Color: OLE_COLOR): Integer;

Type Library
TeeChartX

Description
This method adds a new color Palette entry to the end of Palette list. Add
returns the position of the entry in the Palette list. The Color parameter
will be used to fill polygons with Y values up to the Value parameter.
Custom color palettes can be created using this method. The UsePalette
property should be True to use the palette entries.

Example [Visual Basic]:
This code creates a customized color palette. Polygons with Y values lower
than or equal to 3000 will be filled in Green color, Polygons with Y values
lower than or equal to 2000 will be filled in Yellow color and Polygons with
Y values lower than or equal to 1000 will be filled in Red color.

With TChart1
.Series(0).asSurface.ClearPalette
.Series(0).asSurface.AddPalette 1000, vbRed
.Series(0).asSurface.AddPalette 2000, vbYellow
.Series(0).asSurface.AddPalette 3000, vbGreen

.Repaint
End With
**********************************************************

Andras
Newbie
Newbie
Posts: 40
Joined: Thu Oct 14, 2004 4:00 am
Location: Hungary

Post by Andras » Sun Dec 12, 2004 9:16 pm

Dear Pep

I have tested the .AddPalette method, for both a contour and a colorgrid series, but it seems to me at the moment, that it works only for the color grid series. Is it normal, or did I make a mistake? I would need it for both.

Tx in advance, best regards

Andras

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Dec 13, 2004 7:46 am

Hi Andras,

yes, using similar code to the following should work fine :

Code: Select all

Private Sub Command1_Click()
With TChart1
.Series(0).asContour.UseColorRange = False
.Series(0).asContour.UsePalette = True
.Series(0).asContour.ClearPalette
.Series(0).asContour.AddPalette 0, vbRed
.Series(0).asContour.AddPalette 100, vbYellow
.Series(0).asContour.AddPalette 200, vbGreen
.Repaint
End With
End Sub

Post Reply