0

On my y axis I have value from 0 to n. I need to display this number in this style: 2 (s) 1 (s)

I just want to add "(s)" but if I do this :

data: latency+"(s)"

It doesn't work. Latency is the array where I have numbers. Thanks.

Isky
  • 1,328
  • 2
  • 14
  • 33
  • Possible duplicate of [Chart.js - Formatting Y axis](http://stackoverflow.com/questions/20371867/chart-js-formatting-y-axis) – aeryaguzov Dec 09 '15 at 10:46

3 Answers3

0

You have to set the scaleLabel option like this :

scaleLabel : "<%=value%>(s)"

For example, you can set it in the global Chart options :

Chart.defaults.global = {
    scaleLabel : "<%=value%>(s)"
};
bviale
  • 5,245
  • 3
  • 28
  • 48
0

You need to use the scaleLabel property.

Look at this: Chart.js - Formatting Y axis

try :

scaleLabel: function (valuePayload) {
    return valuePayload.value + '$';
}
Community
  • 1
  • 1
RaidenF
  • 3,411
  • 4
  • 26
  • 42
0

Use the option

scaleLabel: "<%=value%> (s)",

if you want to change the display on the scale.

Or, if you want to change the display in the tooltip, set tooltipTemplate or multiTooltipTemplate depending on whether you have a single or multiple series.

tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %> (s)",

or

multiTooltipTemplate: "<%= value %> (s)",
potatopeelings
  • 40,709
  • 7
  • 95
  • 119