Closed KatiRG closed 5 years ago
I have discovered the j
counter works so for my own data I have defined the x tick text like this so that it outputs 0, 6, 12, 18, 0, 6, 12, 18, ...
for each tick:
ticks: 13,
getTickText: function(val, j) {
const dt = 5;
const thisj = j % 4;
const tickText = thisj + thisj * dt;
return tickText;
},
val
is still a date but I just ignore it
You need to set:
{
x: {
type: "linear",
}
}
oh i see! Yes that works. I didn't know about that. Thanks!
In
line.js
it is possible to specify the x tick labels in the settings file usinggetTickText
which then gets used here:But how to define
getTickText
? Something like this always returns a Date even whenx.getValue
is set to returnd.year
instead ofnew Date(d.year + "-01")
:=> returns
Date Wed Dec 31 1969 19:00:01 GMT-0500 (Eastern Standard Time)
in the default exampleHow to make this work when the x-axis values are not dates? How can I return a tick text for the x-axis that gets derived from the input data x values ?