This is a migrated thread and some comments may be shown as answers.

ClientSeriesClicked Event in Q2 2012 SP1

7 Answers 96 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Roy Gelerman
Top achievements
Rank 1
Roy Gelerman asked on 24 Jul 2012, 09:58 PM

Hello

The click event seems to not be as useful as it could be because it does not allow for a "hidden data field".  For example, suppose I have a bar chart showing billionaires by net worth.  Name on the axis, the bar value is net worth.  If I do an Ajax callback or a popup window to another URL in the click event, I need to lookup the billionaire based on their name on the server- which could be tricky if there are billionaires with the same name, so perhaps I then lookup on a combination of net worth and name, which is still an imprecise solution.   Think of the imprecision of passing javascript numbers and persons/family names  (containing spaces, periods or ampersands) as URL parameters to do a lookup.  I would much prefer to have a hidden bound field say HiddenDataField="BillionaireID" in the BarSeries element that I can access in the javascript arguments.  Then I can lookup the correct individual precisely

i.e.

<telerik:BarSeries DataField="NetWorth" HiddenDataField="BillionaireID"/>
<XAxis DataLabelsField="FullName" >

a simple redirect based on the click would roughly be

 

function RadHtmlChart1_SeriesClicked(sender,args)

{
    window.location="billionaire.aspx?id=" + args._hidden;

}


Please let me know if I am missing something that would make the above easier to implement

7 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 26 Jul 2012, 01:08 PM
Hi Roy,

If I understand you correctly you would like to have one hidden value for the entire series. Is this correct or are you referring to an arbitrary value for each series item? I am asking this to get the concept clearer in order to see how / if it can be integrated in the context of a data visualization control like the RadHtmlChart.

The RadToolTipManager has similar functionality - each target control can have an arbitrary string assosiated in order to facilitate the server data load (you can see it in action in this demo, for example). Is this concept similar to what you want to achieve?


All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Roy Gelerman
Top achievements
Rank 1
answered on 07 Sep 2012, 07:55 PM

Hello Marin,

Sorry for the long delay, but yes a string ID would work fine as that can handle numbers, GUIDs or strings.  To clarify, if I had a simple database table like this (data from forbes.com)

BillionaireID Name     NetWorth
------------- ----     -----
21  Carlos Slim Helu & family  69.0
32  Bill Gates    61.0
221  Christy Walton & family   25.3
189  Prince Alwaleed Bin Talal Alsaud 18.0

If I want to go to page with a biography when the user clicks on the "Carlos Slim Helu & family" bar, I'd have to hope the name is unique and possibly deal with URL escaping etc (the ampersand in the name in this case).  I'd much rather have the row ID as a 'hidden' field that is passed in to the client side click event and then use the 21 as the parameter I pass to another URL. 

function RadHtmlChart1_SeriesClicked(sender,args)

{
     window.location="biography.aspx?id=" + args._hidden; //  biography.aspx?id=21

}
0
Marin Bratanov
Telerik team
answered on 11 Sep 2012, 10:34 AM
Hi Roy,

I am sorry to say that currently such a field is not in our immediate plans, yet I have logged the concept in our internal database and we will consider its impact. We will probably expose the dataItem for the clicked series item in the event so that you will be able to access all columns from the datasource you have given the chart. I am not able to provide any time estimate on this, however, because the tasks for the Q3 2012 release have already been set and planned.


Kind regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
David Moore
Top achievements
Rank 1
answered on 21 Jan 2014, 07:17 PM
Has anything new happened on this?  This seems like pretty basic functionality that should be included with something like this.  I would hate to have go back to google charts.
0
Danail Vasilev
Telerik team
answered on 23 Jan 2014, 01:42 PM
Hi David,

The dataItem object has already been exposed by the HtmlChart, so that additional fields from the data source can be accessed either from the eventArgs of the clicked/hovered series or through the template of labels/tooltips.

Such an examples can be found in OnClientSeriesClicked and ClientTemplate for Series Labels and Tooltips help articles.

Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Anil
Top achievements
Rank 1
answered on 23 Dec 2015, 10:00 PM

I am in similar situation.

I have Project name and ProjectID. I use stacked column chart with 3 series.

When I click on series 1 in column stack of proejct1, I need to pass ProjectID instead of name to server side.

I checked dataitem, but I could not get anything from there.

Any help is appreciated.

Thanks,

Anil

0
Plamen
Telerik team
answered on 25 Dec 2015, 02:04 PM
Hi,

I have attached a sample where similar scenario is implemented.

Hope this will help you solve the issue.

Regards,
Plamen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart (HTML5)
Asked by
Roy Gelerman
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Roy Gelerman
Top achievements
Rank 1
David Moore
Top achievements
Rank 1
Danail Vasilev
Telerik team
Anil
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or