Men的博客

欢迎光临!

0%

Echarts封装

希望这个echarts组件能设计成什么样

业务数据和样式配置数据分离,我只需要传入业务数据就行了 data
它的大小要完全由使用者决定 hight,width
不会因为缩放出现变形问题,而是能很好地自适应 resize
能保留自己配置样式的灵活性 option
能够实时更行试图 setOption
能展示一个空状态 empty

title
subtitle
colors
fonts
unit

options

tooltip
grid
yAxis
xAxis
series

title: {
show: true, // 是否显示
text: “”, // 一般自定义
subtext: “”, // 一般自定义
left: “center”, // 位置 top right bottom
textStyle: {
color: ‘#333’,
fontStyle: ‘normal’,
fontWeight: ‘bolder’,
fontSize: 18,

},
subtextStyle: {

},   

}
legend: {
show: true, // 是否显示
left: “center”, // 位置 top right bottom
orient: ‘horizontal’, // 方向
itemGap: 10, // 间隔
data: [],
itemStyle: {
color: ‘#333’,
},
formatter: function (name) {
return ‘Legend ‘ + name;
},
textStyle: {
color: ‘#333’,
fontStyle: ‘normal’,
fontWeight: ‘bolder’,
fontSize: 18,

},

}
grid: {
show: true, //是否显示直角坐标系
left: “center”, // 位置 top right bottom

}
xAxis: {
show: true,
position: ‘bottom’,
offset: 0,
name: ‘’, // x 轴名称
nameTextStyle: {
color: ‘#333’,
fontStyle: ‘normal’,
fontWeight: ‘bolder’,
fontSize: 18,

},
nameRotate: 0, // 旋转
min: 'dataMin', // 最小刻度
max: 'dataMax', // 最大可读
splitNumber: 5, // 坐标轴分段

}