美文网首页前端Vue专辑
echarts饼图,柱状图遇到的显示问题

echarts饼图,柱状图遇到的显示问题

作者: 小水嘀哩哒 | 来源:发表于2020-06-23 17:36 被阅读0次

饼图

1.调整标题位置,图例位置
title: {
text: "标题",
x: "center", //水平位置 left center right
y: "bottom", //垂直位置 top center bottom
textStyle: { // 自定义样式
color: "#333",
fontStyle: "normal",
fontSize: 12,
fontWeight: "200"
}
},
2.更改图例位置,图标
legend: {
// orient: 'vertical',
// top: 'middle',
bottom: 40, //距离底部距离
left: "center",
icon: "circle",//图标的类型
data: this.pieKey //数据
},
3.类型太多,颜色不想重复,字体和轴覆盖
series: [
{
type: "pie",
radius: "65%",
center: ["50%", "45%"],
selectedMode: "single",
data: this.pieVal,
minAngle: 3, //最小的扇区角度(0 ~ 360),用于防止某个值过小导致扇区太小影响交互
avoidLabelOverlap: true,
label: {
align: "left",
normal: {
formatter(v) {
let text = Math.round(v.percent) + "%" + "" + v.name;
if (text.length <= 8) {
return text;
} else if (text.length > 8 && text.length <= 16) {
return (text = ${text.slice(0, 8)}\n${text.slice(8)});
} else if (text.length > 16 && text.length <= 24) {
return (text = ${text.slice(0, 8)}\n${text.slice( 8, 16 )}\n${text.slice(16)});
} else if (text.length > 24 && text.length <= 30) {
return (text = ${text.slice(0, 8)}\n${text.slice( 8, 16 )}\n${text.slice(16, 24)}\n${text.slice(24)});
} else if (text.length > 30) {
return (text = ${text.slice(0, 8)}\n${text.slice( 8, 16 )}\n${text.slice(16, 24)}\n${text.slice( 24, 30 )}\n${text.slice(30)});
}
},
textStyle: {
fontSize: 8
}
}
},
itemStyle: {
normal: { //颜色随机
color: function (){return "#"+("00000"+((Math.random()*16777215+0.5)>>0).toString(16)).slice(-6); }
}
}
}
]

柱状图

1.文字太多重叠,显示不全
xAxis: {
type: "category",
data: this.pieKey,
axisLabel: {
interval:0,//代表显示所有x轴标签显示
rotate:30, //代表逆时针旋转45度
}
},

后续遇到问题在补充

相关文章

  • echarts饼图,柱状图遇到的显示问题

    饼图 1.调整标题位置,图例位置title: {text: "标题",x: "center", //水平位置...

  • Echarts

    http://echarts.baidu.com/api.html#echarts 柱状图: 饼状图: 饼状图2:...

  • 2019-01-18 ECharts

    今天接触了ECharts,ECharts 提供了常规的折线图、柱状图、散点图、饼图、K线图,用于统计的盒形图,用于...

  • echarts的学习与实战大数据首页

    关于echarts项目用到挺多,柱状图,折线图,进度图,指针图和饼图echarts的配置项比较多,用起来比较繁琐和...

  • Echarts图表实现后台数据统计

    柱状图获取后台数据展示: 饼图获取后台数据展示: 前端实现方法: var myChart = echarts.in...

  • 获取到后台数据后,用echarts画柱状图不显示的问题

    前话:以前用echarts开发项目的时候根本就没有遇到过这种问题。 用echarts画柱状图,在拿到后台传递的数据...

  • ECharts插件使用

    柱状图,折线图,饼图 初始化echarts实例 1.准备一个div容器,为Echarts准备一个具备大小(宽高)的...

  • 写两个ECharts联动

    这篇文章,超人鸭写两个echarts的饼图,并带有联动的效果。上次超人鸭写过一篇写echarts柱状图的,每个配置...

  • 数据可视化图表ECharts

    介绍: ECharts提供了折线图、柱状图、散点图、饼图、K线图,以及地图、热力图、关系图等多种图表API,并支持...

  • Echarts 柱状图屏蔽显示 Y 轴数字

    需求: ECharts 柱状图,鼠标放在上面的时候会虚线显示 Y 轴高度,可是我的柱状图是统计人数的,出现 1.5...

网友评论

    本文标题:echarts饼图,柱状图遇到的显示问题

    本文链接:https://www.haomeiwen.com/subject/eouhfktx.html