Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a custom pie chart using OWC11 objects - Colour scheme??

Status
Not open for further replies.

DPlank

IS-IT--Management
May 30, 2003
1,903
0
0
GB
Hi,

I've spent a fair old while hunting for solutions to this - the majority of what I can find appears to be ASP or .NET related and I've done what I can with it, but I seem to have hit an impasse.

I have a series of scripts that create pie charts using the Google charts API. However for a number of reasons I've been asked to redesign it so that the charts aren't referencing the external site.

I've installed Office Web Components (OWC11) with the intent to build my own charts locally. The issue I'm having is trying to replicate the somewhat nicer and neater charts the google API produces.

I've got it creating the chart type and so on that I wanted, but I cannot figure out how to assign the colours I expect to the slices of the pie! Any ideas welcomed, even suggestions of better tools or ways of doing this...

Here's the code I have so far:
Code:
Set oChartSpace = WScript.CreateObject("OWC11.ChartSpace")

Set oChart = oChartSpace.Charts.Add
Set Con = oChartspace.Constants

oChart.Type = 58
oChart.HasLegend = False
oChart.HasTitle = True
oChart.title.font.name = "calibri"
oChart.title.font.size = 10
oChart.title.font.bold = False
oChartSpace.Border.Color = Con.chColorNone

oChart.Title.Caption = "AccessSystemTests (F42)" & vbNewLine & Date & " " & Time

Dim x(4)
Dim y(4)
Dim z(4)

x(0) = "Pass"
x(1) = "Fail"
x(2) = "Ignore"
x(3) = "Excptn"
x(4) = "Data"

y(0) = "2"
y(1) = "1"
y(2) = "0"
y(3) = "1"
y(4) = "2"

' how do I get these values associated with the data series??
z(0) = "Green"
z(1) = "Red"
z(2) = "Blue"
z(3) = "Yellow"
z(4) = "Black"

Set Sc = oChart.SeriesCollection

oChart.SeriesCollection.Add(0)

Set oSeries = oChart.SeriesCollection(0)

oSeries.SetData Con.chDimCategories, Con.chDataLiteral, x
oSeries.SetData Con.chDimValues, Con.chDataLiteral, y


oChartspace.ExportPicture "C:\temp\TestGraph.gif", "GIF", 250, 108

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top