Horizontal scroll with vertical axes static in google charts

后端 未结 2 1916
臣服心动
臣服心动 2021-01-16 12:36

I am using google chart in my App and I wanted to implement scroll. I could do it by styling the container div.

But the problem is that it scrolls the e

相关标签:
2条回答
  • 2021-01-16 13:06

    It looks like 'overflow-x' is what you are looking for

    in the script that creates the chart, be sure to add the following:

    var options = {
                    'title': 'Chart title',
                    'hAxis': { title: 'axis title', titleTextStyle: { color: 'blue' } },
                    'width': data.getNumberOfRows() * 65,
                    'height': 300,
                    'bar': {groupWidth: 20}
                };
    

    this way the width will be set by the number of bars. the next thing you'll need is to set the overflow-x property:

    <style type="text/css">
            #chart_div {
                overflow-x: scroll;
                width: 500px;
            }
        </style>
    

    what will happen now, is that the chart will be 500px width, and if you'll have more data than that - you'll get a horizontal scroll bar

    Hope it helps

    0 讨论(0)
  • 2021-01-16 13:29

    The Visualization API has a built-in control to handle chart scrolling: the ChartRangeFilter.

    0 讨论(0)
提交回复
热议问题