ecGraph Demos

 

 


ecGraph Demo2.   2D Bar Graph, with colors.

 

  • 2D Bar Graph, with colors.
  • Scroll down below the screenshot image to see the VB code that was used to generate the graph.

 

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

Public Sub Demo2(ecGraph1 As ecGraph)
  '2D Bar Graph, with colors
  Dim Font$, i, X As Double, Y As Double
  With ecGraph1
    Call .Reset 'Always call "Reset" first to clear the page
    
    'Start a new graph on the page..
    Call .NewGraph("2D Bar Graph")
    Call .GraphTitleStyle(, "Font=Times New Roman|18|bold", ecBrown, -8, -12)
    Call .BorderStyle(ecCadetDarkBlue, ecLightCyan, 90)
    Call .AxisStyle(ecBlack, 2) 'set x-axis line thickness to 2
    Font$ = "Font=Arial|9|bold|italic"
    Call .AxisTitleStyle("Item category", Font$, ecDarkDarkBlue)
    Call .AxisLabelStyle(Font$, ecDarkDarkBlue)
    
    Call .SelectYaxis 'select the y-axis.
    Call .AxisStyle(ecBlack, 2) 'set x-axis line thickness to 2
    Call .AxisTitleStyle("Sales frequency", Font$, ecDarkDarkBlue, -3)
    Call .AxisLabelStyle(Font$, ecDarkDarkBlue, -1)
    Call .LegendTableStyle(Font$, ecBlack, 12, 16, , 0, , , , , , True)
    
    'Start a new data set on the graph, and add random points..
    Call .NewDataSet(" Data 1")
    Call .SymbolStyle(1, 5, ecGold, ecDarkDarkBlue, 2, False, 1.5, True) '2D bar, width 5mm
    For i = 1 To 9
      X = 2 * i
      Y = Sqr(i) + 1 + Rnd(i) / 3
      Call .AddDataPoint(X, Y)
    Next i
    
    'Start a new data set on the graph, and add random points..
    Call .NewDataSet(" Data 2")
    Call .SymbolStyle(1, 5, , , , , -1.5, True) '2D bar, width 5mm
    For i = 1 To 9
      X = 2 * i
      Y = Sqr(i) - Rnd(i) / 3
      Call .AddDataPoint(X, Y)
    Next i
    
    Call .PlotAreaColors(ecDarkBlue, ecLightDarkBlue, 90)
    Call .Refresh 'Always end with "Refresh"
  End With
End Sub

 

 


  Copyright 2007, Encore Consulting Pty Ltd.                                                     www.encoreconsulting.com.au