Reputation: 163
I'm trying to change the label format from date to string.
I tried changing the formats but it didn't work. Here is my codepen: https://codepen.io/sampath-PerOxide/pen/bzVOoG
var dateformat = "%Y-%m"
drawTimeSeriesGraph(data1, dateformat);
I want to pass the string in the place of the date.
Upvotes: 0
Views: 281
Reputation: 20821
You can format your axis ticks however you like with tickFormat
. Just pass it your own function that returns the string you want based on the data (the function can access the current datum and index).
xAxis.tickFormat((d, i) => {
const date = formatDate(d)
return `${date} - Month ${i+1}`
});
Upvotes: 1