1 year ago

#356780

test-img

Oliver Mclean

How do you correct ApexCharts datetime range on X axis?

I've created a Line graph using Apexcharts in vanilla javascript. The series values have corresponding dates, but for some reason, the month of march is left out of the x axis date labels.

The sample data:

  series: [
    {
      name: "Parker, D (1250)",
      data: [
        { x: "28-Feb-2017 GMT", y: 34 },
        { x: "31-Mar-2017 GMT", y: 43 },
        { x: "30-Apr-2017 GMT", y: 31 },
        { x: "31-May-2017 GMT", y: 43 },
        { x: "30-Jun-2017 GMT", y: 33 },
        { x: "31-Jul-2017 GMT", y: 52 }
      ]
    }

The output:

enter image description here

For some reason, the chart is plotting the first data point (with date of 28th of Feb) directly above the date 1st of Feb. The expected behaviour that I would like is the date axis to say 1st of March instead.

Here's the codepen for anyone to have a play with: https://codepen.io/shane-wood/pen/zYpGxrY?editors=0010

Does anyone know how to fix this issue?

javascript

date

charts

apexcharts

x-axis

0 Answers

Your Answer

Accepted video resources