V
VictorValle
I am trying to generate a histogram with a cumulative line using the
OWC ChChart object. The histogram itself looks good. However, when I
add a new SeriesCollection to draw the cumulative line, the chart
plotting area gets resized according to the cumulative line values.
This makes the histogram to be scaled down to the point where it is
hardly visible.
In an Excel 2000 chart, this problem can be solved by right clicking
the serie, selecting "Format Data series", the "Axis" tab and plotting
the series on Primary or Secondary Axis. I have not been able to
emulate this functionality in OWC. Is it possible?
Any ideas?
Here is the code:
' ------------------------------------------
'| Build Chart
' ------------------------------------------
function buildChart(ichartObj, iCategoriesArr, iSeriesArr, iValuesArr,
iCummArr)
on error resume next
if( (typename(ichartObj) = "HTMLObjectElement") ) then
set chConstants = ichartObj.Constants
' ------------------------------------------
'| Clear the workspace and add a chart
' ------------------------------------------
ichartObj.Clear
set newChart = ichartObj.Charts.Add
' ------------------------------------------
'| Add frequency series
' ------------------------------------------
set seriesObj1 = newChart.SeriesCollection.Add
with seriesObj1
.SetData chConstants.chDimValues, chConstants.chDataLiteral,
iValuesArr
.SetData chConstants.chDimSeriesNames, chConstants.chDataLiteral,
iCategoriesArr
.SetData chConstants.chDimCategories, chConstants.chDataLiteral,
iSeriesArr
.Caption = "Frequency"
.Type = chConstants.chChartTypeArea
end with
' ------------------------------------------
'| Add the cummulative series
' ------------------------------------------
set seriesObj = newChart.SeriesCollection.Add
with seriesObj
.SetData chConstants.chDimValues, chConstants.chDataLiteral,
iCummArr
.SetData chConstants.chDimSeriesNames, chConstants.chDataLiteral,
iCategoriesArr
.SetData chConstants.chDimCategories, chConstants.chDataLiteral,
iSeriesArr
.Caption = "Cummulative"
.Type = chConstants.chChartTypeLine
end with
' ------------------------------------------
'| Set the label spacing
' ------------------------------------------
set axValueAxisBottom =
newChart.Axes(chConstants.chAxisPositionBottom)
axValueAxisBottom.TickLabelSpacing = <%=ubound(categoryNames)%> /
20
' ------------------------------------------
'| Clear objects from memory
' ------------------------------------------
set axValueAxisBottom = nothing
set seriesObj = nothing
set newChart = nothing
set chConstants = nothing
end if
end function
OWC ChChart object. The histogram itself looks good. However, when I
add a new SeriesCollection to draw the cumulative line, the chart
plotting area gets resized according to the cumulative line values.
This makes the histogram to be scaled down to the point where it is
hardly visible.
In an Excel 2000 chart, this problem can be solved by right clicking
the serie, selecting "Format Data series", the "Axis" tab and plotting
the series on Primary or Secondary Axis. I have not been able to
emulate this functionality in OWC. Is it possible?
Any ideas?
Here is the code:
' ------------------------------------------
'| Build Chart
' ------------------------------------------
function buildChart(ichartObj, iCategoriesArr, iSeriesArr, iValuesArr,
iCummArr)
on error resume next
if( (typename(ichartObj) = "HTMLObjectElement") ) then
set chConstants = ichartObj.Constants
' ------------------------------------------
'| Clear the workspace and add a chart
' ------------------------------------------
ichartObj.Clear
set newChart = ichartObj.Charts.Add
' ------------------------------------------
'| Add frequency series
' ------------------------------------------
set seriesObj1 = newChart.SeriesCollection.Add
with seriesObj1
.SetData chConstants.chDimValues, chConstants.chDataLiteral,
iValuesArr
.SetData chConstants.chDimSeriesNames, chConstants.chDataLiteral,
iCategoriesArr
.SetData chConstants.chDimCategories, chConstants.chDataLiteral,
iSeriesArr
.Caption = "Frequency"
.Type = chConstants.chChartTypeArea
end with
' ------------------------------------------
'| Add the cummulative series
' ------------------------------------------
set seriesObj = newChart.SeriesCollection.Add
with seriesObj
.SetData chConstants.chDimValues, chConstants.chDataLiteral,
iCummArr
.SetData chConstants.chDimSeriesNames, chConstants.chDataLiteral,
iCategoriesArr
.SetData chConstants.chDimCategories, chConstants.chDataLiteral,
iSeriesArr
.Caption = "Cummulative"
.Type = chConstants.chChartTypeLine
end with
' ------------------------------------------
'| Set the label spacing
' ------------------------------------------
set axValueAxisBottom =
newChart.Axes(chConstants.chAxisPositionBottom)
axValueAxisBottom.TickLabelSpacing = <%=ubound(categoryNames)%> /
20
' ------------------------------------------
'| Clear objects from memory
' ------------------------------------------
set axValueAxisBottom = nothing
set seriesObj = nothing
set newChart = nothing
set chConstants = nothing
end if
end function