symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
824 stars 298 forks source link

Problem importing ChartJs plugins #1474

Closed RomainChardon closed 1 month ago

RomainChardon commented 7 months ago

Hello, I installed ChartJs via symfony:ux on a symfony 6.4 with assetMapper, I cannot add the chartjs-plugin-annotation plugin.

The import and register is carried out, the plugin and charjs have compatible versions. Everything is well built.

Thank you for your help

image image image image

fracsi commented 7 months ago

This happens with most of the charts plugins / adapters as well. These are currently unusable with the new AssetMapper setup. ux-chartjs uses chart.js/auto package when using the AssetMapper, but plugins and adapters are using the normal chart.js package. If you install a charts.js plugin / adapter via importmap:require, you'll see that a normal chart.js and some additonal packages are also added to the importmap.

Simple test:

$ bin/console importmap:require chart.js/auto chartjs-plugin-annotations

importmap.php contents:

return [
   //...
  'chart.js/auto' => [
      'version' => '4.4.1',
  ],
  'chartjs-plugin-annotation' => [
      'version' => '3.0.1',
  ],
  '@kurkle/color' => [
      'version' => '0.3.2',
  ],
  'chart.js' => [
      'version' => '4.4.1',
  ],
  'chart.js/helpers' => [
      'version' => '4.4.1',
  ],
];
RomainChardon commented 7 months ago

I think it works. But I must have a problem with the plugin settings in my chart

image image

carsonbot commented 1 month ago

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

RomainChardon commented 1 month ago

Sorry for the delay in response, it's good for me. I had to do something else to impot the plugins, but my configuration is a bit weird due to Symfony