haiiaaa / chartjs-gauge

Gauge chart for Chart.js
53 stars 35 forks source link

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

Closed MelCCI closed 3 years ago

MelCCI commented 3 years ago

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 :

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 commented 3 years ago

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

PJanisio commented 2 years ago

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!