Using Google annotated annotation in the visualization API, can you insert annotations regardless of the dataset?

I can embed annotations on specific datasets on a graph, but I want to have several lines on the graph without associating the annotation with a specific row, but with a date.

Here is an example of what I want to do. Pay attention to the bubbles added to the x axis, and not to a specific line in the graph.

I read the API and don’t see such an option, but I wonder if anyone knows a way.

Thanks.

+5
source share
2 answers

, , , , ?

0

SVG , . "", X, ( ) - . :

function drawVisualization() {
  // Create and populate the data table.
  var data = new google.visualization.DataTable();
  data.addColumn('number','Day');
  data.addColumn({type: 'string', role: 'annotation'});
  data.addColumn({type: 'string', role: 'annotationText'});
  data.addColumn('number', '.DJI');
  data.addColumn('number', '.INX');
  data.addColumn('number', '.INIC');
  data.addRows([
    [1, null, null, 1000, 400, 300],
    [2, 'A', 'did stuff', 1170, 460, 400],
    [3, 'B', 'did more stuff', 660, 1120, 540],
    [4, null, null, 1030, 540, 620],
    [5, 'C', 'stopped stuff', 1070, 600, 700]
  ]);

  // Create and draw the visualization.
  new google.visualization.LineChart(document.getElementById('visualization')).
    draw(data, {focusTarget: 'category',
                  width: 500, height: 400,
                  vAxis: {maxValue: 10},}
          );
}

:

enter image description here

0

All Articles