当前位置: 首页 > news >正文

学校设计网站方案学校教育培训机构

学校设计网站方案,学校教育培训机构,销售公司怎么做网站,好玩的网站源码通过Echarts的echarts.graphic.extendShape实现真正的3D柱状图 思路就是通过调整顶部面(CubeTop)、左侧面(CubeLeft)、右侧面(CubeRight)来决定柱状图的宽窄 建议优先调整顶部面,一般c1不需要动 // echarts-3D-bar-config.js import Vue from "vue";cons…

通过Echarts的echarts.graphic.extendShape实现真正的3D柱状图
思路就是通过调整顶部面(CubeTop)、左侧面(CubeLeft)、右侧面(CubeRight)来决定柱状图的宽窄
建议优先调整顶部面,一般c1不需要动

// echarts-3D-bar-config.js
import Vue from "vue";const echarts = Vue.prototype.echarts;const CubeLeft = echarts.graphic.extendShape({shape: {x: 0,y: 0},buildPath: function (ctx, shape) {const xAxisPoint = shape.xAxisPoint;// 顶部右侧顶点const c1 = [shape.x, shape.y];// 顶部左侧顶点const c2 = [shape.x - 15, shape.y - 8];// 底部左侧const c3 = [xAxisPoint[0] - 15, xAxisPoint[1] - 8];// 底部右侧const c4 = [xAxisPoint[0], xAxisPoint[1]];ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();}
});const CubeRight = echarts.graphic.extendShape({shape: {x: 0,y: 0},buildPath: function (ctx, shape) {const xAxisPoint = shape.xAxisPoint;// 顶部左侧顶点const c1 = [shape.x, shape.y];// 底部左侧顶点const c2 = [xAxisPoint[0], xAxisPoint[1]];// 底部右侧顶点const c3 = [xAxisPoint[0] + 15, xAxisPoint[1] - 8];// 顶部右侧顶点const c4 = [shape.x + 15, shape.y - 8];ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();}
});const CubeTop = echarts.graphic.extendShape({shape: {x: 0,y: 0},buildPath: function (ctx, shape) {// 底部顶点const c1 = [shape.x, shape.y];// 右侧顶点const c2 = [shape.x + 15, shape.y - 8];// 顶部顶点const c3 = [shape.x, shape.y - 15];// 右侧顶点const c4 = [shape.x - 15, shape.y - 8];ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();}
});
echarts.graphic.registerShape("CubeLeft", CubeLeft);
echarts.graphic.registerShape("CubeRight", CubeRight);
echarts.graphic.registerShape("CubeTop", CubeTop);

然后在build-bar-option中引用即可
这里主要就是把series中的内容复制过来直接用就行了


import Vue from "vue";
import "./echarts-3D-Bar-config"const echarts = Vue.prototype.echarts;export function buildBarOption(vm, xData = [], seriesData = [], originData = []) {const option = {xAxis: {type: "category",axisLabel: {color: "#fff",rotate: 45,fontSize: 10},axisTick: {show: false},axisLine: {show: true,lineStyle: {color: "rgb(53, 179, 229)",width: 2}},data: xData},tooltip: {trigger: "item",axisPointer: {type: "shadow",label: {show: true}},backgroundColor: "transparent",padding: 0,formatter: function (params) {// console.log(params)return `<div style="padding: 15px; background: linear-gradient(180.00deg, rgb(3, 36, 76),rgb(19, 36, 127) 100%)"><p>test</p>     </div>`;}},grid: {left: "15",bottom: "10",right: "10",top: "40",containLabel: true},yAxis: {type: "value",axisLabel: {color: "#fff"},splitLine: {show: true,lineStyle: {type: "dotted",color: "rgb(53, 179, 229)"}}},series: [{type: "custom",renderItem: (params, api) => {const location = api.coord([api.value(0), api.value(1)]);return {type: "group",children: [{type: "CubeLeft",shape: {api,xValue: api.value(0),yValue: api.value(1),x: location[0],y: location[1],xAxisPoint: api.coord([api.value(0), 0])},style: {fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0,color: "#3B80E2"},{offset: 1,color: "#49BEE5"}])}},{type: "CubeRight",shape: {api,xValue: api.value(0),yValue: api.value(1),x: location[0],y: location[1],xAxisPoint: api.coord([api.value(0), 0])},style: {fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0,color: "#3B80E2"},{offset: 1,color: "#49BEE5"}])}},{type: "CubeTop",shape: {api,xValue: api.value(0),yValue: api.value(1),x: location[0],y: location[1],xAxisPoint: api.coord([api.value(0), 0])},style: {fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0,color: "#3B80E2"},{offset: 1,color: "#49BEE5"}])}}]};},data: seriesData},{data: seriesData,type: "bar",barWidth: 13,itemStyle: {color: "transparent"}}]};return option;
}
http://www.hrbkazy.com/news/23369.html

相关文章:

  • 云南SEO网站建设宣传软文是什么意思
  • 做招聘网站用哪个cms跨境电商网站
  • 石家庄市官方网站腾讯广告联盟官网
  • 国外那些网站是做五金饰品批发网站开发公司排名
  • 天动力网站开发如何在互联网推广自己的产品
  • 北京科技网站开发seo是什么意思啊
  • wordpress建的网站如何跟微信集成学百度推广培训
  • 秦皇岛网站建设公司怎么发帖子做推广
  • 网站建设网站需要什么网络营销心得体会1000字
  • 网站做301将重定向到新域名seo优化网站推广
  • 一个空间如何做2个网站广告优化师是做什么的
  • wordpress is front网站seo置顶
  • 黑龙江省建设安全协会网站建站系统推荐
  • 织梦资源网模板seo 优化是什么
  • 哪些网站可以用来做百科参考百度网页
  • 网页设计站点网站搜索引擎优化
  • 创建一个网站需要做哪些工作浙江疫情最新消息
  • 做百度竞价网站修改影响排名吗电商运营数据六大指标
  • 做响应式网站多少钱合肥搜索引擎推广
  • 网络科技网站竞价托管怎么做
  • 成品网站w灬 源码1688网页什么是网络营销策略
  • 网站被重定向跳转学历提升
  • 在线网站制作淘大象关键词排名查询
  • 利用网站做蜘蛛池关键词排名优化技巧
  • 松原建设小学网站宁波网站建设团队
  • 网站生成app 免费工具最佳bt磁力狗
  • 网站如何做ssl认证凡科建站登录官网
  • 网站怎么设置二级域名市场调研报告范文模板word
  • 怎么做网站注册推广百度一下浏览器
  • 小程序模板图片网站性能优化