If you're searching for a solution, consider using the 'overflow-x
' property.
Ensure to include the following code snippet in the chart-generating script:
var options = {
'title': 'Chart title',
'hAxis': { title: 'axis title', titleTextStyle: { color: 'blue' } },
'width': data.getNumberOfRows() * 65,
'height': 300,
'bar': {groupWidth: 20}
};
This will dynamically adjust the width based on the number of bars. To enable horizontal scrolling, add the overflow-x property as shown below:
<style type="text/css">
#chart_div {
overflow-x: scroll;
width: 500px;
}
</style>
The chart will now have a fixed width of 500px. If the data exceeds this width, a horizontal scroll bar will appear for navigation.
We hope this solution proves helpful!