Bar Chart not display hAxis scale.

124 views
Skip to first unread message

ram prasad

unread,
Oct 11, 2012, 7:27:12 AM10/11/12
to Google Visualization API

I have created a bar Chart in Visulization API with Below coding.Bar Chart not display hAxis scale.

My data columns : "cols":[{"id":"name","label":"Name","pattern":"","type":"string"},{"id":"distance","label":"Distance(Km)","pattern":"","type":"number"}]

My code :

var myDataTable = new google.visualization.DataTable(newData);
var rowcount=myDataTable.getNumberOfRows();
var options1 = {
  'title':'Travel Distance of Sales Reps(Km)',
  'width':'100%',
  'height':rowcount*50,
  'backgroundColor':'transparent',
  'chartArea':{left:50,top:50},
  'colors':['#109618'],
  'forceIFrame': false,
};
$('#my_chart').empty();
var finalchart = new google.visualization.BarChart(document.getElementById('my_chart'));
finalchart.draw(myDataTable , options1);

--
BY

R.RAMPRASAD


Sergey

unread,
Oct 11, 2012, 9:52:08 AM10/11/12
to google-visua...@googlegroups.com
Hello, I got your BarChart to work exactly as you specified, but the horizontal axis was a bit interesting. I fixed it by adding an hAxis: {minValue: 0} to the options. You can see the result here. Let me know if you need more help.

ram prasad

unread,
Oct 11, 2012, 11:16:41 AM10/11/12
to google-visua...@googlegroups.com
Hi,
   This was not worked for me.Also before adding hAxis: {minValue: 0}, the hAxis scale was not display for me. But for your case,it displayed and shows some different scale.So my problem is,how to display scale in hAxis?
 

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/GF5CzZk_uu8J.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
BY

R.RAMPRASAD


Sergey

unread,
Oct 11, 2012, 11:59:05 AM10/11/12
to google-visua...@googlegroups.com
I'm going to need more context in order to help you debug this. I'm not sure what you mean when you say that the hAxis scale was not displaying for you, or what you mean when you say that it shows a different scale. Can I see a page with your data and what you're trying to graph?
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
BY

R.RAMPRASAD


asgallant

unread,
Oct 11, 2012, 12:07:35 PM10/11/12
to google-visua...@googlegroups.com
Do you mean you want units on the axis, like this: http://jsfiddle.net/asgallant/fWxBF/2/?


On Thursday, October 11, 2012 11:16:49 AM UTC-4, Ram wrote:
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
BY

R.RAMPRASAD


ram prasad

unread,
Oct 12, 2012, 12:07:33 AM10/12/12
to google-visua...@googlegroups.com
I attached screenshot of my Chart. It not displays hAxis Scale units.


To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
BY

R.RAMPRASAD


Travel.jpg

asgallant

unread,
Oct 12, 2012, 1:48:16 AM10/12/12
to google-visua...@googlegroups.com
With only 3 rows of data, your height formula (rowcount * 50) doesn't give the chart enough height to include the axis labels.

To unsubscribe from this group, send email to google-visualization-api+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
BY

R.RAMPRASAD


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/0qFjAFuRQfIJ.

To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
BY

R.RAMPRASAD


ram prasad

unread,
Oct 12, 2012, 3:18:25 AM10/12/12
to google-visua...@googlegroups.com
Thank You asgallant. Now hAxis scale displayed properly after removing height formula (rowcount * 50).


To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
BY

R.RAMPRASAD


Reply all
Reply to author
Forward
0 new messages