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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Microsoft Chart (owc11) with plotting multiple series

Status
Not open for further replies.

getreality

Programmer
Feb 7, 2006
1
US
I put together a simple chart to plot a scatter plot of an x and y value. This worked fine. I then mod'ed the code to add a second series based on data filled in arrays to plot a line as well. This line denotes a threshold of good vs. bad.

The chart does not plot the SeriesCollection(0), which points to the two arrays, one for x values and one for y values.

WHAT AM I DOING WRONG?
CODE OF THE FUNCTION BELOW
=====================================

Private Function FillModelChart( _
owcChartSp As OWC11.ChartSpace, _
Xvalue As Double, _
Yvalue As Double)
' Xvalue and Yvalue passed values plot the point for this particular PreScreen

Dim owcChart As OWC11.ChChart
Dim chtSeries0 As OWC11.ChSeries
Dim chConstants

' the following sets the static line demarker of what is considered a passing PreScreen
Dim aXValues(0 To 10) As Double
Dim aYValues(0 To 10) As Double

aYValues(0) = 10
aYValues(1) = 9
aYValues(2) = 8
aYValues(3) = 7
aYValues(4) = 6
aYValues(5) = 5
aYValues(6) = 4
aYValues(7) = 3
aYValues(8) = 2
aYValues(9) = 1
aYValues(10) = 0

aXValues(0) = 0
aXValues(1) = 1
aXValues(2) = 2
aXValues(3) = 3
aXValues(4) = 4
aXValues(5) = 5
aXValues(6) = 6
aXValues(7) = 7
aXValues(8) = 8
aXValues(9) = 9
aXValues(10) = 10

Set chConstants = owcChartSp.Constants
Set owcChart = owcChartSp.CHARTS.Add()
owcChartSp.CHARTS(0).SeriesCollection.Add
owcChartSp.CHARTS(0).SeriesCollection.Add

With owcChart
.Type = chChartTypeScatterSmoothLineMarkers
.HasLegend = False
.HasTitle = False
.AspectRatio = 100
.Axes(0).Name = "Sponsor"
.Axes(1).Name = "RE"


' Hook up the two necessary data fields.
.SeriesCollection(0).SetData chDimXValues, chConstants.chDataLiteral, aXValues
.SeriesCollection(0).SetData chDimYValues, chConstants.chDataLiteral, aYValues
With .SeriesCollection(0).DataLabelsCollection.Add

.HasPercentage = False
.HasValue = True
.Separator = ": "


' Use 8pt black text on a white background,
' in Tahoma font.
.Interior.Color = "white"
.Border.Color = "black"
With .Font
.Name = "Tahoma"
.Color = "black"
.Bold = True
.Size = 8
End With
End With
.SeriesCollection(1).SetData chDimXValues, chDataLiteral, Xvalue
.SeriesCollection(1).SetData chDimYValues, chDataLiteral, Yvalue
With .SeriesCollection(1).DataLabelsCollection.Add
.HasPercentage = False
.HasValue = True
.Separator = ": "

' Use 8pt black text on a white background,
' in Tahoma font.
.Interior.Color = "white"
.Border.Color = "black"
With .Font
.Name = "Tahoma"
.Color = "black"
.Bold = True
.Size = 8
End With
End With

End With

If owcChartSp.CHARTS.Count > 1 Then
owcChartSp.CHARTS.Delete (0)
End If
End Function
=============================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top