ecGraph3D  -  Demo6

The VB code used to generate the above graph...

Public Sub Demo6(ecGraph3D1 As ecGraph3D)
  'Parallel data sets, custom color shading, transparent horizontal legend.
  Const Rows = 4, Cols = 7
  Dim zColors(Rows, Cols) As Long, i As Integer, j As Integer, Color As Long
  With ecGraph3D1
    Call .Reset 'always start with "Reset"
    .ShowAxes = False
    Call .AddText("Demo 6. Parallel data sets, custom color shading, transparent horizontal legend.", 50, 2, , , 1)
    Call .SimpleColorBand(-2, 3, ecPink, ecMaroon) 'set range and colors for the z-color table
    
    Call .LegendTableStyle(21, 87, "Arial|10", vbBlack, , , 0, True, True)
    Call .AddLegendEntry("Red Data", vbRed, vbBlack, 1)
    Call .AddLegendEntry("Blue Data", vbBlue, vbBlack, 1)
    Call .AddLegendEntry("Green Data", vbGreen, vbBlack, 1)
    Call .AddLegendEntry("Yellow Data", vbYellow, vbBlack, 1)
    
    'allocate colors red/blue/green/yellow with shading from light to dark as j (y) increases
    For i = 1 To 4
      Select Case i
        Case 1: Color = vbRed
        Case 2: Color = vbBlue
        Case 3: Color = vbGreen
        Case 4: Color = vbYellow
      End Select
      For j = 1 To Cols
        zColors(i, j) = .DarkenOrLighten(Color, (j - 4) / 6)
      Next j
    Next i
    
    'add a math function: z = f(x,y) with x and y range and resolution..
    Call .AddFunction("4+sin(x)+sin(y)", Rows, 0, 6, Cols, 0, 6)
    Call .AddBarColors(zColors)
    .BarWidthX = 0.15: .BarWidthY = 0.7
    
    Call .Refresh 'always end with "Refresh"
  End With
End Sub
 


      Contents  (ecGraph3D.ocx)     Variables     Events     Properties     Functions     Subs

Copyright 2008, Encore Consulting Pty Ltd