M
Michael Weiss
I am trying to add and configure multiple charts in a
single chartspace. I have the following code but am
getting an unspecified error on the line ".SetData
c.chDimCategories, 0, c.chPivotRows" when the loop comes
to the second chart in the chartspace. Does anyone have
any ideas why this would produce an error on any charts
after the first one in the chartspace? I am connecting
the chartspace to a OWC 10 pivot control using data from
an Analsyis Services cube.
Thank you,
Michael
' Get the active view
set pview = ptable.ActiveView
set pc = ptable.Constants
' Bind the Chart control to the PivotTable control
cspace.clear
set cspace.DataSource = ptable
set c = cspace.Constants
cspace.PlotAllAggregates = c.chPlotAggregatesSeries
'add in charts - one for each measure:minutes, call
count, charges, cpm
i = 1
For
i = 1 To pview.DataAxis.Totals.Count - 1 'subtract
1 - cspace adds one chart automatically
cspace.Charts.Add
Next
for i = 0 to cspace.Charts.Count - 1
set cht = cspace.Charts.item(i)
With cht
..haslegend = true
..HasTitle = True
..Title.Caption = "Call Type Analysis: " &
pview.DataAxis.Totals(i).Caption
' bind the series and categories dimensions
..SetData c.chDimCategories, 0, c.chPivotRows
..SetData c.chDimSeriesNames, 0, c.chPivotColumns
' Use the totals for values
..SetData c.chDimValues, 0, i
..Type = c.chChartTypeBarClustered3d
set ax = .Axes(c.chAxisPositionBottom)
set ttl = pview.DataAxis.Totals(i)
ax.NumberFormat = ttl.NumberFormat
ax.HasTitle = True
ax.Title.Caption = ttl.Caption
ax.title.font.size = 8
ax.title.font.color = "#336699"
set ax = cht.Axes(c.chAxisPositionLeft)
ax.Scaling.Orientation = c.chScaleOrientationMaxMin
..plotarea.interior.color = "white"
..axes(1).font.color = "#336699"
..axes(0).font.color = "#336699"
..axes(1).font.size = 7
..axes(0).font.size = 7
..legend.interior.color = "white"
..legend.font.size = 7
..legend.font.color = "#336699"
End With
next
single chartspace. I have the following code but am
getting an unspecified error on the line ".SetData
c.chDimCategories, 0, c.chPivotRows" when the loop comes
to the second chart in the chartspace. Does anyone have
any ideas why this would produce an error on any charts
after the first one in the chartspace? I am connecting
the chartspace to a OWC 10 pivot control using data from
an Analsyis Services cube.
Thank you,
Michael
' Get the active view
set pview = ptable.ActiveView
set pc = ptable.Constants
' Bind the Chart control to the PivotTable control
cspace.clear
set cspace.DataSource = ptable
set c = cspace.Constants
cspace.PlotAllAggregates = c.chPlotAggregatesSeries
'add in charts - one for each measure:minutes, call
count, charges, cpm
i = 1
For
i = 1 To pview.DataAxis.Totals.Count - 1 'subtract
1 - cspace adds one chart automatically
cspace.Charts.Add
Next
for i = 0 to cspace.Charts.Count - 1
set cht = cspace.Charts.item(i)
With cht
..haslegend = true
..HasTitle = True
..Title.Caption = "Call Type Analysis: " &
pview.DataAxis.Totals(i).Caption
' bind the series and categories dimensions
..SetData c.chDimCategories, 0, c.chPivotRows
..SetData c.chDimSeriesNames, 0, c.chPivotColumns
' Use the totals for values
..SetData c.chDimValues, 0, i
..Type = c.chChartTypeBarClustered3d
set ax = .Axes(c.chAxisPositionBottom)
set ttl = pview.DataAxis.Totals(i)
ax.NumberFormat = ttl.NumberFormat
ax.HasTitle = True
ax.Title.Caption = ttl.Caption
ax.title.font.size = 8
ax.title.font.color = "#336699"
set ax = cht.Axes(c.chAxisPositionLeft)
ax.Scaling.Orientation = c.chScaleOrientationMaxMin
..plotarea.interior.color = "white"
..axes(1).font.color = "#336699"
..axes(0).font.color = "#336699"
..axes(1).font.size = 7
..axes(0).font.size = 7
..legend.interior.color = "white"
..legend.font.size = 7
..legend.font.color = "#336699"
End With
next