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

How to change legend color and Y value interval

Status
Not open for further replies.

fairfaxVB

Programmer
Nov 3, 2005
46
US
Hi Friends,
I use chartspecial object to created charts. it works well.
Could we have some way to changed legend color and color order in chart?
Could we change Y value interval in chart?

Thanks for any help!!
FairfaxVB

************working codes
<HTML><body>
<object id=ChartSpace1 classid=CLSID:0002E55D-0000-0000-C000-000000000046 style="width:100%;height:350"></object>
'for 2000XP/word2003 OS, put this id in code

<object id=ChartSpace1 classid=CLSID:0002E500-0000-0000-C000-000000000046 style="width:100%;height:350"></object>
' for 2000 OS/word200,put this id in code

<script language=vbscript>
Sub Window_OnLoad()
Dim oChart
Dim oSeries1, oSeries2,oSeries3
dim oConst
ChartSpace1.Clear
Set oConst = ChartSpace1.Constants
Set oChart = ChartSpace1.Charts.Add
Set oSeries1 = oChart.SeriesCollection.Add
With oSeries1
.Caption = "amount"
.SetData oConst.chDimCategories, oConst.chDataLiteral, _
Array("11/1/2005", "11/2/2005", "11/3/2005", "11/4/2005","11/5/2005","11/6/2005","11/7/2005","11/8/2005","11/9/2005","11/10/2005","11/11/2005")
.SetData oConst.chDimValues, oConst.chDataLiteral, _
Array(50, 60, 55, 59,53,54,55,57,56,58,57)
.Type = oConst.chChartTypeColumnClustered
End With
Set oSeries2 = oChart.SeriesCollection.Add
With oSeries2
.Caption = "Reveice"
.SetData oConst.chDimCategories, oConst.chDataLiteral, _
Array("11/1/2005", "11/2/2005", "11/3/2005", "11/4/2005","11/5/2005","11/6/2005","11/7/2005","11/8/2005","11/9/2005","11/10/2005","11/11/2005")
.SetData oConst.chDimValues, oConst.chDataLiteral, _
Array(39, 47, 50, 46,49,47,46,42,43,40,41)
.Type = oConst.chChartTypeLine
End With
Set oSeries3 = oChart.SeriesCollection.Add
With oSeries3
.Caption = "payment"
.SetData oConst.chDimCategories, oConst.chDataLiteral, _
Array("11/1/2005", "11/2/2005", "11/3/2005", "11/4/2005","11/5/2005","11/6/2005","11/7/2005","11/8/2005","11/9/2005","11/10/2005","11/11/2005")
.SetData oConst.chDimValues, oConst.chDataLiteral, _
Array(19, 27, 25, 26,27,24,23,21,20,19,20)
.Type = oConst.chChartTypeLine
End With
oChart.Axes.Add oChart.Scalings(oConst.chDimValues), _
oConst.chAxisPositionRight, oConst.chValueAxis
oChart.HasLegend = True
oChart.Legend.Position = oConst.chLegendPositionBottom
oChart.HasTitle = True
oChart.Title.Caption = "Account Analyse"
End Sub
</script>
</body>
</html>
 
For the two types, use the corresponding methods.
[tt]
'use interior object
.Type = oConst.chChartTypeColumnClustered
[blue].interior.color=rgb(0,0,255) 'one color format among others[/blue]
'...
.Type = oConst.chChartTypeLine
'use line object
[blue].line.color="saddlebrown" 'for instance, another color format[/blue]
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top