Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show value of Google column chart

I have a column chart using Google Visualization.

enter image description here

Right now, in order for me to see each value, I have to hover on each graph to see the value. Example, 2.82 kbps

I want to show all my value somewhere either on the top of each graph or inside the graph.

How can I show something like that ?

Any hints on that will be much appreciated !

like image 481
code-8 Avatar asked Aug 31 '25 22:08

code-8


1 Answers

You should look into annotations.

The column chart documentation has a cover of it here.

Either you add annotation columns to your DataTable, annotation for column 1 should be at the index right after, or you can create a view and stringify the source column.

view.setColumns([0, //The "descr column"
1, //Downlink column
{
    calc: "stringify",
    sourceColumn: 1, // Create an annotation column with source column "1"
    type: "string",
    role: "annotation"
}]);

The annotation is as standard for column charts placed at the top inside of the column.

Here is my play-around-fiddle

like image 144
Henrik Aronsson Avatar answered Sep 03 '25 12:09

Henrik Aronsson