[英]How to change the Y-Axis to show $ in graph
I want to see dollar sign along with the Y-Axis scale data. 我希望看到美元符号和Y轴比例数据。 I am using ChartJS Version 2.1.0 for rendering graph.
我使用ChartJS版本2.1.0来渲染图形。 I looked into this LINK but I could not understand.
我调查了这个链接,但我无法理解。 I know I need to change my ScaleLabel but I am not able to do so.
我知道我需要更改我的ScaleLabel,但我无法这样做。 Kindly guide me.
请指导我。 so scale
2000 should show as $2000
Below is what I have till now. 所以
2000 should show as $2000
规模2000 should show as $2000
以下是我现在所拥有的。
define(['backbone'], function(Backbone) {
var firstSubViewModel = Backbone.View.extend({
template: _.template($('#myChart-template').html()),
render: function() {
$(this.el).html(this.template());
var ctx = $(this.el).find('#lineChart')[0];
var lineChart = new Chart(ctx, {
type: 'line',
data: {
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
datasets: {
label: "This Year",
data: this.model.attributes.incThisYear
}
},
options: {
scales: {
yAxes: [{
scaleLabel: {
display: true
}
}]
}
}
});
},
initialize: function() {
this.render();
}
});
return firstSubViewModel;
});
Image: 图片:
EDIT 编辑
My options looks like this now: 我的选项现在看起来像这样:
options: {
scales: {
yAxes: [{
scaleLabel: function (incValue){ return '$ '+ incValue.value; }
}]
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.