react中使用echarts
来源:互联网 发布:maven java web项目 编辑:程序博客网 时间:2024/05/23 19:16
"echarts-for-react": "^1.1.6",
"element-resize-event": "^2.0.7"
ReactEcharts.js
import React from 'react';
import ReactEcharts from 'echarts-for-react';
const Charts= React.createClass({
getInitialState: function() {
return {option: this.getOption()};
},
componentDidMount: function() {
},
getOption: function() {
var {data} = this.props
const option = {
tooltip: {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'line' // 默认为直线,可选为:'line' | 'shadow'
},
formatter: "{b}<br/>{a}:{c}"
},
legend: {
show:false,
data:['信号']
},
toolbox: {
show: false,
feature: {
dataView: {readOnly: false},
restore: {},
saveAsImage: {}
}
},
grid: {
top: 0,
left: 0,
right: 0,
bottom:0
},
dataZoom: {
show: false
},
xAxis: [
{
type: 'category',
boundaryGap: true,
axisTick : { // 轴标记
show:false
},
axisLabel : {
show:false
},
axisLine : { // 轴线
show: true,
lineStyle: {
color: 'gray'
}
},
data: ['00:00:00','00:00:01','00:00:02','00:00:03','00:00:04',00:00:05']
}
],
yAxis: [
{
show:false,
type: 'value',
scale: true,
name: '值',
max:5,
min:-5,
boundaryGap: [0.2, 0.2]
}
],
series: [
{
name:'信号',
type:'bar',
smooth: true,
data:[1,3,2,5,3]
}
]
};
return option;
},
render: function() {
return (
<div className='examples'>
<div className='parent'>
<ReactEcharts ref='echarts_react'
option={this.state.option}
style={{height: 30,width:75}} />
</div>
</div>
);
}
});
export default Charts;
其他地方引用这个组件就可以了; 数据自己想怎么给就怎么给;option和 echarts里的option一样去设置
- react中使用echarts
- React中使用ECharts
- React中使用ECharts地图扩展
- 记录在使用react-native-echarts中遇到的问题
- react 中 使用echarts 单图标自适应大小方法
- 在react中插入Echarts
- React Native使用百度Echarts显示图表
- vuejs中使用echarts
- angular中使用ECharts
- webpack中使用echarts
- Android项目中使用echarts
- vue项目中使用echarts
- 在 webpack 中使用 ECharts
- Extjs中使用Echarts(自适应)
- Vue.js中,使用echarts
- webpack下react与echarts一起使用的简单示例
- ECharts应用在React
- 在Vue项目中使用Echarts(五): Echarts绘制地图
- DDos防护系列之1--什么是DDos?
- pyhon-入门--lambda
- Lua调试工具的选择
- Android 入门教程:Android Studio 介绍
- 1035. 插入与归并(25) PAT乙级&&1089. Insert or Merge (25)PAT甲级
- react中使用echarts
- jquery ajax分页写法
- 日志那点事儿——slf4j源码剖析
- 数据库连接代码
- Python Internet
- php 常用的方法
- ES6/ES2015核心内容理解
- string和wstring互转、全角半角互转
- Mac如何在终端玩游戏