I am trying to add an attribute that links to a javascript onClick event, however:
myChart.Attributes.Add("onClick", "javascript:myFunc();")
does not seem to work correctly. Can anyone give me a quick overview of how I'd go about making the entire chart clickable. I'm looked through the help file, but haven't had much luck.
Thanks in advance.
Make the entire chart clickable. (how?)
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Maxeta,
If you are using TeeChart for .NET in a WebForms application you could implement your code in WebChart's ClickBackground event.
If you are using TeeChart for .NET in a WebForms application you could implement your code in WebChart's ClickBackground event.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Wouldn't that require a postback? I'm actually interested in providing a popup window once the chart is clicked, without a full reload of tha page, which inturn would require a javascript call.
I was reading something about an MapAction feature in TeeChart, but I've yet to fully understand how it works for scripts. And I couldn't seem to find a decent tutorial in the help file. Can anyone give me a quick run-through.
I was reading something about an MapAction feature in TeeChart, but I've yet to fully understand how it works for scripts. And I couldn't seem to find a decent tutorial in the help file. Can anyone give me a quick run-through.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Maxeta,
To achieve that you'll need to edit WebChart's attributes collections doing:
To achieve that you'll need to edit WebChart's attributes collections doing:
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
string style = "position: relative";
string onclick = "javascript:alert('hello world')\" ";
WebChart1.Attributes.Clear();
WebChart1.Attributes.Add("onclick", onclick);
WebChart1.Attributes.Add("Style", style);
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Thanks.
I didn't realize that the extra literal quote was necessary at the end of the attribute. With that inplace everything seems to be working as expected.
Code: Select all
string onclick = "javascript:alert('hello world')\" ";
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Maxeta,
Yes, it is a little bit tricky but otherwise attributes are not properly added.
Yes, it is a little bit tricky but otherwise attributes are not properly added.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |