Path: C:\
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "softmultibar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'Number of charts produced in this demo module
Public Function getNoOfCharts() As Integer
getNoOfCharts = 1
End Function
'Main code for creating chart.
'Note: the argument img is unused because this demo only has 1 chart
Public Sub createChart(viewer As Object, img As String)
Dim cd As New ChartDirector.API
' The data for the bar chart
Dim data0()
data0 = Array(100, 125, 245, 147, 67)
Dim data1()
data1 = Array(85, 156, 179, 211, 123)
Dim data2()
data2 = Array(97, 87, 56, 267, 157)
Dim labels()
labels = Array("Mon", "Tue", "Wed", "Thur", "Fri")
' Create a XYChart object of size 540 x 375 pixels
Dim c As XYChart
Set c = cd.XYChart(540, 375)
' Add a title to the chart using 18 pts Times Bold Italic font
Call c.addTitle("Average Weekly Network Load", "timesbi.ttf", 18)
' Set the plotarea at (50, 55) and of 440 x 280 pixels in size. Use a vertical
' gradient color from light red (ffdddd) to dark red (880000) as background. Set
' border and grid lines to white (ffffff).
Call c.setPlotArea(50, 55, 440, 280, c.linearGradientColor(0, 55, 0, 335, _
&Hffdddd, &H880000), -1, &Hffffff, &Hffffff)
' Add a legend box at (50, 25) using horizontal layout. Use 10pts Arial Bold as
' font, with transparent background.
Call c.addLegend(50, 25, False, "arialbd.ttf", 10).setBackground(cd.Transparent)
' Set the x axis labels
Call c.xAxis().setLabels(labels)
' Draw the ticks between label positions (instead of at label positions)
Call c.xAxis().setTickOffset(0.5)
' Set axis label style to 8pts Arial Bold
Call c.xAxis().setLabelStyle("arialbd.ttf", 8)
Call c.yAxis().setLabelStyle("arialbd.ttf", 8)
' Set axis line width to 2 pixels
Call c.xAxis().setWidth(2)
Call c.yAxis().setWidth(2)
' Add axis title
Call c.yAxis().setTitle("Throughput (MBytes Per Hour)")
' Add a multi-bar layer with 3 data sets and 4 pixels 3D depth
Dim layer As BarLayer
Set layer = c.addBarLayer2(cd.Side, 4)
Call layer.addDataSet(data0, &Hffff00, "Server #1")
Call layer.addDataSet(data1, &H00ff00, "Server #2")
Call layer.addDataSet(data2, &H9999ff, "Server #3")
' Set bar border to transparent. Use soft lighting effect with light direction
' from top.
Call layer.setBorderColor(cd.Transparent, cd.softLighting(cd.Top))
' Configure the bars within a group to touch each others (no gap)
Call layer.setBarGap(0.2, cd.TouchBar)
' Output the chart
Set viewer.Picture = c.makePicture()
'include tool tip for the chart
viewer.ImageMap = c.getHTMLImageMap("clickable", "", _
"title='{dataSetName} on {xLabel}: {value} MBytes/hour'")
End Sub