Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Cannot use type: 'time' in scales x

Open blackat opened this issue 10 months ago • 2 comments

Expected behavior

No exception in the console

Current behavior

I mam following this example

using

scales: {
      x: {
        // HERE WHAT CAUSE THE ISSUE
        type: 'time',
        time: {
          // Luxon format string
          tooltipFormat: 'DD T'
        },
        title: {
          display: true,
          text: 'Date'
        }
      },
      y: {
        title: {
          display: true,
          text: 'value'
        }
      }
    },
  },

ERROR Error: This method is not implemented: Check that a complete date adapter is provided. at abstract (chart.js:2631:9) at _DateAdapterBase.formats (chart.js:2660:12) at TimeScale.init (chart.js:11571:42) at chart.js:5881:13 at each (helpers.segment.js:101:12) at Chart.buildOrUpdateScales (chart.js:5859:5) at Chart._updateScales (chart.js:6024:10) at Chart.update (chart.js:5975:10) at new Chart (chart.js:5742:12) at primeng-chart.mjs:118:22

Reproducible sample

https://www.chartjs.org/docs/latest/samples/scales/time-line.html

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

4.4.7

Browser name and version

No response

Link to your project

No response

blackat avatar Feb 02 '25 20:02 blackat

As described in the docs here a date adapter is required for the time scale to work: https://www.chartjs.org/docs/latest/axes/cartesian/time.html#date-adapters

LeeLenaleee avatar Feb 02 '25 22:02 LeeLenaleee

Thanks, I will try.

blackat avatar Feb 08 '25 17:02 blackat