분류
Reactjs
react-dynamic-charts
본문
동적 데이터를 기반으로 애니메이션 차트 시각화를 작성하기 위한 React 라이브러리.
React Dynamic Charts를 사용하면 멋진 애니메이션 동적 차트를 만들어 데이터를 시각화 할 수 있습니다.
동적 차트를 사용하는 가장 기본적인 예는 다음과 같습니다.
https://github.com/dsternlicht/react-dynamic-charts
https://dsternlicht.github.io/react-dynamic-charts/
<DynamicBarChart
data={this.state.data}
// Timeout in ms between each iteration
iterationTimeout={100}
/>
애니메이션이 시작되고 애니메이션이 종료 될 때 사용자 정의 콜백을 추가 할 수도 있습니다. 콘솔을 확인하여 작동하는지 확인하십시오.
<DynamicBarChart
data={this.state.data}
onRunStart={() => {
console.log("Started!");
}}
onRunEnd={() => {
console.log("Ended!");
}}
/>
설치
npm install --save react-dynamic-charts
용법
데모를 확인하여 작동하는지 확인하십시오.
import React, { Component } from 'react'; import { LiveBarChart } from 'react-dynamic-charts'; import 'react-dynamic-charts/dist/index.css'; // Don't forget to import the styles class App extends Component { state = { data: [ // ... ] }; render () { return ( <LiveBarChart data={this.state.data} /> ) } }
Props
Property | Type | Default | Description |
---|---|---|---|
data | array | [] | An array of objects that contain the data of the chart (see section below). |
baseline | number | null | If you want the chart to have a baseline, add its number here. Could be useful for charts that include negative values. |
iterationTimeout | number | 200 | Number of milliseconds you want between iterations. |
startAutomatically | boolean | true | Whether the visualization should start running automatically. Default is true . |
startRunningTimeout | number | 0 | Number of milliseconds you want before running the visualization. |
onRunStart | function | null | A callback function that being called once the visualization starts. |
onRunEnd | function | null | A callback function that being called once the visualization ends. |
showTitle | boolean | true | Whether you want to show each iteration's title. |
barHeight | number | 50 | The height (in pixels) of each bar item. |
showStartButton | boolean | false | Show a start button that triggers the animation. |
startButtonText | string | 'Start' | The text that will appear in the start button. |
mainWrapperStyles | object | {} | Styles object for the component's main wrapper. |
chartWrapperStyles | object | {} | Styles object for the chart wrapper. |
baselineStyles | object | {} | Styles object for the baseline element. |
iterationTitleStyles | object | {} | Styles object for the title element. |
labelStyles | object | {} | Styles object for the chart's labels. |
startButtonStyles | object | {} | Styles object for the start button. |
- 이전글호버-CSS 기반 호버 효과의 멋진 모음 19.08.17
- 다음글움직일 수 있는! 드래그 가능! 크기 조정 가능! 확장 가능! 회전 가능! 19.08.17