Problem with usage in es2015 environment
Closed this issue · 4 comments
I tried to repeat Data Streaming example but got an error:
tauCharts.js:189 Uncaught Error: [object Object] plugin is not defined
because plugins
object is empty
My code:
import { api } from 'taucharts';
const chartOptions = {
...
plugins: [
api.plugins.get('trendline')({ showPanel:false })
]
};
Full example here: https://github.com/Semigradsky/taucharts-react-example/blob/master/src/index.js
Demo: http://semigradsky.github.io/taucharts-react-example/
Hi!
You can use explicit export plugins(recomended)
import trendline from 'taucharts/build/development/plugins/tauCharts.trendline';
const chartOptions = {
...
plugins: [
trendline({ showPanel:false })
]
};
or you should register trendline plugin
import 'taucharts/build/development/plugins/tauCharts.trendline';
and add section in webpack config
resolve: {
alias:{
'tauCharts':'taucharts'
}
}
Maybe we fix issue with webpack config in next releases.
Thanks for the answer! It helped me.
import trendline from 'taucharts/build/development/plugins/tauCharts.trendline';
The path looks a little ugly =)
Here is what I got, can be helpful for someone.
In webpack.config.json
:
resolve: {
alias: {
taucharts$: 'taucharts/build/development/tauCharts.js',
taucharts: 'taucharts/build/development'
}
},
In code:
...
import TauChart from 'taucharts-react';
import trendline from 'taucharts/plugins/tauCharts.trendline';
import 'taucharts/css/tauCharts.css';
import 'taucharts/plugins/tauCharts.trendline.css';
...
The path looks a little ugly =)
Yes, it is.
We have plan to move every plugin in separate package.