我想添加字符串 '$' y 轴值的比例。 enter image description here
我的代码:
fillData() {
this.datacollection = {
labels: this.time,
datasets: [
{
label: 'PNL ($)',
backgroundColor: 'rgba(0,80,0,0.2)',
borderColor: 'lightgreen',
pointBackgroundColor: 'green',
borderWidth: 1,
pointBorderColor: 'green',
data: this.PNL,
steppedLine: true,
// fill: false,
},
],
options: {
scales: {
y: {
ticks: {
// Include a dollar sign in the ticks
callback: (value) => value + '$',
},
},
},
},
Y 轴应该是这个 10$