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

Pie chart tooltip with data besides category or value

1 Answer 352 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 29 Jul 2015, 04:32 PM

I have a pie chart and I want to display text besides the category or value in the tooltip.  I have the data I want to display in the json that is set to the pie chart. 

 

My current code is:

$('.kendo-pie').each(function () {
                $(this).kendoChart({
                    title: false,
                    theme: 'bootstrap',
                    legend: {
                        position: "top",
                        visible: true
                    },
                    chartArea: {
                        background: ""
                    },
                    seriesDefaults: {
                        labels: {
                            visible: true,
                            background: "transparent",
                            template: "#= value#%",
                            position: "center"
                            //margin: -10
                        }
                    },
                    chartArea: {
                        height: 295,
                        width: 220
                    },
                    series: [{
                        type: "pie",
                        //startAngle: 150,
                        padding: 10,
                        data: pieLocationData
                    }],
                    tooltip: {
                        visible: true,
                        template: "#= category#",
                        format: "{0}"
                    }
                });

            });

 

 

For the template instead of using category‚Äč I want to use 'customTooltipText' which is a JSON value in the pieLocationData collection.

1 Answer, 1 is accepted

Sort by
0
Plamen Lazarov
Telerik team
answered on 31 Jul 2015, 01:36 PM

Hello Kevin,

In this case you can set the tooltip.template as a function instead of string. For convenience I prepared a basic example which illustrates this approach. 

Regards,
Plamen Lazarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Kevin
Top achievements
Rank 1
Answers by
Plamen Lazarov
Telerik team
Share this question
or