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

Drilldown chart: how to get non-charted data

1 Answer 64 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Tomica
Top achievements
Rank 2
Tomica asked on 01 Oct 2015, 04:54 PM

    With RadGrid I frequently use a SQL data source which returns data columns with "display=false" so that I can use a value for inclusion in a templated column. Typically this is for purposes of building a hyperlink with a client-friendly display value, but with a database code for the querystring.

 "<a href='whatever.aspx?id=category_code>category_name</a>

When using HTML Pie Chart, I know how to retrieve the values of "DataFieldY" and "Name_Field".

The "NameField" is my "category_name" but when clicked, I really want "category_code", i.e. a value known to the underlying data source but not displayed on the chart itself.

Any suggestions on a potential solution?

Note that I could do I reverse lookup back into the database, but there are cases where we trim long  "Name_Field" values to avoid messing up chart presentation.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 02 Oct 2015, 05:56 AM

Hello,

You can use the OnSeriesClick event to get the dataItem from the clicked item: http://docs.telerik.com/KENDO-UI/api/javascript/dataviz/ui/chart#events-seriesClick (see the e.dataItem array).

Here is a basic example:

<telerik:RadHtmlChart ID="RadHtmlChart1" runat="server">
    <ClientEvents OnSeriesClick="alertData" />
    <PlotArea>
        <Series>
            <telerik:BarSeries DataFieldY="someField">
            </telerik:BarSeries>
        </Series>
    </PlotArea>
</telerik:RadHtmlChart>
<script>
    function alertData(e) {
        alert(e.dataItem['anotherField']);
    }
</script>


Regards,

Marin Bratanov
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
Tomica
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Share this question
or