This hack works until Google changes the api in the future. It also works until you use the experimental "explorer" option. If you use scaling, then the chart is re-displayed on each mouse event and your values disappear. It is very sad that the api diagram does not subject to scaling or re-mapping of events. There is only a “ready-made” event that fires only once after drawing a graph. Also, I noticed that I can’t expect yAxis values to be displayed when I provided their api. If the api decides that these lines are too long, it displays only the substring using the tooltip.
So, there is only one clumsy and one real workaround that I could come up with. I left awkward because it matches previous posts
var chartDiv = document.getElementById ("chart"); chartDiv .addEventListener ("mousewheel", ProcessChart, false); //take care of "mousewheel" event browser compatibility!!! function ProcessChart() { setTimeout(function() { $("#chart svg text[text-anchor='end']:contains('$C$')").each(function() { var $this = $(this); var val = parseInt($this.text()); var label = GetCommunicationLabel(val); $this.text(label); }); }, 20); }
Note that I used the setTimeout function to handle shortcuts. The chart is also displayed on the mousewheel event and without delay you are trying to process tags that do not yet exist. 20 milliseconds is just an experimental value, and it depends on how long your graph will be re-displayed on the mouse event. Unfortunately, the user may detect blinking when replacing old values.
Finally, I found a real solution.
vAxes: { 0: { format: '#%', ticks: [0, 0.25, 0.5, 0.75, 1] //minValue: 0, //maxValue: 1, //title: batteryText, }, 1: { ticks: [ { v: 0, f: GetCommunicationLabel(0) }, { v: 1, f: GetCommunicationLabel(1) }, { v: 2, f: GetCommunicationLabel(2) }, { v: 3, f: GetCommunicationLabel(3) }, { v: 4, f: GetCommunicationLabel(4) }], // format: "#", textPosition: 'out' //minValue: 0, //maxValue: 3, //title: communicationText, } },