Comments (5)
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 chartist
so that Webpack resolves React-Chartist's Chartist and your Chartist:
// webpack.config.js
...
resolve: {
alias: {
...
chartist: path.resolve(__dirname, 'node_modules/chartist'),
...
},
},
...
from react-chartist.
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,
}});
}}}/>
from react-chartist.
yes
Give a new props to it listener
<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
}
});
} } }}/>
from react-chartist.
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';
<HBar data={this.state.votes} />
HorizontalChart.jsx
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import ChartistGraph from 'react-chartist';
import styles from 'style!./chartist.css';
export default class HorizontalChart extends Component {
static propTypes = {
data: React.PropTypes.object,
}
render() {
let { data } = this.props;
let options = {
seriesBarDistance: 10,
reverseData: true,
high:20,
low:0,
horizontalBars: true,
axisY: {
offset: 70
}
};
let type = 'Bar'
return (
<div>
<ChartistGraph data={data} options={options} type={type} />
</div>
)
}
}
from react-chartist.
Does anyone have a pie chart animation?
Ive looked over the above posts, but I really have no idea how animations works
from react-chartist.
Related Issues (20)
- React 18 compatibility concern
- Window resize causes data display problem HOT 2
- Time Series charts don't work, just put 'Invalid Date' for the label HOT 1
- Styling does not work when passing through either className or the style prop HOT 1
- how can I add event listener ?
- Are there any examples which show how to handle a click event?
- updateChart logic appears to be not allowing re-render
- adding value label top of the points HOT 2
- @types/chartist need to be runtime dependency HOT 7
- Zoom Feature
- Unable to launch the application: Unexpected token HOT 1
- Why types does not have the listener prop? HOT 1
- static getDerivedStateFromProps
- componentWillReceiveProps is not safe
- chart does not update on class change
- Chart doesn't shpw up HOT 5
- horizontal bars doesn't start at 0
- How to reduce thichness of plotted line in graph ? can't find proper syntax
- Chartist v1
- Chartist[type] is not a constructor HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-chartist.