divyesh29 Posted July 2, 2009 Report Share Posted July 2, 2009 Hi 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?? Thanks, Divyesh Mcube Quote Link to comment Share on other sites More sharing options...
juanZ Posted July 2, 2009 Report Share Posted July 2, 2009 Hi Divyesh Create a new asp.net project, add a new page and copy replace the html code with this code. PAGE LOAD 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"; ASPX CODE <html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><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) + ' ' + chx.AxisX.Labels.Item(5));}</script><body> <form id="form1" runat="server"> <div> <chartfx7:Chart ID="Chart1" runat="server" RenderFormat=".Net" UseCallbacksForEvents="true"> </chartfx7:Chart> </div> <div> <br /> <input id="Button1" type="button" value="Show Axis Label" onclick="ShowFirstLabel();" /> </div> </form></body></html> Quote Link to comment Share on other sites More sharing options...
divyesh29 Posted July 3, 2009 Author Report Share Posted July 3, 2009 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??? Thanks, Divyesh Mcube. Quote Link to comment Share on other sites More sharing options...
juanZ Posted July 7, 2009 Report Share Posted July 7, 2009 Which version of IE are you using? Quote Link to comment Share on other sites More sharing options...
divyesh29 Posted July 8, 2009 Author Report Share Posted July 8, 2009 Hi juanZ, i am using IE-7, i have tried same thing in IE-8 also but same problem. Which version of IE is compatible with ChartFX-7? Thanks, Divyesh Mcube. Quote Link to comment Share on other sites More sharing options...
juanZ Posted July 8, 2009 Report Share Posted July 8, 2009 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. Quote Link to comment Share on other sites More sharing options...
divyesh29 Posted July 13, 2009 Author Report Share Posted July 13, 2009 Hi juanZ, u can post that sample here, i can open .rar compressed file. it would be great help.. Thanks, Divyesh Mcube. Quote Link to comment Share on other sites More sharing options...
juanZ Posted July 24, 2009 Report Share Posted July 24, 2009 Hi, Divyesh I Attached the requested code. I removed from bin folder the ChartFX.Webforms.dll because the zip file was to heavy to upload. So, please open the sample and add the reference. Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.