Reputation: 2522
I'm building a Gantt chart with AmCharts4, based on this demo: https://www.amcharts.com/demos/gantt-chart/
It's basically an inversed bar chart... My problem is that I have many tasks in the Gantt so the horizontal bars are squeezed and i'm obliged to use a zoom on the vertical axis. I would like to have a fixed height of the bars and an html scrollbar on the vertical axis, without zooming or panning. Do you have any idea?
thanks!
Upvotes: 2
Views: 1059
Reputation: 11032
I don't think, that is possible with plain amcharts, because the chart is rendered in the area you provide. I think its possible by setting the height of the chart <div>
dynamically, according to the size of the data.
The chart the should be rerendering itself to fit the new height.
const data = [{
// your data
}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}];
// chart initialisation, etc.
// after setting data
document.getElementById('chart').style.height = `${data.length * 50}px`;
.container {
width: 100%;
max-height: 300px;
overflow-y: auto;
}
#chart {
width: 100%;
min-height: 200px;
background-color: red;
}
<div class="container">
<div id="chart"></div>
</div>
Upvotes: 2