Question

i get data for average time in seconds from google analytics, and i want display that data in piechart in minutes:seconds. Thank you for your answers

Was it helpful?

Solution

From pie chart Configuration Options there is no supported way for that.

Pie slice text/value is configured using option pieSliceText option and you can have none, percentage, value or name values.

For tooltip is similar: you can have both, value or percentage.

You can set your own legend with converted data from values to min:sec. How to do that is described in How to add Percentage and Total on the Legend of Google Pie Charts.

There is one completely unsupported possibility: to filter out DOM elements which contain values of your data using:

document.querySelectorAll('text[text-anchor=start]');

and than change value of element with converted value. But using that you will get at least one element which contains text and not data which should be converted. And this solution could break when google change DOM element attributes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top