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

how to formate chart X and Y value on the web by VAScript

Status
Not open for further replies.

fairfaxVB

Programmer
Nov 3, 2005
46
US
Hi expert's friends,
I copy this codes from this site. It works well in 2003 office .
How can I cut off right Y lable value ( it appears Y label valur both in left and right).
how can I how to formated Y lable value and begin point as 0.
how can I how to change chart x interval value on the web by VAScript
Thanks for help.
Does tsuji is here? I like your answer about chart in office 2000 for other person.

Fairfax VB


*****Source codes
<html><head><title>chart example</title></head>
<body>

<object id=ChartSpace1 classid=CLSID:0002E55D-0000-0000-C000-000000000046 style="width:100%;height:350"></object>
<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 = "Calls"
.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

oChart.Axes.Add oChart.Scalings(oConst.chDimValues), _
oConst.chAxisPositionRight, oConst.chValueAxis
oChart.Legend.Position = oConst.chLegendPositionBottom
oChart.HasTitle = True
oChart.Title.Caption = "Chart Analyse"
End Sub
</script>
</body>
</html>
 
Hi Friends,
this 2 Y labee value is only in ms 2000 chart class.
<object id=ChartSpace1 classid=CLSID:0002E500-0000-0000-C000-000000000046 style="width:100%;height:350">

Thanks for help,

FairfaxVB
 
[1]
>How can I cut off right Y lable value ( it appears Y label valur both in left and right).
Just comment out the line.
[tt][red]'[/red]oChart.Axes.Add oChart.Scalings(oConst.chDimValues), _
[red]'[/red] oConst.chAxisPositionRight, oConst.chValueAxis[/tt]
[2]
>how can I how to formated Y lable value and begin point as 0.
Add the line after setting oSerial1.
[tt] oChart.scalings(2).minimum=0[/tt]
[3]
Before the line oChart.Legend.Position you have to set hasLegend property to true.
[tt] [red]oChart.hasLegend=true 'add this[/red]
oChart.Legend.Position = oConst.chLegendPositionBottom[/tt]
 
Overlooked there's a question left.
[4]
>how can I how to change chart x interval value on the web by VAScript
Add this.
[tt] oChart.Axes(oConst.chAxisPositionBottom).ticklabelspacing=2[/tt]
 
Hi Tsuji,
It is nice to get your help.
however. it does not work on 2003 office chart environment.
Please test my code.
this codes could automatic chang X/Y lable value interval and display 12 column value only.
I want to display all (79 column) of value in chart even there are a auto x lable interval.
If I put ChartSpace1.DataMember = "calls" under declare line. systen will display all value(79 array). But it also display 2 charts on the scerrn( one is i want to, other is blank with X lable value). very strang!!

there are lots of properties about chart object at However, Microsoft does not show example for these properity.
again, Thank for any help!!
Fairfax VB

**************

<%@ language=VBScript%><HTML>
<head><title>example</title></head>
<input type="hidden" value="JavaScript1.5" name="VBScript">
<STRONG><CENTER>Calls info</CENTER></STRONG>
<BODY>
<object id=ChartSpace1 classid=CLSID:0002E55D-0000-0000-C000-000000000046 style="width:100%;height:480"></object>
<input type="hidden" name="vbs" value="JavaScript1.5">
<script language=vbs>
Sub Window_OnLoad()
Dim oChart

Dim oSeries1
dim oConst
ChartSpace1.Clear
Set oConst = ChartSpace1.Constants
Set oChart = ChartSpace1.Charts.Add
Set oSeries1 = oChart.SeriesCollection.Add

ChartSpace1.DataMember = "calls"
' ChartSpace1.SetData oConst.chDimCategories, oConst.chDataBound, "Calls"
' ChartSpace1.SetData oConst.chDimValues, oConst.chDataBound, "Quantity"


With oSeries1
.Caption = "Calls"
.SetData oConst.chDimCategories, oConst.chDataLiteral, _
Array("03/14/2005","03/15/2005","03/16/2005","03/17/2005","03/18/2005","03/19/2005","03/20/2005","03/21/2005","03/22/2005","03/23/2005","03/24/2005","03/25/2005","03/26/2005","03/27/2005","03/28/2005","03/29/2005","03/30/2005","03/31/2005","04/01/2005","04/02/2005","04/04/2005","04/05/2005","04/06/2005","04/07/2005","04/08/2005","04/09/2005","04/10/2005","04/11/2005","04/12/2005","04/13/2005","04/14/2005","04/15/2005","04/16/2005","04/17/2005","04/18/2005","04/19/2005","04/20/2005","04/21/2005","04/22/2005","04/23/2005","04/24/2005","04/25/2005","04/26/2005","04/27/2005","04/28/2005","04/29/2005","04/30/2005","05/01/2005","05/02/2005","05/03/2005","05/04/2005","05/05/2005","05/06/2005","05/07/2005","05/08/2005","05/09/2005","05/10/2005","05/11/2005","05/12/2005","05/13/2005","05/14/2005","05/15/2005","05/16/2005","05/17/2005","05/18/2005","05/19/2005","05/20/2005","05/21/2005","05/22/2005","05/23/2005","05/24/2005","05/25/2005","05/26/2005","05/27/2005","05/28/2005","05/29/2005","05/30/2005","05/31/2005","06/01/2005")
.SetData oConst.chDimValues, oConst.chDataLiteral, _
Array(745000,871000,738000,917000,533000,185000,0,790000,883000,830000,684000,508000,71000,0,882000,709000,930000,846000,571000,119000,726000,861000,845000,802000,726000,107000,0,971000,768000,848000,831000,851000,118000,0,879000,931000,726000,1009000,775000,228000,0,1112000,988000,729000,879000,1081000,98000,0,821000,1099000,833000,771000,610000,145000,0,809000,769000,722000,628000,897000,132000,0,937000,673000,798000,706000,681000,204000,0,842000,642000,848000,740000,805000,124000,0,198000,805000,665000)
.Type = oConst.chChartTypeColumnClustered
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 = "Calls Analyse"
oChart.Axes(oConst.chAxisPositionBottom).ticklabelspacing=2

End Sub


</script>
</BODY></HTML>
 
First make some space at irrelevant place to have line wrapping function. Horizontal scroll is not user friendly or me-friendly.

Work or not work depends on you have the com object installed. Check out your registry if you can find the clsid string.
[tt]0002E55D-0000-0000-C000-000000000046[/tt]
As far as I'm concerned, I use 2k m/c and it works perfectly with my installed owc.
[tt]0002E5[blue]00[/blue]-0000-0000-C000-000000000046[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top