Add Interval on "blank space" or outside chart

21 views
Skip to first unread message

Luis Henrique Uchida Ishivatari

unread,
Feb 6, 2017, 9:24:34 AM2/6/17
to Google Visualization API
Hello,

Is there a way to put an Interval data without data from a line chart? Or put this Interval outside the chart? (A poorly drawn example below)

Sample code I'm using:

<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
   
<script>
    google.charts.load('current', {'packages':['corechart']});
    google.charts.setOnLoadCallback(drawBasic);

    function drawBasic() {

       var data = new google.visualization.DataTable();
       data.addColumn('string', 'Month'); // Implicit domain column.
       data.addColumn('number', 'Sales'); // Implicit data column.
       data.addColumn({type:'number', role:'interval'});
       data.addColumn({type:'number', role:'interval'});
       data.addColumn({type:'number', role:'interval'});
       data.addColumn('number', 'Expenses');
       data.addRows([
         ['April', 1000,  900, 1000, 1100,  400],
         ['May'  , 1170, 1000, 1170, 1200,  460],
         ['June' , 660 ,  550, 660 , 800 , 1120],
         ['July' , 1030,  950, 1030, 1080,  540],
 [''     , null, 1010, 1070, 850 , null] //this interval doesn't show, unless I add a value for 'Sales' column
       ]);

       var chart = new google.visualization.LineChart(
                document.getElementById('visualization'));
       chart.draw(data,
          {width: 800, height: 600, title: 'Company Performance'});    

    }
  </script>
</head>
<body>
  <div id="visualization"></div>
</body>
</html>


























Daniel LaLiberte

unread,
Feb 6, 2017, 9:58:43 AM2/6/17
to Google Visualization API
Intervals must be associated with data, but you can make the data invisible by using a 'style' role and setting the color to none.

--
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+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/6f22f3ff-2698-4e9c-a5ca-9fe9ce853402%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages