Search code examples
javascriptgoogle-visualization

Looking to remove the value of google pie chart on hover


var data = new google.visualization.DataTable();
    data.addColumn('string', 'Topping');
    data.addColumn('number', 'Slices');
    data.addRows([
      ['Male', 51],
      ['Female', 49],
    ]);

    // Set options for Sarah's pie chart.
    var options = {title:"",
                   width:600,
                   height:400,
                   is3D: true};

Above is my code. I'm looking to remove the value on the hover but keep the percentages in the pie chart. So on my chart it says Male: 51(51%) Female: 49(49%). It won't let me attach a picture since I'm fairly new so I apologize for that as well.


Solution

  • Just add one more configuration tooltip in options object:

    var options = {
        title:"",
        width:600,
        height:400,
        tooltip: {
            text: 'percentage'
        },
        is3D: true
    };
    

    Here is demo : https://jsfiddle.net/fs6tc5nq/1/