-
Notifications
You must be signed in to change notification settings - Fork 96
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
Can it support animation #33
Comments
yes <ChartistGraph key="1" className="ct-chart-line" data={{ labels: ["foo","bar"], series:[ [1,2,3],[3,4,5]] }} type={'Line'} listener={{"draw" : function(data) {
if(data.type === 'line' || data.type === 'area') {
data.element.animate({
d: {
begin: 2000 * data.index,
dur: 2000,
from: data.path.clone().scale(1, 0).translate(0, data.chartRect.height()).stringify(),
to: data.path.clone().stringify(),
easing: Chartist.Svg.Easing.easeOutQuint
}
});
} } }}/> |
How do I make the bars animate it if I am passing new data to the chart via props every time a button is clicked? (not triggering the 'draw' function) eg. in parent component I have: import HBar from '../components/Chart/HorizontalChart';
HorizontalChart.jsx
|
I animated bars by setting this as listener: <ChartistGraph ... listener={{"draw" : function(data) { if(data.type === 'bar') {
data.element.animate({
y2: {
begin: 0,
dur: 500,
from: data.y1,
to: data.y2,
easing: Chartist.Svg.Easing.easeOutSine,
}});
}}}/> |
Because you're relying on the Chartist library directly, importing it will by default import it twice into your compiled js if you're using Webpack. Make sure to alias // webpack.config.js
...
resolve: {
alias: {
...
chartist: path.resolve(__dirname, 'node_modules/chartist'),
...
},
},
... |
Does anyone have a pie chart animation? |
First. I use this component very long. it's amazing.
However. I wish we use it can show a animation with chart.
So. How do i do it.
Thx .
The text was updated successfully, but these errors were encountered: