chartjs-plugin-colorschemes icon indicating copy to clipboard operation
chartjs-plugin-colorschemes copied to clipboard

New Release with compatibility Chart.js v3

Open DmytroLitvinov opened this issue 3 years ago • 19 comments

After merging https://github.com/nagix/chartjs-plugin-colorschemes/pull/26 it would be nice to see it as npm package's release :)

DmytroLitvinov avatar Jun 14 '21 15:06 DmytroLitvinov

I will update the build system, workflows and documentation, add TypeScript support, improve ES module support, then release v1 😉

nagix avatar Jun 14 '21 16:06 nagix

When we will can get the new release for chartjs v3?

marti1125 avatar Jul 02 '21 17:07 marti1125

What is the latest Chart.js compatible version? I'm building a Flask application and my charts go all grey when I use any version of Chart.js after 2.9.4. Thanks 😀

matheusft avatar Jul 07 '21 11:07 matheusft

I was playing a bit with colorscheme v0.4.0 + Chart.js, and until v2.9.4 the plugin seems to work, but for newer versions (+3.0.2), colorscheme is broken with the following error:

 Uncaught TypeError: f.defaults.global is undefined
    <anonymous> https://cdn.jsdelivr.net/npm/[email protected]:7
    <anonymous> https://cdn.jsdelivr.net/npm/[email protected]:7
    <anonymous> https://cdn.jsdelivr.net/npm/[email protected]:7

berthin avatar Jul 18 '21 21:07 berthin

@nagix Any idea of a release date for v1?

drkelly58 avatar Jul 19 '21 00:07 drkelly58

Hello! Master branch does not work with Chart.js 3.5.1 I've correct plugin.colorschemes.js, line 184 Replace Chart.plugins.register(ColorSchemesPlugin); to (Chart.plugins || Chart).register(ColorSchemesPlugin); After this replacement chartjs-plugin-colorschemes works well with Chart.js 3.5.1

yurij7070 avatar Sep 16 '21 08:09 yurij7070

Hi. I think it's not enough:

Uncaught TypeError: Chart.defaults.global is undefined

Cyrille37 avatar Sep 27 '21 10:09 Cyrille37

I encountered the same same issues. I was able to get it working with chart.js 3.5.1 by applying the above patch, but also: Line 1040 change: Chart.defaults.global.plugins.colorschemes to Chart.defaults.plugins.colorschemes

Line 1075 - beforeUpdate: added following new line to get plugin options from chart object (as they were not present in argument options): var options = chart.config.options.plugins.colorschemes;

it-mkl avatar Sep 30 '21 07:09 it-mkl

Also replace Chart.plugins.register(ColorSchemesPlugin); with Chart.register(ColorSchemesPlugin); on line 1189

pizzo00 avatar Sep 30 '21 12:09 pizzo00

@nagix With #26, it's technically not a breaking change as far as I know. Would you consider releasing a 0.5.0 for Chart.js 3 compatibility? I know it would be nice to bundle this update into the v1.0 release, but perhaps it's just time to get Chart.js 3 support out there.

s4m0r4m4 avatar Oct 05 '21 01:10 s4m0r4m4

I think this may help resolve ChartJs 3 compatibility: https://github.com/nagix/chartjs-plugin-colorschemes/pull/30, check it out and make sure it's working!

s4m0r4m4 avatar Oct 05 '21 17:10 s4m0r4m4

I think there is one more problem with the typ 'bar'.

in beforeUpdate the forEach which should set scheme colors, it set only the first color

ger82 avatar Nov 24 '21 23:11 ger82

@nagix do you have any idea when the next release can be released with compatibility with chart.js 3.X.X ? Thanks

nicohlr avatar Jan 04 '22 20:01 nicohlr

Sorry for insisting, @nagix do you know when you have time for a new release? :smile:

viktorsmari avatar Jan 12 '22 15:01 viktorsmari

Hello @nagix if you no more have time, perhaps you can add one or two people with write access to this repo, that make update alive :-)

Cyrille37 avatar Jan 13 '22 07:01 Cyrille37

"I will update the build system, workflows and documentation, add TypeScript support, improve ES module support, then release v1" Will it be done in 2022 ? at least support for v3... thanks

devozanges avatar Jan 27 '22 13:01 devozanges

@nagix Any idea of a release date for v1? Supporting Chart.js V3 becomes important for many projects and avoid using this plugin for compatibility problem is wasted your work,

sdespont avatar Apr 25 '22 08:04 sdespont

just a 👍 for your great work combined with a tiny

please release V3 support

simonbuehler avatar Oct 27 '22 08:10 simonbuehler

In issue #33 jayantbh has written

https://www.npmjs.com/package/hw-chartjs-plugin-colorschemes

This seems to be a fork published to work with chartjs v3.

Indeed, this fork works with ChartJS 3.x, but has another bug.

If I use this ChartJS config

{
  type: 'bar',
  data: {
    labels: ['diagramLabel'],
    datasets: [{
      label: 'dataLabel',
      data: [1],
      backgroundColor: '#00FF00'
    }]
  },
  options: {
    plugins: {
      colorschemes: {
        scheme: 'brewer.YlGn3'
      }
    }
  }
}

the resulting data bar has not the configured background-color #00FF00. It displays it in some "light yellow". If i remove the options section (the colorscheme configuration) then it uses some other color ("light blue"), but still not #00FF00.

Can someone reproduce and confirm it?

In ChartJS 2.x with the unpatched colorscheme-plugin it works.

tl-sfo avatar Dec 01 '22 10:12 tl-sfo