How to use different date formats in chart js #8841
Unanswered
redwarbanner
asked this question in
Q&A
Replies: 1 comment
-
@redwarbanner if I understood well your need, at runtime, you could try to change the chart.options.scales.x.time.unit = 'week'; // or month or year based on the list box selection
chart.update(); |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
I have a selectbox with different periods:
if i select "week" - the period of 7 days from the current day is calculated.T hen the chart for the previous 7 days is plotted. The graph is plotted correctly, but there is a problem with the x-axis. I can set the data format for month, week, or another something like this:
how do I change the unit depending on the format?

I tried using a global variable call window.variable - but its didn't work.
Also, only one date is displayed on the chart
Beta Was this translation helpful? Give feedback.
All reactions