Page 1 of 1

chart 3D - coloring

Posted: Wed May 28, 2008 12:25 pm
by 9535493
Hello,

I use AddXYZ to fill chart.
there is posibility to set color for each point added in this way.

Problem which appears is marked in file I uploaded: chart3D.jpg
(with http://www.steema.net/upload/Default.aspx)

So there are points one next to other which are in different "layer"
and one vertical half is coloured by different color.
( where layer is part of surface bounded with contours defined by me)

So my question is: Is there possibility to define coloring of 3D chart
with and only with intervals on vertical (left) axis? in order to avoid
cases I pointed.

thanks

Posted: Wed May 28, 2008 12:43 pm
by narcis
Hi adenin,

Yes, you can do the same I suggested to another client today here. This is a TeeChart VCL thread but the same applies to the ActiveX version.

Posted: Thu May 29, 2008 6:16 am
by 9535493
I did not find answer to my question there.

I already use coloring:

.Series(0).asSurface.AddXYZ 315,51.213840,24,"",RGB(0,255,176)

but this does not produce surface colored by contours.

Posted: Thu May 29, 2008 8:29 am
by yeray
Hi adenin,

We think that probably you should work with a color range, one of predefined palettes or with a custom palette.

With this code you could see a simple color range example:

Code: Select all

Private Sub Form_Load()
Dim i, j As Integer
  TChart1.AddSeries scSurface
  
  With TChart1.Series(0).asSurface
    .IrregularGrid = False
    .UseColorRange = True
  
    For i = 0 To 50
      For j = 0 To 5
        .AddXYZ i, i * j, j, "", clTeeColor
      Next j
    Next i
  End With
End Sub
A simple predefined palette example:

Code: Select all

Private Sub Form_Load()
Dim i, j As Integer
  TChart1.AddSeries scSurface
  
  With TChart1.Series(0).asSurface
    .IrregularGrid = False
    .UseColorRange = False
    .UsePalette = True
    .PaletteStyle = psInvGray
     
    For i = 0 To 50
      For j = 0 To 5
        .AddXYZ i, i * j, j, "", clTeeColor
      Next j
    Next i
  End With
End Sub
And finally, a simple custom palette example:

Code: Select all

Private Sub Form_Load()
Dim i, j As Integer
  TChart1.AddSeries scSurface
  
  With TChart1.Series(0).asSurface
    .IrregularGrid = False
    .UseColorRange = False
    .UsePalette = True

    .PaletteStyle = psCustom
    .ClearPalette
    .AddPalette 50, vbGreen
    .AddPalette 100, vbYellow
    .AddPalette 200, vbRed
     
    For i = 0 To 50
      For j = 0 To 5
        .AddXYZ i, i * j, j, "", clTeeColor
      Next j
    Next i
  End With
End Sub
You can also take a look at "new features demos" if you want more examples.