Need help in XY scatter chart using Javascript/Vbscript

G

Ganesh

Hi,



We are trying to use scatter xy chart using OWC and Javascript. Our
development environment is SAP ( BSP) and hence we do nt have much of a
choice but put this in a script or XML . We are able to comofrtably create
column charts but for some reason, the xy scatter will not come . The souce
code is as follows.



<html>
<head>
</head>

<script type='text/javascript'>

function create_chart() {

var xlLineMarkers = 21;
var xlColumns = 2;

var chDimSeriesNames = 0;
var chDimCategories = 1;
var chDimValues = 2;
var chDimXValues = 4;
var chDimYValues = 4;


chart.Charts.Add();

chart.ChartType = xlLineMarkers;
chart.DataSource = excel;//.Range("A1:B12");
var s = chart.Charts(0).SeriesCollection;

var data_series = s.Add();
data_series.caption = 'Monkey'.

data_series.SetData(4, 0, "A1:A12");
data_series.SetData(3, 0, "B1:B12");


return false;
}

function l() {

excel.DisplayToolbar = false;

excel.range('a1:a12').select();
excel.Selection.NumberFormat = 'mmm-yy';

excel.range('a1' ).value = 'Jan-2004'
excel.range('a2' ).value = 'Feb-2004'
excel.range('a3' ).value = 'Mar-2004'
excel.range('a4' ).value = 'Apr-2004'
excel.range('a5' ).value = 'May-2004'
excel.range('a6' ).value = 'Jun-2004'
excel.range('a7' ).value = 'Jul-2004'
excel.range('a8' ).value = 'Aug-2004'
excel.range('a9' ).value = 'Sep-2004'
excel.range('a10').value = 'Oct-2004'
excel.range('a11').value = 'Nov-2004'
excel.range('a12').value = 'Dec-2004'

excel.range('b1' ).value = 10
excel.range('b2' ).value = 15
excel.range('b3' ).value = 18
excel.range('b4' ).value = 17
excel.range('b5' ).value = 20
excel.range('b6' ).value = 23
excel.range('b7' ).value = 22
excel.range('b8' ).value = 24
excel.range('b9' ).value = 27
excel.range('b10').value = 27
excel.range('b11').value = 29
excel.range('b12').value = 32
}
</script>

<body önLoad='l();'>

<form>
<input type=submit önclick='return create_chart()' value='Create Chart'>
</form>


<object
id = excel
classid = 'clsid:0002E551-0000-0000-C000-000000000046'
name=excel>




</object>

<object id= chart classid='clsid:0002E556-0000-0000-C000-000000000046'
style="width:100%;height:350"></object>

</body>
</html>



Any pointers would of great help. and I have been trying hard, so please
help. If it is an issue with Javascript then we can go for Vb scripting.
 
A

Alvin Bruney [MVP]

I haven't looked at your code but the easiest way to get the scatter chart
working is to build a regular chart, make sure that is working and then
change type to scatter. Once you get that work, you can work backward from
there to figure out what is wrong with your original code.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
https://www.microsoft.com/MSPress/books/10933.aspx
OWC Black Book www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top