漂亮的3D柱状图
效果
html代码
<div id="echartitem" style="width: 100%; height: 100%"></div>
import * as echarts from "echarts";
drawChart() {
const that=this;
if (this.charts) {
this.charts.clear();
}
this.charts = echarts.init(document.getElementById('echartitem'));
let dataAxis = ['岳阳电厂SS系统', '报表系统', '财预系统', '经营日报', '经营日报2', '经营日报3', '经营日报4', '经营日报5']
let data = [220, 182, 191, 234, 290, 330, 310, 123];
let yMax = 500;
let dataShadow = [];
for (let i = 0; i < data.length; i ) {
dataShadow.push(yMax);
}
const option = {
grid: {
top: "30px",
left: "20px",
right: "20px",
bottom: "30px",
containLabel: true,
},
dataZoom: {
type: 'inside',
start: 0,
end: 80,
},
tooltip:{
trigger: "axis",
backgroundColor: "rgba(50,50,50,0.6)",
formatter:function(serie){
let that=this,_html = '<div style="width:100%;text-align:left;height:5px">' serie[0].name "</div><br/>";
serie.forEach(function(iserie){
if(iserie.seriesType!=="pictorialBar"){
_html = '<div style="text-align:left;height:10px;float:left">' serie[0].marker iserie.seriesName "</div><div style='text-align:right;margin-left:10px;height:10px;float:left'>" iserie.value;
_html = '</div><br/>';
}
})
return _html;
},
borderColor: "rgba(50,50,50,0.6)",
axisPointer: {
lineStyle: {
color: "#fff",
},
},
borderWidth: 1,
padding: 10,
textStyle: {
color: "#fff",
},
},
xAxis: {
data: dataAxis,
axisLabel: {
inside: false,
color: '#fff'
},
axisLine: { onZero: true ,lineStyle: { color: "#666" } },
splitLine: { show: false },
splitArea: { show: false },
axisTick: { show: false },
axisLabel: {
color: "#c2dcf5"
},
z: 10
},
yAxis: {
type: "value",
name:'表数量',
nameTextStyle:{
color:'#fff',
fontSize:12,
padding:[0,35,0,0],
verticalAlign: 'middle',
},
splitLine: {
show: false,
},
axisLine: { show: true, lineStyle: { color: "#666" } },
axisTick: { show: false },
axisLabel: { color: "#fff" },
},
toolbox: {
show: true,
saveAsImage: {
backgroundColor: "#0f1d40"
}
},
top: "0px",
right: "2%",
},
series: [
{
name: "上部圆",
type: "pictorialBar",
silent: true,
symbolSize: [26, 10],
symbolOffset: [0, -5],
symbolPosition: "end",
z: 14,
label: {
show: true,
position: "top",
fontSize: 15,
fontWeight: "bold",
color: "#5BFCF4",
},
color: "#5BFCF4",
data: data
},
{
name: "底部圆",
type: "pictorialBar",
silent: true,
symbolSize: [26, 10],
symbolOffset: [0, 5],
z: 12,
color: "#5BFCF4",
data: data
},
{
name: "设备数量",
type: "bar",
barWidth: "26",
barGap: "10%", // Make series be overlap
barCateGoryGap: "10%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 0.7, [
{
offset: 0,
color: "rgba(210,210,210,0.3)",
},
{
offset: 1,
color: "#5BFCF4",
},
]),
opacity: 0.8,
},
emphasis: {
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 0.7, [
{
offset: 0,
color: "#5BFCF4"
},
{
offset: 1,
color: "rgba(210,210,210,0.3)"
},
]),
opacity: 1,
}
},
data: data
},
],
};
const zoomSize = 6;
this.charts.on('click', (params)=> {
this.$parent.systemName=params.name;
this.charts.dispatchAction({
type: 'dataZoom',
startValue: dataAxis[Math.max(params.dataIndex - zoomSize / 2, 0)],
endValue:
dataAxis[Math.min(params.dataIndex zoomSize / 2, data.length - 1)]
});
});
this.charts.setOption(option);
this.resize();
},
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhcjjach
系列文章
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
excel下划线不显示怎么办
PHP中文网 06-23 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel图片置于文字下方的方法
PHP中文网 06-27 -
微信运动停用后别人还能看到步数吗
PHP中文网 07-22