Make the entire chart clickable. (how?)

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Maxeta
Newbie
Newbie
Posts: 7
Joined: Fri Apr 07, 2006 12:00 am

Make the entire chart clickable. (how?)

Post by Maxeta » Mon May 15, 2006 8:30 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue May 16, 2006 10:50 am

Hi Maxeta,

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Maxeta
Newbie
Newbie
Posts: 7
Joined: Fri Apr 07, 2006 12:00 am

Post by Maxeta » Tue May 16, 2006 12:40 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 17, 2006 11:58 am

Hi Maxeta,

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Maxeta
Newbie
Newbie
Posts: 7
Joined: Fri Apr 07, 2006 12:00 am

Post by Maxeta » Wed May 17, 2006 1:08 pm

Thanks.

Code: Select all

    string onclick = "javascript:alert('hello world')\" ";
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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed May 17, 2006 1:12 pm

Hi Maxeta,

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
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply