I think your best bet is to use a DataView to calculate this for you:

var view = new google.visualization.DataView(data);
view.setColumns([0, {
    type: 'number',
    label: 'whatever you want to call this',
    calc: function (dt, row) {
        var sum = 0;
        for (var i = 1; i < dt.getNumberOfColumns(); i++) {
            sum += dt.getValue(row, i);
        }
        return sum;
    }
}, {
    type: 'string',
    role: 'tooltip',
    properties: {
        html: true
    },
    calc: function (dt, row) {
        var tooltip = '<div class="customTooltip"><ul>';
        for (var i = 0; i < dt.getNumberOfColumns(); i++) {
            tooltip += '<li>' + dt.getColumnLabel(i) + ': ' + 
dt.getValue(row, i) + '</li>';
        }
        tooltip += '</ul></div>';
        return tooltip;
    }
}]);

Set the tooltip.isHtml option to true, and draw the chart using the 
DataView:

var options = {
    // existing options...
    tooltip: {
        isHtml: true
    }
};
chart.draw(view, options);

You can style the tooltip by setting classes on the tooltip elements and 
using CSS.

On Monday, September 8, 2014 3:25:39 AM UTC-4, Alexandre Carrie wrote:
>
> Ok thanks. But I send directly an array I filled before, so when do I must 
> inform that the tooltip is in HTML?
>
> Actually my code is like this :
> For the chart's options :
>
> <https://lh4.googleusercontent.com/-nKlHHet2euU/VA1Zn1RrJxI/AAAAAAAAADM/NaKIriZ9c7g/s1600/code.PNG>
> And the data I send :
>
> <https://lh4.googleusercontent.com/-B37ufp-Z5Do/VA1Z5sGsYZI/AAAAAAAAADU/X46hOx8yW0U/s1600/data.PNG>
>
> Thanks.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to