ComboChart to left side

42 views
Skip to first unread message

Stepan Tkhir

unread,
Oct 20, 2013, 11:44:40 AM10/20/13
to google-visua...@googlegroups.com

I have a ComboChart such as the first screenshot

How do I make the line touched the left side of the chart?


asgallant

unread,
Oct 20, 2013, 8:55:48 PM10/20/13
to google-visua...@googlegroups.com
Without seeing your ode, I can't be certain, but it seems likely that you are using a discrete (string-based) x-axis.  If you switch to a continuous (number, date, datetime, timeofday) x-axis, that should fix the problem.

Stepan Tkhir

unread,
Oct 21, 2013, 1:35:11 AM10/21/13
to google-visua...@googlegroups.com
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
   
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
   
<title>
      Google Visualization API Sample
   
</title>
   
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
   
<script type="text/javascript">
      google
.load('visualization', '1', {packages: ['corechart']});
   
</script>
   
<script type="text/javascript">
     
function drawVisualization() {
       
// Some raw data (not necessarily accurate)
       
var data = google.visualization.arrayToDataTable([
         
['Month', 'Bolivia', 'Rwanda', 'Average'],
         
['2004/05',  165,     450,      614.6],
         
['2005/06',  135,  288,      682],
         
['2006/07',  157,     397,      623],
         
['2007/08',  139,     215,      609.4],
         
['2008/09',  136,     366,      569.6]
       
]);

       
var options = {
          title
: 'Monthly Coffee Production by Country',
          vAxis
: {title: "Cups"},
          hAxis
: {title: "Month"},
          seriesType
: "bars",
          series
: {2: {type: "line"}}
       
};

       
var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
        chart
.draw(data, options);
     
}
      google
.setOnLoadCallback(drawVisualization);
   
</script>
 
</head>
 
<body>
   
<div id="chart_div" style="width: 900px; height: 500px;"></div>
 
</body>
</html>
How to do it, for example in this code?

 
Понеділок, 21 жовтня 2013 р. 03:55:48 UTC+3 користувач asgallant написав:

asgallant

unread,
Oct 21, 2013, 9:57:04 AM10/21/13
to google-visua...@googlegroups.com
In that example, it looks like you are using "2005/06" to indicate a range from 2005-2006, is that true?  If so, there is no way to represent that as a continuous axis type.

Stepan Tkhir

unread,
Oct 21, 2013, 11:57:45 AM10/21/13
to google-visua...@googlegroups.com
No. I accidentally dropped the wrong option. Must be 1, 2, 3, etc.


2013/10/21 asgallant <drew_g...@abtassoc.com>

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/V86q7h1vteY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Stepan Tkhir

unread,
Oct 21, 2013, 11:59:53 AM10/21/13
to google-visua...@googlegroups.com
No. I accidentally dropped the wrong option. Must be 1, 2, 3, etc.
The line should be on the front rather than the middle.
var data = google.visualization.arrayToDataTable([
         
['Month', 'Bolivia', 'Rwanda', 'Average'],

         
['1',  165,     450,      614.6],
         
['2',  135,  288,      682],
         
['3',  157,     397,      623],
         
['4',  139,     215,      609.4],
         
['5',  136,     366,      569.6]
       
]);


2013/10/21 Stepan Tkhir <stk...@gmail.com>

asgallant

unread,
Oct 21, 2013, 1:17:44 PM10/21/13
to google-visua...@googlegroups.com
Remove the quotes from around the numbers:

var data = google.visualization.arrayToDataTable([
    ['Month', 'Bolivia', 'Rwanda', 'Average'],
    [1, 165, 450, 614.6],
    [2, 135, 288, 682],
    [3, 157, 397, 623],
    [4, 139, 215, 609.4],
    [5, 136, 366, 569.6]
]);


2013/10/21 Stepan Tkhir <stk...@gmail.com>


2013/10/21 asgallant <drew_g...@abtassoc.com>
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages