|
@@ -15,7 +15,7 @@ let cli1 = [
|
|
|
"255,127,80",
|
|
|
"255,99,71",
|
|
|
"255,0,0",
|
|
|
-], index = 0;
|
|
|
+], index = 0, index1 = 0;
|
|
|
// 绘制柱状图顶部
|
|
|
registerShape('interval', 'triangle', {
|
|
|
// 1. 定义关键点
|
|
@@ -33,13 +33,14 @@ registerShape('interval', 'triangle', {
|
|
|
// 2. 绘制
|
|
|
draw(cfg, group) {
|
|
|
const points = this.parsePoints(cfg.points); // 将0-1空间的坐标转换为画布坐标
|
|
|
+ const more = (points[2].x - points[0].x)/4;
|
|
|
const polygon = group.addShape('path', {
|
|
|
attrs: {
|
|
|
path: [
|
|
|
- ['M', points[0].x, points[0].y],
|
|
|
- ['L', points[1].x, points[1].y],
|
|
|
- ['L', points[2].x, points[2].y],
|
|
|
- ['L', points[3].x, points[3].y],
|
|
|
+ ['M', points[0].x, points[0].y], // 左点
|
|
|
+ ['L', points[1].x, points[0].y+more], // 上点
|
|
|
+ ['L', points[2].x, points[2].y], // 右点
|
|
|
+ ['L', points[3].x, points[0].y-more], // 下点
|
|
|
],
|
|
|
fillOpacity: 0.95,
|
|
|
fill: `rgb(${cli1[index % cli1.length]})`
|
|
@@ -77,10 +78,10 @@ registerShape('interval', 'edgeLine', {
|
|
|
['L', points[3].x, points[3].y],
|
|
|
],
|
|
|
fillOpacity: 1,
|
|
|
- fill: `l(90) 0:rgba(${cli1[index % cli1.length]}, 1) 1:rgba(${cli1[index % cli1.length]}, 0.4)`
|
|
|
+ fill: `l(90) 0:rgba(${cli1[index1 % cli1.length]}, 1) 1:rgba(${cli1[index1 % cli1.length]}, 0.4)`
|
|
|
},
|
|
|
});
|
|
|
- index++
|
|
|
+ index1++
|
|
|
return polygon;
|
|
|
},
|
|
|
})
|