Filling in Contour Lines with Colors (colorfill)

TeeChart for ActiveX, COM and ASP
Post Reply
DTech
Newbie
Newbie
Posts: 15
Joined: Wed Sep 29, 2004 4:00 am
Location: Suwanee, Georgia, USA
Contact:

Filling in Contour Lines with Colors (colorfill)

Post by DTech » Thu Oct 14, 2004 4:28 pm

On my contour series, I need to see black contour lines, but, if the user clicks a checkbox, I need to colorfill the contours with different colors. I can color the contour lines themselves, but I cannot find any properties that allow me to fill in contours with a color. Any thoughts?
[/b]
Thanks, DTech

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Oct 18, 2004 8:55 am

Hi -
On my contour series, I need to see black contour lines, but, if the user clicks a checkbox, I need to colorfill the contours with different colors. I can color the contour lines themselves, but I cannot find any properties that allow me to fill in contours with a color. Any thoughts?
No, this property does not exist in the present version. I will add it as a feature request, meaning that it will be considered for inlcusion in a future release.

In the meantime, you could try doing something similar to the following:

Code: Select all

Private Sub Command1_Click()
With TChart1
    If .Series(0).SeriesType = scContour Then
        .RemoveAllSeries
        .AddSeries scSurface
        LoadData True
    ElseIf .Series(0).SeriesType = scSurface Then
        .RemoveAllSeries
        .AddSeries scContour
        LoadData False
    End If
End With
End Sub

Private Sub Form_Load()
TeeCommander1.Chart = TChart1
With TChart1
    .Legend.Visible = False
    .Axis.Depth.Visible = True
    .Axis.Depth.Otherside = False
    .Axis.Left.Visible = False
    .Aspect.Orthogonal = False
    .Aspect.Chart3DPercent = 50
    .Aspect.Rotation = 360
    .Aspect.Elevation = 270
    .Aspect.Perspective = 0
    .Walls.Bottom.Color = .Panel.Color
    .Walls.Left.Color = .Panel.Color
    
    .AddSeries scContour
    LoadData False
End With
End Sub

Private Sub LoadData(IsSurface As Boolean)
XVal = Array(0.1, 0.2, 0.3, 0.5, 0.8, 1.1, 1.5, 2, 2.2, 3)
ZVal = Array(0.5, 0.6, 0.7, 0.75, 0.8, 1.1, 1.5, 2, 2.2, 5.6)
Pi = 3.141592

If IsSurface = False Then
    With TChart1.Series(0)
        .Clear
        .asContour.IrregularGrid = True
        .asContour.NumXValues = 10
        .asContour.NumZValues = 10
        .asContour.UsePalette = True
        .asContour.UseColorRange = False
        .asContour.PaletteStyle = psStrong
        For X = 0 To 9
            For Z = 0 To 9
                Y = Sin(Z * Pi / 10) * Cos(X * Pi / 5)
                .asContour.AddXYZ XVal(X), Y, ZVal(Z), "", clTeeColor
            Next Z
        Next X
    End With
ElseIf IsSurface = True Then
    With TChart1.Series(0)
        .Clear
        .asSurface.IrregularGrid = True
        .asSurface.NumXValues = 10
        .asSurface.NumZValues = 10
        .asSurface.Pen.Visible = False
        .asSurface.UsePalette = True
        .asSurface.UseColorRange = False
        .asSurface.PaletteStyle = psStrong
        For X = 0 To 9
            For Z = 0 To 9
                Y = Sin(Z * Pi / 10) * Cos(X * Pi / 5)
                .asSurface.AddXYZ XVal(X), Y, ZVal(Z), "", clTeeColor
            Next Z
        Next X
    End With
End If
End Sub
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

DTech
Newbie
Newbie
Posts: 15
Joined: Wed Sep 29, 2004 4:00 am
Location: Suwanee, Georgia, USA
Contact:

colorfille

Post by DTech » Wed Oct 20, 2004 9:50 pm

Thanks for adding this as a feature request. We will want to use that as soon as it is available. For now, the work-around you suggested is working and meeting the requirements...thanks!! I'm sure the new colorfill contour feature will be a bit speedier, but this work-around is good for now. Thanks!
Thanks, DTech

Post Reply