coreui-react icon indicating copy to clipboard operation
coreui-react copied to clipboard

Unable to use time series axis with current configuration

Open AddoSolutions opened this issue 3 years ago • 2 comments

Hello, after a very long and exhausting set of digging, I figured out that the way that this module handles either distribution or some other component in the CI pipeline disallows one from using time series axis.

This is normally done with a plugin like https://github.com/chartjs/chartjs-adapter-moment, which, import {_adapters} from 'chart.js' and then override() the various method to allow for time series.

The way that this module is implemented, the entirety, or a large portion of the chart.js library is compiled into the dist of this package, and so when the time series is override()n in the extensions, the _adapter.date value is unaffected in this module and thus you get:

Uncaught Error: This method is not implemented: Check that a complete date adapter is provided

There are a few options on how to resolve this.

  1. An immediate fix would be to export _adapters from this module, which can be manually overwritten or linked to the chart.js one.
  2. A better long-term fix would be to see if chart.js is even available, and if so, pull in it's _adapters value so that everything works as expected out of the box.

Let me know if additional clarification or assistance is needed

AddoSolutions avatar Aug 13 '22 04:08 AddoSolutions

For those looking to get around this, so far I am unable to find a method other than vendorizing (at least until this is fully resolved) both packages.

You have to add this to the end of index.js for this package:

exports.adapters = adapters;
exports._adapters = adapters;

And change the import of chartjs-adapter-moment to the following:

import {_adapters} from './react-chartjs/index';

AddoSolutions avatar Aug 13 '22 04:08 AddoSolutions

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

github-actions[bot] avatar Oct 12 '22 14:10 github-actions[bot]