User (Legacy) Posted September 23, 2003 Report Share Posted September 23, 2003 Hi, I need an example or an explanation on how to control a chart attribute using JavaScript. I don't think the way I want to do it is the same as in the documentation (adding a custom button to the toolbar and then handling the event in JavaScript). Instead, I'm creating my own html button that will run a JavaScript function will clicked. I've tried something like this: function showHideSeries(buttonIndex) { profile.Chart.series(buttonIndex).visible=dataButtonsPressed[buttonIndex]; dataButtonsPressed[buttonIndex] = !dataButtonsPressed[buttonIndex]; }//showHideSeries I have my onClick attribute for my button call this method, which I want to show or hide a series in the chart. 'profile' is the name of my form, and 'Chart' is my char'ts id. 'dataButtonsPressed' is an array of booleans that keeps track of what buttons are pressed. Perhaps my way cannot be done, and I have to add my buttons to the toolbar. I'd really like to be able to do it this way though, but I don't know how.... Please help. -Sean Link to comment Share on other sites More sharing options...
Software FX Posted September 26, 2003 Report Share Posted September 26, 2003 For array properties such as Series JavaScript requires that you specify the Item as follows: <script language="JavaScript" type="text/JavaScript"> <!-- function MyFunc() { Chart1.Series.Item(0).Visible = false; } --> </script> <input type="button" name="button1" value="button" Onclick="javascript:MyFunc();"/> This applies to all array properties (indexers) which in C# would be access simply using []. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted September 26, 2003 Author Report Share Posted September 26, 2003 Thanks for the reply, however I'm getting the javascript error: profile.Chart.Series is null or not an object when I try using profile.Chart.Series.Item(index).Visible. Any ideas what I could be doing wrong? I've verified that 'Chart' is indeed the id of my chart object on the page. Thanks, -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:0pmc5rGhDHA.3600@WEBSERVER1... > For array properties such as Series JavaScript requires that you specify the > Item as follows: > > <script language="JavaScript" type="text/JavaScript"> > <!-- > function MyFunc() { > Chart1.Series.Item(0).Visible = false; > } > --> > </script> > > <input type="button" name="button1" value="button" > Onclick="javascript:MyFunc();"/> > > > This applies to all array properties (indexers) which in C# would be access > simply using []. > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted September 26, 2003 Author Report Share Posted September 26, 2003 If it helps, I displayed the value of profile.Chart and profile.Chart.Series using alert() and got the following: profile.Chart.Series: undefined profile.Chart: SoftwareFX.ChartFX.Internet.MainClient -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:0pmc5rGhDHA.3600@WEBSERVER1... > For array properties such as Series JavaScript requires that you specify the > Item as follows: > > <script language="JavaScript" type="text/JavaScript"> > <!-- > function MyFunc() { > Chart1.Series.Item(0).Visible = false; > } > --> > </script> > > <input type="button" name="button1" value="button" > Onclick="javascript:MyFunc();"/> > > > This applies to all array properties (indexers) which in C# would be access > simply using []. > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted September 26, 2003 Author Report Share Posted September 26, 2003 I noticed in your code on support article Q6121035, that you set the MainClient field of the Chart to false. I tried this on my chart, and my buttons work now!! Can I get an explanation as to why this is? ie. why javascript works with MainClient=false, and not work when MainClient=true. Thanks for the help, -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:0pmc5rGhDHA.3600@WEBSERVER1... > For array properties such as Series JavaScript requires that you specify the > Item as follows: > > <script language="JavaScript" type="text/JavaScript"> > <!-- > function MyFunc() { > Chart1.Series.Item(0).Visible = false; > } > --> > </script> > > <input type="button" name="button1" value="button" > Onclick="javascript:MyFunc();"/> > > > This applies to all array properties (indexers) which in C# would be access > simply using []. > -- > FP > Software FX, Inc. > > Link to comment Share on other sites More sharing options...
Software FX Posted September 26, 2003 Report Share Posted September 26, 2003 When using mainclient (which speeds up download of the client control) the page that gets generated will in fact create a MainClient control, this placeholder control will download (if needed) and host the ChartFX assemblies. If you want to use MainClient (because of the perf improvements) you will have to do something like Chart1.Chart.Series.Item(0).Visible = ... Note that MainClient supports a Chart property that returns the "real" chart object. -- Regards, JC Software FX Support "Sean Hyrich" <shyrich@hydro.mb.ca> wrote in message news:nhrSCLHhDHA.3600@WEBSERVER1... > I noticed in your code on support article Q6121035, that you set the > MainClient field of the Chart to false. I tried this on my chart, and my > buttons work now!! Can I get an explanation as to why this is? ie. why > javascript works with MainClient=false, and not work when MainClient=true. > > Thanks for the help, > -Sean > > > "SoftwareFX Support" <support@softwarefx.com> wrote in message > news:0pmc5rGhDHA.3600@WEBSERVER1... > > For array properties such as Series JavaScript requires that you specify > the > > Item as follows: > > > > <script language="JavaScript" type="text/JavaScript"> > > <!-- > > function MyFunc() { > > Chart1.Series.Item(0).Visible = false; > > } > > --> > > </script> > > > > <input type="button" name="button1" value="button" > > Onclick="javascript:MyFunc();"/> > > > > > > This applies to all array properties (indexers) which in C# would be > access > > simply using []. > > -- > > FP > > Software FX, Inc. > > > > > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 1, 2003 Author Report Share Posted October 1, 2003 Umm, I'm sort having the same kind of problem again, but I'm not sure how I managed to wreck my program. For the following piece of JavaScript code: function showHideSeries (seriesIndex) { profile.Chart.Chart1.Series.Index(seriesIndex).Visible = !profile.Chart.Chart1.Series.Index(seriesIndex).Visible; }//showHideSeries with MainClient set to true, I get the error "profile.Chart.Chart1.Series is null or not an object". AND, if I turn MainClient off (set it to false) and use the following code: function showHideSeries (seriesIndex) { profile.Chart.Series.Index(seriesIndex).Visible = !profile.Chart.Series.Index(seriesIndex).Visible; }//showHideSeries I get the error "profile.Chart.Series is null or not on object" (ie, same error) So would you happen to know what's wrong with my Series object or what I could possibly be doing wrong to have caused this? Thanks in advance. -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:IYhqDoHhDHA.3600@WEBSERVER1... > When using mainclient (which speeds up download of the client control) the > page that gets generated will in fact create a MainClient control, this > placeholder control will download (if needed) and host the ChartFX > assemblies. > > If you want to use MainClient (because of the perf improvements) you will > have to do something like > > Chart1.Chart.Series.Item(0).Visible = ... > > Note that MainClient supports a Chart property that returns the "real" chart > object. > > -- > Regards, > > JC > Software FX Support > "Sean Hyrich" <shyrich@hydro.mb.ca> wrote in message > news:nhrSCLHhDHA.3600@WEBSERVER1... > > I noticed in your code on support article Q6121035, that you set the > > MainClient field of the Chart to false. I tried this on my chart, and my > > buttons work now!! Can I get an explanation as to why this is? ie. why > > javascript works with MainClient=false, and not work when MainClient=true. > > > > Thanks for the help, > > -Sean > > > > > > "SoftwareFX Support" <support@softwarefx.com> wrote in message > > news:0pmc5rGhDHA.3600@WEBSERVER1... > > > For array properties such as Series JavaScript requires that you specify > > the > > > Item as follows: > > > > > > <script language="JavaScript" type="text/JavaScript"> > > > <!-- > > > function MyFunc() { > > > Chart1.Series.Item(0).Visible = false; > > > } > > > --> > > > </script> > > > > > > <input type="button" name="button1" value="button" > > > Onclick="javascript:MyFunc();"/> > > > > > > > > > This applies to all array properties (indexers) which in C# would be > > access > > > simply using []. > > > -- > > > FP > > > Software FX, Inc. > > > > > > > > > > > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 1, 2003 Author Report Share Posted October 1, 2003 Weird, if I do the following in my showHideSeries funtion: alert("profile.Chart.Series.Count = " + profile.Chart.Series.Count); it actually displays the correct number of Series, so it's not totally the Series object that's the problem, for some reason I can't use the Index property to grab a specific Series.... -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:IYhqDoHhDHA.3600@WEBSERVER1... > When using mainclient (which speeds up download of the client control) the > page that gets generated will in fact create a MainClient control, this > placeholder control will download (if needed) and host the ChartFX > assemblies. > > If you want to use MainClient (because of the perf improvements) you will > have to do something like > > Chart1.Chart.Series.Item(0).Visible = ... > > Note that MainClient supports a Chart property that returns the "real" chart > object. > > -- > Regards, > > JC > Software FX Support > "Sean Hyrich" <shyrich@hydro.mb.ca> wrote in message > news:nhrSCLHhDHA.3600@WEBSERVER1... > > I noticed in your code on support article Q6121035, that you set the > > MainClient field of the Chart to false. I tried this on my chart, and my > > buttons work now!! Can I get an explanation as to why this is? ie. why > > javascript works with MainClient=false, and not work when MainClient=true. > > > > Thanks for the help, > > -Sean > > > > > > "SoftwareFX Support" <support@softwarefx.com> wrote in message > > news:0pmc5rGhDHA.3600@WEBSERVER1... > > > For array properties such as Series JavaScript requires that you specify > > the > > > Item as follows: > > > > > > <script language="JavaScript" type="text/JavaScript"> > > > <!-- > > > function MyFunc() { > > > Chart1.Series.Item(0).Visible = false; > > > } > > > --> > > > </script> > > > > > > <input type="button" name="button1" value="button" > > > Onclick="javascript:MyFunc();"/> > > > > > > > > > This applies to all array properties (indexers) which in C# would be > > access > > > simply using []. > > > -- > > > FP > > > Software FX, Inc. > > > > > > > > > > > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted October 1, 2003 Author Report Share Posted October 1, 2003 *sigh*, boy am I having a bad day.... Never mind my two previous posts. I had accidentally changed Chart.Series.Item(index) to Chart.Series.Index(index).... Sorry for any inconvenience. -Sean "SoftwareFX Support" <support@softwarefx.com> wrote in message news:IYhqDoHhDHA.3600@WEBSERVER1... > When using mainclient (which speeds up download of the client control) the > page that gets generated will in fact create a MainClient control, this > placeholder control will download (if needed) and host the ChartFX > assemblies. > > If you want to use MainClient (because of the perf improvements) you will > have to do something like > > Chart1.Chart.Series.Item(0).Visible = ... > > Note that MainClient supports a Chart property that returns the "real" chart > object. > > -- > Regards, > > JC > Software FX Support > "Sean Hyrich" <shyrich@hydro.mb.ca> wrote in message > news:nhrSCLHhDHA.3600@WEBSERVER1... > > I noticed in your code on support article Q6121035, that you set the > > MainClient field of the Chart to false. I tried this on my chart, and my > > buttons work now!! Can I get an explanation as to why this is? ie. why > > javascript works with MainClient=false, and not work when MainClient=true. > > > > Thanks for the help, > > -Sean > > > > > > "SoftwareFX Support" <support@softwarefx.com> wrote in message > > news:0pmc5rGhDHA.3600@WEBSERVER1... > > > For array properties such as Series JavaScript requires that you specify > > the > > > Item as follows: > > > > > > <script language="JavaScript" type="text/JavaScript"> > > > <!-- > > > function MyFunc() { > > > Chart1.Series.Item(0).Visible = false; > > > } > > > --> > > > </script> > > > > > > <input type="button" name="button1" value="button" > > > Onclick="javascript:MyFunc();"/> > > > > > > > > > This applies to all array properties (indexers) which in C# would be > > access > > > simply using []. > > > -- > > > FP > > > Software FX, Inc. > > > > > > > > > > > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.