-
Notifications
You must be signed in to change notification settings - Fork 30
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
[BUG] Uncaught ReferenceError: ApexCharts is not defined #46
Comments
have you try ?
based on the Thankss |
will need to update the documentation regarding webpack bundle |
Thank you @KevinKP17 for pointing out the documentation mistake. It seems that unlike Chartkick, ApexCharts doesn't expose itself to @KevinKP17, looking forward to your PR. Edit: |
Thank you @KevinKP17 , I've tested and your solution worked. I believe that needs update the documentation. |
Fixed by #47. |
I'm getting this same error, with latest versions (apexcharts@3.8.5 and ng-apexcharts@1.0.5) as well as the suggested (apexcharts@3.6.8 and ng-apexcharts@1.0.2) using Angularjs1.7 |
Hi! I don't know how to use this gem with Angular. It's better to just use the ng-apexcharts. |
Hi everybody ! I've tried @KevinKP17 , solution but it doesn't work for me.
Let me explain :
There is no need of app.min.js to make a charts work. When I open this html files in chrome, with the 2 css files and 2 js files only, it works perfect. So, in my rails6 app, I put the 2 css files in css folder and those 2 js files in packs folder and import apexcharts.min.js and demo.apex-bar.js in that order. I put alert("blabla") in those 2 files to make sure webpack is going in. And I always get the Apexcharts is not definded ! It's been 4 days, 10 hours a day, I'm working on that and trying to understand how webpack compiles files but I can't figure it out. If anybody know how to intergrate js files from template in webpack just let me know please ! Thanks everybody. flip |
Umm.. what does your problem have to do with this ruby gem? |
Sorry, |
I'm having the same problem app/javascript/application.js
importmap.rb
|
Echoing @renancarvalhoo is there any documentation around how to set this up with importmaps? |
@styd do know how to set this up for importmaps? |
@fzf This is how I make it work with importmap:
wget -O vendor/javascript/apexcharts.esm.js https://ga.jspm.io/npm:apexcharts@3.53.0/dist/apexcharts.esm.js
to local esm file (if you do No. 1): pin "apexcharts", to: "apexcharts.esm.js" or, to CDN URL pin "apexcharts", to: "https://ga.jspm.io/npm:apexcharts@3.53.0/dist/apexcharts.esm.js"
import ApexCharts from "apexcharts"
window.ApexCharts = ApexCharts
For example: <% series = [{
name: "Desktops",
data: [10, 41, 35, 51, 49, 62, 69, 91, 148]
}]
options = {
chart: {
height: 350,
zoom: {
enabled: false
}
},
dataLabels: {
enabled: false
},
stroke: {
curve: 'straight'
},
title: {
text: 'Product Trends by Month',
align: 'left'
},
grid: {
row: {
colors: ['#f3f3f3', 'transparent'],
opacity: 0.5
},
},
xaxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'],
},
module: true
} %>
<%= line_chart(series, options) %> |
Thank you @styd that worked, I can work on a pull request to update the readme. |
@fzf Sure. |
I've trying use ApexCharts in my RoR 6 app, but occurred the error below:
My Gemfile:
My
app/javascript/packs/application.js
My app is built in:
Ruby 2.6.3
Rails 6
Webpacker
The text was updated successfully, but these errors were encountered: