Triple y-axis in combo charts

861 views
Skip to first unread message

Santosh Korada

unread,
Jun 2, 2016, 3:33:17 AM6/2/16
to Google Visualization API

 my name is santosh kumar.

i faced the problem while creating combo charts for three different graphs . i want y-axis for each graph.  i got one left y-axis and two right y-axes . two right y-axes are merged or overlapped . 

i have written the following code .

function drawVisualization() {
        // Some raw data (not necessarily accurate)
        var data = google.visualization.arrayToDataTable([
         ['Month', 'Bolivia', 'Ecuador', 'Madagascar'],
         ['2004/05',  165,      938,         522],
         ['2005/06',  135,      1120,        599],
         ['2006/07',  157,      1167,        587],
         ['2007/08',  139,      1110,        615],
         ['2008/09',  136,      691,         629]
      ]);      

    var options = {
      title : 'Monthly Coffee Production by Country',
      vAxes : {
       0:{minValue: 0,title: 'cups'},
       1:{minValue: 0,title:'cups1',textStyle:{color: 'green'}},
       2:{minValue: 0,title: 'cups2',textStyle:{color: 'red'}}
      },
      hAxis: {title: 'Month'},
      seriesType: 'bars',
      series: {0: {type: 'line',targetAxisIndex:0},1: {type: 'line',targetAxisIndex:1},
      2: {type:'line',targetAxisIndex:2}
               }
    };

    var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
    chart.draw(data, options);


  } 
tfd74geg-.jpg

Daniel LaLiberte

unread,
Jun 2, 2016, 11:40:15 AM6/2/16
to Google Visualization API
Hi Santosh,

Yes, that has been a deficiency for a long time.  We don't have much flexibility in the overall layout of the charts to automatically allow more room for multiple sets of axis labels, though we should probably allow a manual offset option to let you control it yourself.

In the meantime, you could position one of the axes inside the chart area using the textPosition option.


--
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-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@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/ae4981fd-f163-4f48-a45f-d5c5f850c17b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Santosh Korada

unread,
Jun 3, 2016, 3:13:18 AM6/3/16
to Google Visualization API

   Hi Daniel LaLiberte,
                            
            Thank you clarification. i tried total day for that change finally , i also find same solution . 
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--

John

unread,
Jun 8, 2016, 10:35:20 AM6/8/16
to Google Visualization API
Can you please help me with ONE SINGLE LINE OF CODE... 
All I would like is a TRANSPARENT/CLEAR BACKGROUND for the chart

Here is the code...

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load("current", {packages:["corechart"]});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Task', 'Hours per Day'],
          ['Work',     11],
          ['Eat',      2],
          ['Commute',  2],
          ['Watch TV', 2],
          ['Sleep',    7]
        ]);

        var options = {
          title: 'My Daily Activities',
          pieHole: 0.91,
        };

        var chart = new google.visualization.PieChart(document.getElementById('donutchart'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="donutchart" style="width: 900px; height: 500px;"></div>
  </body>
</html>

Please feel free to change the background color to none or transparent-- #lifesaver

Reply all
Reply to author
Forward
0 new messages