目录

一、效果图预览

二、准备

1.JavaScript源码运行文件,用以运行代码

2.需要文本编辑器如notepad++

三、编写图像属性代码

1.编辑界面预览

2.完整代码

四、运行


一、效果图预览

二、准备

1.JavaScript源码运行文件,用以运行代码

需要运行文件的自行下载

http://链接:https://pan.baidu.com/s/1shmtM36HgRqC0S1OXpNWpg?pwd=yozs提取码:yozs --来自百度网盘超级会员V2的分享

https://pan.baidu.com/s/1shmtM36HgRqC0S1OXpNWpg?pwd=yozs

下载的运行文件预览:

2.需要文本编辑器如notepad++

好用的文本编辑器能够使编辑和查错更方便,当然也可以用记事本进行编辑。

三、编写图像属性代码

1.编辑界面预览

2.完整代码

<!DOCTYPE html>
<html><head><meta charset="utf-8" /><!-- 引入刚刚下载的 ECharts 文件 --><script src="echarts.min.js"></script></head><body><!-- 为 ECharts 准备一个定义了宽高的 DOM --><div id="main" style="width: 1000px;height:400px;"></div><script type="text/javascript">// 基于准备好的dom,初始化echarts实例var myChart = echarts.init(document.getElementById('main')); // 绘制正侧面var positiveShape = echarts.graphic.extendShape({shape: {x: 0,y: 0},buildPath: function (ctx, shape) {const xAxisPoint = shape.xAxisPointctx.moveTo(shape.x+20, shape.y);      //右上ctx.lineTo(shape.x - 20, shape.y );  //左上ctx.lineTo(xAxisPoint[0] - 20 , xAxisPoint[1] );   //左下ctx.lineTo(xAxisPoint[0] +20, xAxisPoint[1]);    //右下ctx.closePath();}});// 绘制右侧面var  rightShape = echarts.graphic.extendShape({shape: {x: 0,y: 0},buildPath: function (ctx, shape) {const xAxisPoint = shape.xAxisPointctx.moveTo(shape.x+25, shape.y-13);  // 右上ctx.lineTo(shape.x + 20, shape.y );ctx.lineTo(xAxisPoint[0] +20 , xAxisPoint[1] );ctx.lineTo(xAxisPoint[0]+25 , xAxisPoint[1]-13);   //右下ctx.closePath();}});// 绘制顶部var topShape = echarts.graphic.extendShape({shape: {x: 0,y: 0},buildPath: function (ctx, shape) {ctx.moveTo(shape.x+20, shape.y);      //右下ctx.lineTo(shape.x + 25, shape.y - 13);   //右上ctx.lineTo(shape.x - 15 , shape.y - 13);   //左上ctx.lineTo(shape.x - 20, shape.y );   //左下ctx.closePath();}});// 注册三个面图形echarts.graphic.registerShape('positiveShape', positiveShape)echarts.graphic.registerShape('rightShape', rightShape)echarts.graphic.registerShape('topShape', topShape)// 指定图表的配置项和数据var option = {backgroundColor: new echarts.graphic.LinearGradient(0, 0, 0, 1,[{ offset: 0,color: '#5f5e61'},{offset: .4,color: '#F8F8FF'},{offset: .6,color: '#F8F8FF'},{offset: 1,color: '#5f5e61'}]// (x1,y1) 点到点 (x2,y2) 之间进行渐变),tooltip: {},legend: {type:'plain',data: ['满意率'],top: 'middle',orient: 'vertical',icon: 'roundRect',x:'right',      //可设定图例在左(left)、右(right)、居中(center)、填写数字(填写100代表的是100px)y:'center',     //可设定图例在上(top)、下(bottom)、居中(center)、填写数字(填写100代表的是100px)padding:[0,25,0,0],   //可设定图例[距上方距离,距右方距离,距下方距离,距左方距离]itemHeight: 15,itemWidth:15,borderWidth:1,color:"000",itemStyle:{borderColor:'#000',},borderColor:'black'},//标签xAxis: {show: true,type:'category',//坐标轴轴线相关设置。axisLine: {lineStyle: {//坐标轴颜色color:'#000000'   }},//坐标轴刻度相关设置。axisTick:{show:false},axisLabel:{show: true,textStyle: {color: '#000000', //坐标轴文字颜色}},axisTick:{show:true,//是否展示轴刻度inside:true//坐标轴刻度是否朝内},data: ['客户服务', '公共秩序服务', '公共维修服务', '上门维修服务', '绿化养护服务', '公共保洁服务','社区文化建设']             },yAxis: {//坐标轴轴线相关设置。show:'category',type:'value',//自动计算的坐标轴最大间隔大小maxInterval:100,//坐标轴轴线相关设置。axisLine: { show: true, lineStyle: {   //坐标轴线的颜色。color: '#000000'}},axisTick: {show: false},splitLine:{    //坐标轴在 grid 区域中的分隔线。show:true,lineStyle: {     //分隔线颜色color:'#000000',width:0.5   //分隔线线宽。}},axisTick:{show:true,//是否展示轴刻度inside:true,//坐标轴刻度是否朝内},},series: [{name: '满意率',type: 'custom',barWidth:28,   //柱条的宽度color:'#DAA520',/*labelLayout(params, api) {return {x: location[0],y: location[1],verticalAlign: 'top',align: 'left'}},*/renderItem: function(params, api) {const location = api.coord([api.value(0), api.value(1)])return {type: 'group',children: [{//正面type: 'positiveShape',shape: {api,x: location[0],y: location[1],xAxisPoint: api.coord([api.value(0), 0])},style: {fill: '#DAA520'}}, {type: 'rightShape',shape: {api,x: location[0],y: location[1],xAxisPoint: api.coord([api.value(0), 0])},style: {fill: '#444444'}}, {//顶部type: 'topShape',shape: {api,x: location[0],y: location[1],xAxisPoint: api.coord([api.value(0), 0])},style: {fill: '#D8860B'}}]}},data: [{value: 20.4,itemStyle: {color: '#DAA520',}}, {value: 27.4,itemStyle: {color:'#DAA520',} },{value: 90,itemStyle: {color:'#DAA520',}},{value: 20.4,itemStyle: {color:'#DAA520',}},{value: 80,itemStyle: {color:'#DAA520',}},{value: 80,itemStyle: {color:'#DAA520',}},{value: 80,itemStyle: {color:'#DAA520',}}],},{    //柱形顶端显示x轴数据type: "bar",label: {normal: {show: true,position: "top",fontSize: 14,color: "#000000",},},itemStyle: {color: "transparent",},data:['20.4','27.4','90','20.4','80','80','80'],},]};// 使用刚指定的配置项和数据显示图表。myChart.setOption(option);</script></body></html>

编辑完成后需要保存为html文件,否则无法运行。

四、运行

注意:html文件需要和js文件在同一个目录下,否则图像代码编辑当中引入ECharts文件时就需要指定路径。

浏览器打开html文件即可查看运行结果。

想要了解和学习更多图形配置项可浏览Echarts官网

Documentation - Apache ECharts

最后,如果内容对你有帮助,不妨点个赞!!

ECharts实现立体柱形图相关推荐

  1. Echarts 3D立体柱状图(源码+例图)

    Echarts 3D立体柱状图,3D长方体柱状图,直接cope源码可用(源码+例图) 废话不多说,直接上代码!!! // HTML 代码 <div id="litiBar" ...

  2. echarts 实现圆柱体柱形图效果

    前言 记录在 vue 中实现echarts 实现圆柱体柱形图效果 本文使用 echarts 为 5.x 版本 一.效果展示 圆柱体柱形图实现效果 二.echarts图表配置 dom 中使用.初始化 e ...

  3. ECharts: 绘制立体柱状图【圆柱体】

    绘制这个立体的圆柱体柱状图主要由三块组成: 底部 主体 顶部 实现这种效果主要是: ECharts中的 series 属性,通过两种不同类型的图表组合而成. 其中里面的柱体渐变色是通过 ECharts ...

  4. vue echarts 地图立体 并设置tooltip属性背景图片

    这是做完的样子 1.地图立体的代码,map应与series中的一致 //地图立体的代码,map应与series中的一致 geo: {map: '34',aspectScale: 1, //长宽比zoo ...

  5. echarts图表给柱形图的每个柱子设置不同颜色(包括每个柱子设置渐变颜色)

    配置效果 配置每个柱子不同颜色的代码 itemStyle: {normal: {// 线性渐变,前四个参数分别是 x0, y0, x2, y2, 范围从 0 - 1,分别表示右,下,左,上.例如(0, ...

  6. echarts 好看的柱形图

    option = {legend: {},// 鼠标放上显示提示tooltip: {trigger: 'axis', //触发类型 'item'数据项图形触发,主要在散点图,饼图等无类目轴的图表中使用 ...

  7. echarts如何将柱形图的柱子分割成一小块一小块,也就是象形柱图

    关键点:series.type: "pictorialBar", <div class="cl-top-content" id="deviceO ...

  8. echarts怎么实现立体柱状图_Vue中使用Echarts实现立体柱状图(长方体)

    预览: 代码: 页面部分: CSS部分: .roadnum-all { width: 100%; height: 100%; /*填满父级容器*/ } JS部分: import echarts fro ...

  9. 我开发过程中遇到的Echarts地图立体描边问题解决方式

    如果想完成下面这种效果 步骤一.一定是先找到地图的对应JSON文件,可参考此网站(http://datav.aliyun.com/tools/atlas/index.html#&lat=40. ...

最新文章

  1. 和平精英android怎么写符号,和平精英名字特殊符号怎么打 和平精英名字特殊符号输入方法...
  2. linux 反弹shell(一)文件描述符与重定向
  3. php ajax操作数据库,php + ajax 实现的写入数据库操作简单示例
  4. junit No tests found matching Method
  5. DotNet进阶系列
  6. vue 前期准备,项目结构
  7. c#获取文件夹路径(转载)
  8. 【翻译】在Sencha Touch中创建离线/在线代理
  9. 常喝酒的人,为什么会出现手抖的现象?
  10. python贴吧-Python爬虫——抓取贴吧帖子
  11. (1)数据库和MySql初步认识
  12. vba宏语言_Excel VBA(1) – VBA 简介及录制宏
  13. Nginx初学者指南
  14. VS2008SP1安装不上
  15. Nginx 局域网内互传文件
  16. Java迷宫小游戏,老程序员花一天时间完成,你可以吗?
  17. 使用xcode无开发者账号打包.ipa文件
  18. 修复计算机win10,快速修复Win10系统故障的两大通用方法
  19. Chart.js绘图,数据图
  20. 前端性能优化与计算方式

热门文章

  1. 2018年上半年最火热小说排行榜
  2. S4/HANA ME21N创建PO 输出控制消息按钮丢失解决方法(切换EDI 输出模式BRF+至NAST模式)
  3. 刷脸支付有一键成为会员的功能
  4. 职业生涯规划丨入行3D建模多久才能月入过万
  5. iOS-高仿微信摇一摇动画效果加震动音效
  6. [技术发展-14]:高级研修班-智能制造-智能制造技术体系与发展状况
  7. 3d红苹果html,有关html
  8. 米拓后台的head.php,米拓登录界面后台title和logo修改的方法
  9. Android开发之十四: camera(一):camera模组CMM介绍
  10. iOS 10 之 网络权限带来的坑