Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 13th, 2007, 05:05 AM
Registered User
 
Join Date: Jun 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default scatter XY chart using Script

Dear all,
I have tried to create a scatter chart using Javascript and Microsoft OWC. For some reason, this one fails. This does work for column charts . Can you pleae advise on this?

Is there an alternate in VB Script that will help?


<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 onLoad='l();'>

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



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



 <param name=DisplayTitleBar value=false >
 <param name=ViewableRange value='a1:b12'>
 <param name=AutoFit value=true >
</object>

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

</body>
</html>

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Scatter Chart Programatically Odeh Naber Access VBA 2 February 12th, 2008 08:50 AM
Scatter chart using Java script madganesh Javascript How-To 1 June 17th, 2007 06:48 AM
scatter plot using OWC10 mithil Classic ASP Professional 0 June 26th, 2006 04:59 AM
Using Customized chart for Pivot Chart kliu9 Excel VBA 3 October 13th, 2004 09:37 AM
Transfer of values from an object to an XY chart locusiste Excel VBA 0 April 23rd, 2004 05:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.