Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a .min.js file for Chartjs 3.5 version #24

Closed
MelCCI opened this issue Aug 31, 2021 · 2 comments
Closed

Create a .min.js file for Chartjs 3.5 version #24

MelCCI opened this issue Aug 31, 2021 · 2 comments

Comments

@MelCCI
Copy link

MelCCI commented Aug 31, 2021

Hi, I got the Initial Rewrite for ChartJs 3 version (#21), but I need to make it a web-only version for React (without NodeJs/ npm install), The two problems are following :

  • The files are in ESModule but i need ton convert them for React
  • The files are distribued in three parts in the src folder

How could I recover the files from src to put them in one .js or .min.js, compatible for a React application ?
(For example, the chartjs-gauge.min.js found on other sites works perfectly, but only with ChartJs 2.8)

Thank you for any response

@MelCCI
Copy link
Author

MelCCI commented Sep 3, 2021

I found it !

For those with the same problem as me, here’s how I did it:
I saw that the files. js and .min.js in the format I want are usually in the node_modules/{MODULE}/dist folder (95% of the npm install it’s like this)
So I made a git clone of the git project #21, found here : https://github.com/jbsgh/chartjs-gauge , in order to "build" it myself and get the contents of the /dist generated folder.

After going to the root of the git project, use the command: npm run build
If it does'nt work it will probably ask you to install libraries (karma/ rollup etc...)

I had a lot of problems before I managed to
make the order, especially with karma who couldn’t find rollup plugins that he needed (solved by searching with karma init or other solutions found on Google)
But in the end, it worked!

For those who are lazy to take all the steps, you can try first with the files I generated as a result of this post.

dist.zip

@MelCCI MelCCI closed this as completed Sep 3, 2021
@PJanisio
Copy link

PJanisio commented Jan 5, 2022

Thanks. I was searching for solution today. But valueLabel option doesnt work at least on Chart.js v3.4.1.
Doesnt show any text on the canvas. Rest of functionality is working great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants