【发布时间】:2019-06-19 15:05:02
【问题描述】:
【问题讨论】:
【问题讨论】:
您需要将 Legend 放入包装器 div 内的外部 div 中。
Div 结构:
<div id="legendwrapper">
<div id="legenddiv"></div>
</div>
将图例放在外部 div 中:
var legendContainer = am4core.create("legenddiv", am4core.Container);
legendContainer.width = am4core.percent(100);
legendContainer.height = am4core.percent(100);
然后你可以通过这样的样式使它可以滚动:
#legenddiv {
width: 150px;
}
#legendwrapper {
max-width: 120px;
overflow-x: none;
overflow-y: auto;
}
【讨论】:
使用 AMCharts 4 的简单方法
chart.legend = new am4charts.Legend();
chart.legend.position = "right"; // Positionning your legend to the right of the chart
chart.legend.scrollable = true: // Make it scrollable
请参阅下面的完整示例: https://codepen.io/team/amcharts/pen/eYmLvoR
【讨论】: