Jump to content
Software FX Community

How to access chart control from java script function?


Recommended Posts


i want to access chart control from java script, how to do that???

i have writen following java script function

function SetChart()



alert("in set chart");

chart = document.getElementById("departmentExpenceChart");if(chart.Chart)

chart = chart.Chart;

chart.View3D.Enabled = !chart.View3D.Enabled;


i am calling this function from button click, alert message is coming but after that error comes saying "Class doesn't support Automation".

am i doing any thing wrong!!  i am rendering chart as .NET.

i also want to know if we can access chart from java script then what all properties or methods we can access and how?

ex. Can we call RecalculateScale method from javascript??




Link to comment
Share on other sites

 Hi Divyesh

Create a new asp.net project, add a new page and copy replace the html code with this code.


Chart1.Data.Series = 1;
  Chart1.Data.Points = 6;
  Random r = new Random(1);
  int i;
  for (i = 0; i < 6; i++)
  Chart1.Data[0, i] = 100 * r.NextDouble();
  Chart1.AxisX.Labels[0] = "1st";
  Chart1.AxisX.Labels[1] = "2nd";
  Chart1.AxisX.Labels[2] = "3rd";
  Chart1.AxisX.Labels[3] = "4th";
  Chart1.AxisX.Labels[4] = "5th";
  Chart1.AxisX.Labels[5] = "6th";



<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>Untitled Page</title>
<script language="javascript" type="text/javascript">

function ShowFirstLabel(){
    var chx = document.getElementById("Chart1");
  var lbl = document.getElementById("Label1");
  chx.view3d.enabled = true;
  alert(chx.AxisX.Labels.Item(0) + ' ' +
  chx.AxisX.Labels.Item(1) + ' ' +
  chx.AxisX.Labels.Item(2) + ' ' +
  chx.AxisX.Labels.Item(3) + ' ' +
  chx.AxisX.Labels.Item(4) + ' ' +
  <form id="form1" runat="server">
  <chartfx7:Chart ID="Chart1" runat="server" RenderFormat=".Net" UseCallbacksForEvents="true">
  <br />
  <input id="Button1" type="button" value="Show Axis Label" onclick="ShowFirstLabel();" />

Link to comment
Share on other sites

Hi juanZ,

 Thanks for reply.

i tried as you mentioned, i created new project and pasted your code.

when i run the project same error (Class doesn't support Automation) is coming in javascript function (ShowFirstLable) at 3rd statement(chx.view3d.enabled = true;).

are there any more settings need to be done???




Link to comment
Share on other sites

 Hi Divyesh,

Chart FX 7 is compatible with IE versions  6, 7, 8. I have the sample working with IE8. So, you can send me an email to support at softwarefx.com and I will forward this sample to you. Or, if you can open .rar compressed files, I can post the sample here (is about 1.90mb in rar format and about 2.06Mb with zip format, the limit is 2Mb so I cant post it here as a zip file).

please let me know the best option for you and I'll be more than glad to send you the sample project.


Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...