I can create a chart using code no problem, bar charts etc.
I can create a combination chart using a bar chart and line chart however when I set the second data set to be a scatter graph, it takes over the chart and the whole thing becomes a scatter graph as opposed to a bar chart with a line.
Anyone else had this problem. Here is some code, its a bit muddled because I keep changing it.
'Create the chart
Dim owcSeriesName(1) As String
Let owcSeriesName(1) = "Thickness Data"
Set owcChartSp = Me.owcChart.Object
c = owcChartSp.Constants
Dim owcChart1 As OWC10.ChChart
Set owcChart1 = owcChartSp.Charts.Add()
With owcChart1
.Type = chChartTypeColumnClustered
.HasTitle = True
.Title.Caption = Me.Title
.SeriesCollection.Add
With .SeriesCollection(0)
.Ungroup True
.Type = chChartTypeColumnClustered
.SetData chDimCategories, chDataLiteral, MyScale
.SetData chDimValues, chDataLiteral, MyFrequency
.name = "Bars"
End With
End With
For Each Axis In owcChart1.Axes
Axis.HasTitle = True
If Axis.Type = chCategoryAxis Then
Axis.Title.Caption = Me!selection
Else
Axis.Title.Caption = "Frequency"
End If
Next
owcChart1.Axes(chAxisPositionLeft).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionLeft).Scaling.Maximum = 10
owcChart1.Axes(chAxisPositionBottom).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionBottom).Scaling.Maximum = 20
With owcChart1
.SeriesCollection.Add
With .SeriesCollection(1)
.Ungroup True
.Type = chChartTypeScatterLine
.name = "Line"
.SetData chDimXValues, chDataLiteral, PlantMin
.SetData chDimYValues, chDataLiteral, LineVals
End With
End With
Dim oAxis2
Set oAxis2 = OwcChart1.Axes.Add(oSeries2.Scalings(chDimValues))
owcChart1.Axes(chAxisPositionLeft).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionLeft).Scaling.Maximum = 10
owcChart1.Axes(chAxisPositionBottom).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionBottom).Scaling.Maximum = 20
I can create a combination chart using a bar chart and line chart however when I set the second data set to be a scatter graph, it takes over the chart and the whole thing becomes a scatter graph as opposed to a bar chart with a line.
Anyone else had this problem. Here is some code, its a bit muddled because I keep changing it.
'Create the chart
Dim owcSeriesName(1) As String
Let owcSeriesName(1) = "Thickness Data"
Set owcChartSp = Me.owcChart.Object
c = owcChartSp.Constants
Dim owcChart1 As OWC10.ChChart
Set owcChart1 = owcChartSp.Charts.Add()
With owcChart1
.Type = chChartTypeColumnClustered
.HasTitle = True
.Title.Caption = Me.Title
.SeriesCollection.Add
With .SeriesCollection(0)
.Ungroup True
.Type = chChartTypeColumnClustered
.SetData chDimCategories, chDataLiteral, MyScale
.SetData chDimValues, chDataLiteral, MyFrequency
.name = "Bars"
End With
End With
For Each Axis In owcChart1.Axes
Axis.HasTitle = True
If Axis.Type = chCategoryAxis Then
Axis.Title.Caption = Me!selection
Else
Axis.Title.Caption = "Frequency"
End If
Next
owcChart1.Axes(chAxisPositionLeft).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionLeft).Scaling.Maximum = 10
owcChart1.Axes(chAxisPositionBottom).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionBottom).Scaling.Maximum = 20
With owcChart1
.SeriesCollection.Add
With .SeriesCollection(1)
.Ungroup True
.Type = chChartTypeScatterLine
.name = "Line"
.SetData chDimXValues, chDataLiteral, PlantMin
.SetData chDimYValues, chDataLiteral, LineVals
End With
End With
Dim oAxis2
Set oAxis2 = OwcChart1.Axes.Add(oSeries2.Scalings(chDimValues))
owcChart1.Axes(chAxisPositionLeft).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionLeft).Scaling.Maximum = 10
owcChart1.Axes(chAxisPositionBottom).Scaling.Minimum = 0
owcChart1.Axes(chAxisPositionBottom).Scaling.Maximum = 20