vendredi 4 janvier 2019

Unable to return selected slice label text from google visualization pie chart

Here I'm using 'google visualization pie chart' in my Laravel - js project. With chart options 'pieSliceText' :'label' to display 'label text' on the 'pie slice'. After that I used a listener for 'selected slice' to generate another pie chart. Unfortunately some slices are too small to view the 'label text', then listener returns null or 'label text' displayed another slice. Below is my code.

chart.blade

var data = google.visualization.arrayToDataTable(chart_values);

var options = {'width':650, 'height':525, 'pieSliceText' :'label','fontSize': '11', 'chartArea' : {'width': 650, 'height': 525}, };

var chart = new 

google.visualization.PieChart(document.getElementById('chartId'));  

    google.visualization.events.addListener(chart, 'select', function()
    {
    var catDecs = this.getSelection().focusNode.data; // used to get selected slice label text

    getCatCode(catDecs); // used to get the code of the selected item

    });


chart.draw(data, options);

Please help me to solve this issue.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire