Node Red Dashboard Chart - Custom X Axis Labels

I am trying to customize the x axis labels on the chart widget.
Can I get an example of how I would populate the X-Axis Input Text Box on the Chart widget in order to set each label along the x axis?


As per the info box on the right - The axis labels can be formatted using a Moment.js time formatted string.

Well, I probably forgot to mention that I do not want any time labels on the x-axis.
In my case integer values like 0,10,20,30,40..... for the x-axis labels. How would I set the custom labels for such?


Many threads about this kind of topic you can find here. Latest:

Well, I tried several ways of entering the x-axis labels, but I could not get them to work the way I need.
So, here is an image of what I want to accomplish. Can this be done, if so, how do I enter the correct format in the chart widget?


Any chance of sharing a copy of the input data ?

Sure, here is the input to the chart widget.

var data = [{"x":0,"y":msg.payload[0]},{"x":1,"y":msg.payload[1]},{"x":2,"y":msg.payload[2]},{"x":3,"y":msg.payload[3]},{"x":4,"y":msg.payload[4]},{"x":5,"y":msg.payload[5]},{"x":6,"y":msg.payload[6]},{"x":7,"y":msg.payload[7]},{"x":8,"y":msg.payload[8]},{"x":9,"y":msg.payload[9]},

msg.payload = [{
  "series": ["A"],
  "data": [data],
  "labels": [ ]
msg.topic = "Data set 1"; 
return msg;


Try custom format SSS
(though there is a bug I have fixed in master (not yet on npm) that may prevent it working)


Tried inputting SSS, as you suggest, but has no effect...


Oh, wait, it does show up, however, not scaled - just as data points from 0-63. My scale is 0-100, but with 64 data points. How do I adjust scaling?


not sure what you mean ?
screenshot ?

This should make sense, basically there are 64 data points on the x-axis, but the scale should go from 0-100 instead of 0-63.


Errr - the data you supplied only has x going from 0 to 63... you need to scale that to 100 if you want x to be 100

var data = [{"x":0,"y":msg.payload[0]}, ... ,{"x":63,"y":msg.payload[63]}];

Just to clarify that, in case you don't get it, the last element should be something like


How about this, instead of X in integers from 0-64, X as decimal 1.5625 from 0-64?
var data = [{"x":0,"y":msg.payload[0]} ,{"x"1.5625,"y":msg.payload[1]}, {"x"3.125,"y":msg.payload[2]},...{"x":100,"y":msg.payload[63]}];

What do you think?

Isn't it more a matter of whether it does what you want rather than what we think about it?

So here it is working with the 0-100 scale that I needed...

...and here is the scale adjustment to the data 64 array.


1 Like

Try change X-axis Label to x.


That is awesome!! if i want to put strings on x axis someone know how can i do it? And a title on x-axis ? @tcontrada @dceejay