J
Jason Kelley
I have a business application (ASP) that uses the owc.chart control to
display line graphs in my application. I found this code in a post and
tried it, and guess what (It works), so I ran with it. Heres the
problem though, this works great on workstations that have Office 2000
(Excell) installed on them. Other workstations running Office 2003, or
even older versions (Excell 97) won't display the graph. Is there a
way that I can make it work on all versions? Please help?
Thank You,
Jason Kelley
(e-mail address removed)
636-680-1213
<center><object id=ChartSpace1
classid=CLSID:0002E500-0000-0000-C000-000000000046
style="width:90%;height:300"></object></center>
<script language=vbscript>
sub Window_Onload()
Dim asSeriesNames(3)
Dim asCategories(13)
Dim aiSeries1(13)
Dim aiSeries2(13)
Dim aiSeries3(13)
Dim chConstants
Dim chtNewChart
dim chtChart2
Dim serUnitSales
Dim serDispInc
Dim axIncomeAxis
dim fnt
asSeriesNames(0) = document.getElementById("ChartKind").value
asSeriesNames(1) = "Base Line"
asSeriesNames(3) = "Goal"
asCategories(0) = document.getElementById("Date1").value
asCategories(1) = document.getElementById("Date2").value
asCategories(2) = document.getElementById("Date3").value
asCategories(3) = document.getElementById("Date4").value
asCategories(4) = document.getElementById("Date5").value
asCategories(5) = document.getElementById("Date6").value
asCategories(6) = document.getElementById("Date7").value
asCategories(7) = document.getElementById("Date8").value
asCategories(8) = document.getElementById("Date9").value
asCategories(9) = document.getElementById("Date10").value
asCategories(10) = document.getElementById("Date11").value
asCategories(11) = document.getElementById("Date12").value
asCategories(12) = document.getElementById("Date13").value
aiSeries1(0) = document.getElementById("Value1").value
aiSeries1(1) = document.getElementById("Value2").value
aiSeries1(2) = document.getElementById("Value3").value
aiSeries1(3) = document.getElementById("Value4").value
aiSeries1(4) = document.getElementById("Value5").value
aiSeries1(5) = document.getElementById("Value6").value
aiSeries1(6) = document.getElementById("Value7").value
aiSeries1(7) = document.getElementById("Value8").value
aiSeries1(8) = document.getElementById("Value9").value
aiSeries1(9) = document.getElementById("Value10").value
aiSeries1(10) = document.getElementById("Value11").value
aiSeries1(11) = document.getElementById("Value12").value
aiSeries1(12) = document.getElementById("Value13").value
aiSeries2(0) = document.getElementById("BaseLine").value
aiSeries2(1) = document.getElementById("BaseLine").value
aiSeries2(2) = document.getElementById("BaseLine").value
aiSeries2(3) = document.getElementById("BaseLine").value
aiSeries2(4) = document.getElementById("BaseLine").value
aiSeries2(5) = document.getElementById("BaseLine").value
aiSeries2(6) = document.getElementById("BaseLine").value
aiSeries2(7) = document.getElementById("BaseLine").value
aiSeries2(8) = document.getElementById("BaseLine").value
aiSeries2(9) = document.getElementById("BaseLine").value
aiSeries2(10) = document.getElementById("BaseLine").value
aiSeries2(11) = document.getElementById("BaseLine").value
aiSeries2(12) = document.getElementById("BaseLine").value
aiSeries3(0) = document.getElementById("GoalLine").value
aiSeries3(1) = document.getElementById("GoalLine").value
aiSeries3(2) = document.getElementById("GoalLine").value
aiSeries3(3) = document.getElementById("GoalLine").value
aiSeries3(4) = document.getElementById("GoalLine").value
aiSeries3(5) = document.getElementById("GoalLine").value
aiSeries3(6) = document.getElementById("GoalLine").value
aiSeries3(7) = document.getElementById("GoalLine").value
aiSeries3(8) = document.getElementById("GoalLine").value
aiSeries3(9) = document.getElementById("GoalLine").value
aiSeries3(10) = document.getElementById("GoalLine").value
aiSeries3(11) = document.getElementById("GoalLine").value
aiSeries3(12) = document.getElementById("GoalLine").value
Set chConstants = ChartSpace1.Constants
' Enable the display of the legend.
ChartSpace1.HasChartSpaceLegend = True
' Add a new chart to Chartspace1.
Set chtNewChart = ChartSpace1.Charts.Add
'set chtChart2 = ChartSpace1.Charts.Add
' Specify that the chart is a column chart.
chtNewChart.Type = chConstants.chChartTypeLine
chtNewChart.HasTitle = true
chtNewChart.Title.Caption = document.getElementById("Shop").value &
" " & document.getElementById("ChartKind").value
set fnt = chtNewChart.Title.Font
fnt.Name = "arial"
fnt.Size = 14
fnt.Bold = True
' Bind the chart to the arrays.
chtNewChart.SetData chConstants.chDimSeriesNames,
chConstants.chDataLiteral, asSeriesNames
chtNewChart.SetData chConstants.chDimCategories,
chConstants.chDataLiteral, asCategories
Set serUnitSales = chtNewChart.SeriesCollection(0)
chtNewChart.SeriesCollection(0).Line.Color="red"
serUnitSales.SetData chConstants.chDimValues,
chConstants.chDataLiteral, aiSeries1
set serUnitSales = chtNewChart.SeriesCollection(1)
chtNewChart.SeriesCollection(1).Line.Color="yellow"
'chtNewChart.SeriesCollection(1).Line.
serUnitSales.SetData chConstants.chDimValues,
chConstants.chDataLiteral, aiSeries2
set serUnitSales = chtNewChart.SeriesCollection(2)
chtNewChart.SeriesCollection(2).Line.Color="limegreen"
serUnitSales.SetData chConstants.chDimValues,
chConstants.chDataLiteral, aiSeries3
End Sub
</script>
display line graphs in my application. I found this code in a post and
tried it, and guess what (It works), so I ran with it. Heres the
problem though, this works great on workstations that have Office 2000
(Excell) installed on them. Other workstations running Office 2003, or
even older versions (Excell 97) won't display the graph. Is there a
way that I can make it work on all versions? Please help?
Thank You,
Jason Kelley
(e-mail address removed)
636-680-1213
<center><object id=ChartSpace1
classid=CLSID:0002E500-0000-0000-C000-000000000046
style="width:90%;height:300"></object></center>
<script language=vbscript>
sub Window_Onload()
Dim asSeriesNames(3)
Dim asCategories(13)
Dim aiSeries1(13)
Dim aiSeries2(13)
Dim aiSeries3(13)
Dim chConstants
Dim chtNewChart
dim chtChart2
Dim serUnitSales
Dim serDispInc
Dim axIncomeAxis
dim fnt
asSeriesNames(0) = document.getElementById("ChartKind").value
asSeriesNames(1) = "Base Line"
asSeriesNames(3) = "Goal"
asCategories(0) = document.getElementById("Date1").value
asCategories(1) = document.getElementById("Date2").value
asCategories(2) = document.getElementById("Date3").value
asCategories(3) = document.getElementById("Date4").value
asCategories(4) = document.getElementById("Date5").value
asCategories(5) = document.getElementById("Date6").value
asCategories(6) = document.getElementById("Date7").value
asCategories(7) = document.getElementById("Date8").value
asCategories(8) = document.getElementById("Date9").value
asCategories(9) = document.getElementById("Date10").value
asCategories(10) = document.getElementById("Date11").value
asCategories(11) = document.getElementById("Date12").value
asCategories(12) = document.getElementById("Date13").value
aiSeries1(0) = document.getElementById("Value1").value
aiSeries1(1) = document.getElementById("Value2").value
aiSeries1(2) = document.getElementById("Value3").value
aiSeries1(3) = document.getElementById("Value4").value
aiSeries1(4) = document.getElementById("Value5").value
aiSeries1(5) = document.getElementById("Value6").value
aiSeries1(6) = document.getElementById("Value7").value
aiSeries1(7) = document.getElementById("Value8").value
aiSeries1(8) = document.getElementById("Value9").value
aiSeries1(9) = document.getElementById("Value10").value
aiSeries1(10) = document.getElementById("Value11").value
aiSeries1(11) = document.getElementById("Value12").value
aiSeries1(12) = document.getElementById("Value13").value
aiSeries2(0) = document.getElementById("BaseLine").value
aiSeries2(1) = document.getElementById("BaseLine").value
aiSeries2(2) = document.getElementById("BaseLine").value
aiSeries2(3) = document.getElementById("BaseLine").value
aiSeries2(4) = document.getElementById("BaseLine").value
aiSeries2(5) = document.getElementById("BaseLine").value
aiSeries2(6) = document.getElementById("BaseLine").value
aiSeries2(7) = document.getElementById("BaseLine").value
aiSeries2(8) = document.getElementById("BaseLine").value
aiSeries2(9) = document.getElementById("BaseLine").value
aiSeries2(10) = document.getElementById("BaseLine").value
aiSeries2(11) = document.getElementById("BaseLine").value
aiSeries2(12) = document.getElementById("BaseLine").value
aiSeries3(0) = document.getElementById("GoalLine").value
aiSeries3(1) = document.getElementById("GoalLine").value
aiSeries3(2) = document.getElementById("GoalLine").value
aiSeries3(3) = document.getElementById("GoalLine").value
aiSeries3(4) = document.getElementById("GoalLine").value
aiSeries3(5) = document.getElementById("GoalLine").value
aiSeries3(6) = document.getElementById("GoalLine").value
aiSeries3(7) = document.getElementById("GoalLine").value
aiSeries3(8) = document.getElementById("GoalLine").value
aiSeries3(9) = document.getElementById("GoalLine").value
aiSeries3(10) = document.getElementById("GoalLine").value
aiSeries3(11) = document.getElementById("GoalLine").value
aiSeries3(12) = document.getElementById("GoalLine").value
Set chConstants = ChartSpace1.Constants
' Enable the display of the legend.
ChartSpace1.HasChartSpaceLegend = True
' Add a new chart to Chartspace1.
Set chtNewChart = ChartSpace1.Charts.Add
'set chtChart2 = ChartSpace1.Charts.Add
' Specify that the chart is a column chart.
chtNewChart.Type = chConstants.chChartTypeLine
chtNewChart.HasTitle = true
chtNewChart.Title.Caption = document.getElementById("Shop").value &
" " & document.getElementById("ChartKind").value
set fnt = chtNewChart.Title.Font
fnt.Name = "arial"
fnt.Size = 14
fnt.Bold = True
' Bind the chart to the arrays.
chtNewChart.SetData chConstants.chDimSeriesNames,
chConstants.chDataLiteral, asSeriesNames
chtNewChart.SetData chConstants.chDimCategories,
chConstants.chDataLiteral, asCategories
Set serUnitSales = chtNewChart.SeriesCollection(0)
chtNewChart.SeriesCollection(0).Line.Color="red"
serUnitSales.SetData chConstants.chDimValues,
chConstants.chDataLiteral, aiSeries1
set serUnitSales = chtNewChart.SeriesCollection(1)
chtNewChart.SeriesCollection(1).Line.Color="yellow"
'chtNewChart.SeriesCollection(1).Line.
serUnitSales.SetData chConstants.chDimValues,
chConstants.chDataLiteral, aiSeries2
set serUnitSales = chtNewChart.SeriesCollection(2)
chtNewChart.SeriesCollection(2).Line.Color="limegreen"
serUnitSales.SetData chConstants.chDimValues,
chConstants.chDataLiteral, aiSeries3
End Sub
</script>