Tes*_*WCh 2 chart.js chartjs-2.6.0
我正在尝试实现类似的目标,但底部有图例。当我尝试添加它最多时我可以得到这样的东西: 
我正在考虑将图例分离到另一个div,例如
<div id="js-legend" class="chart-legend"></div>
Run Code Online (Sandbox Code Playgroud)
但用以前的解决方案来实现它会很好。
先谢谢您的帮助
小智 5
我认为这样的事情应该有效。
plugins: [{
beforeInit: (chart, options) => {
chart.legend.afterFit = () => {
if (chart.legend.margins) {
// Put some padding around the legend/labels
chart.legend.options.labels.padding = 20;
// Because you added 20px of padding around the whole legend,
// you will need to increase the height of the chart to fit it
chart.height += 40;
}
};
}
}]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8752 次 |
| 最近记录: |