javascript - Changing x axis ticks in Material google bar charts - Stack Overflow

I am trying to build a usage bar chart using .I was wondering how can I maximize the range of the X-ax

I am trying to build a usage bar chart using . I was wondering how can I maximize the range of the X-axis tick marks? I've tried doing that in the fiddle / using the suggestion from another post - set x Axis range in google chart but that did not work. This is what I added to the existing fiddle:

hAxis: {
        viewWindow: {
              max: 200
        },
        ticks: [0,50,100]
}

but that does not seem work. Any help would be much appreciated!

I am trying to build a usage bar chart using https://developers.google./chart/interactive/docs/gallery/barchart#top-x. I was wondering how can I maximize the range of the X-axis tick marks? I've tried doing that in the fiddle https://jsfiddle/gbta075L/ using the suggestion from another post - set x Axis range in google chart but that did not work. This is what I added to the existing fiddle:

hAxis: {
        viewWindow: {
              max: 200
        },
        ticks: [0,50,100]
}

but that does not seem work. Any help would be much appreciated!

Share Improve this question edited Dec 15, 2017 at 3:02 Jeremy Logan 47.5k39 gold badges125 silver badges145 bronze badges asked May 18, 2015 at 23:19 bazzingabazzinga 1751 gold badge5 silver badges17 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

I honestly dont know how to construct the ticks and viewWindow equivalences when using googles material bar charts. It is not so well documented and still in beta.

However, a nice trick is to use google.charts.Bar.convertOptions() which translates google visualization options into material chart options :

var chart = new google.charts.Bar(document.getElementById('top_x_div'));
chart.draw(data, google.charts.Bar.convertOptions(options));

results in this

Which I assume is what you want.
forked fiddle -> https://jsfiddle/65bwmknu/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745598324a4635251.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信