我面临弃用方法的问题:
Chart.js:1990 bar chart: "scales.[x/y]Axes.maxBarThickness" is deprecated. Please use "dataset.maxBarThickness" instead
Run Code Online (Sandbox Code Playgroud)
如何解决?
我正在使用以下方式动态设置条形图的 maxBarThickness
this.barOptions.scales.xAxes[0]['barPercentage'] = 0.8;
Run Code Online (Sandbox Code Playgroud)
但这现在正在发出警告。
请分享您的建议!
此属性不再是 的一部分,xAxis但可以直接dataset在数据集配置中进行设置。
另请参阅示例用法。
data: {
datasets: [{
barPercentage: 0.5,
barThickness: 6,
maxBarThickness: 8,
minBarLength: 2,
data: [10, 20, 30, 40, 50, 60, 70]
}]
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1271 次 |
| 最近记录: |