I'm using a Jquery plugin called Chart JS.
I'm using a Jquery plugin called Chart JS.
This is possible through graph options (existing but not very clear in documentation ), using tooltipTemplate
and scaleLabel
to change the text within the graph and the Y axis respectively.
In practice it could be done like this:
var formatedString = '<%= "R$ " + value.toString().split(".").join(",") %>';
var options = {
scaleFontFamily: "'Verdana'",
scaleFontSize: 13,
animation: false,
scaleFontColor: "#484848",
responsive: true,
tooltipTemplate: formatedString,
scaleLabel: formatedString
};
If you want, you can also use a function to format the string. The function receives an object as the first argument and the value is in the .value
property. For example: link
When working with more than dataset
, you should use the option multiTooltipTemplate
instead of tooltipTemplate
.
Ex.
multiTooltipTemplate: function(data) {
return formatar(data.value);
}
I've updated your example this way and it's working.