amcharts3
amcharts3 copied to clipboard
Images not found when used as node_module
Not sure there's much that can be done to resolve this, but I'm just posting the workaround here in case anyone else comes across this problem.
When used via require('amcharts3'), images such as the drag icons give a 404 since it's looking inside an amcharts/ folder at the root that doesn't exist.
The work around is to set window.AmCharts_path = 'node_modules/amcharts3/amcharts';
In addition, amcharts path can be set using chart instance's path property.
Above methods are not working on Webpack build app. Getting error http://localhost:3000/node_modules/amcharts3/amcharts/images/lens.svg 404 (Not Found) on no matter set path or not.
@lanocturne, there is no trouble with webpack.
// copy images from node_modules to webpack output directory
var imagesContext = require.context('!!file?name=images/amcharts/[name].[ext]!amcharts3/amcharts/images');
imagesContext.keys().forEach(imagesContext);
AmCharts.makeChart(elem, {
// specify path to images
pathToImages: 'images/amcharts/'
@timwis, in your case, you manage images separately from js and should use pathToImages in a chart config.
@dizel3d Uncaught Error: Cannot find module "!!file?name=images/amcharts/[name].[ext]!node_modules/amstock3/amcharts/images"
I tried your code with amstock3 but got this error