jmchart 1.2.16 → 1.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -37
- package/dist/jmchart.amd.js +129 -269
- package/dist/jmchart.cjs.js +129 -269
- package/dist/jmchart.esm.js +129 -269
- package/dist/jmchart.iife.js +129 -269
- package/dist/jmchart.system.js +129 -269
- package/index.d.ts +498 -0
- package/package.json +3 -2
- package/src/common/style.js +0 -21
- package/src/jmChart.js +1 -3
- package/src/series/gaugeSeries.js +12 -10
- package/src/series/lineSeries.js +111 -11
- package/src/series/ringProgressSeries.js +5 -3
- package/src/series/sunburstSeries.js +0 -240
package/dist/jmchart.system.js
CHANGED
|
@@ -9663,27 +9663,6 @@ System.register([], (function (exports) {
|
|
|
9663
9663
|
spiral: true,
|
|
9664
9664
|
zIndex: 11,
|
|
9665
9665
|
cursor: 'default'
|
|
9666
|
-
},
|
|
9667
|
-
sunburst: {
|
|
9668
|
-
normal: {
|
|
9669
|
-
zIndex: 11,
|
|
9670
|
-
cursor: 'default'
|
|
9671
|
-
},
|
|
9672
|
-
hover: {
|
|
9673
|
-
cursor: 'pointer'
|
|
9674
|
-
},
|
|
9675
|
-
innerRadius: 0,
|
|
9676
|
-
startAngle: 0,
|
|
9677
|
-
showLabels: true,
|
|
9678
|
-
showCenter: true,
|
|
9679
|
-
centerFill: '#fff',
|
|
9680
|
-
centerStroke: '#e0e0e0',
|
|
9681
|
-
stroke: '#fff',
|
|
9682
|
-
lineWidth: 1,
|
|
9683
|
-
labelColor: '#fff',
|
|
9684
|
-
labelFont: '12px Arial',
|
|
9685
|
-
zIndex: 11,
|
|
9686
|
-
cursor: 'default'
|
|
9687
9666
|
}
|
|
9688
9667
|
};
|
|
9689
9668
|
|
|
@@ -11992,10 +11971,42 @@ System.register([], (function (exports) {
|
|
|
11992
11971
|
this.graph.legend.append(this, shape);
|
|
11993
11972
|
}
|
|
11994
11973
|
|
|
11995
|
-
//
|
|
11996
|
-
createArea(points
|
|
11974
|
+
// 生成面积效果
|
|
11975
|
+
createArea(points) {
|
|
11997
11976
|
// 有指定绘制区域效果才展示
|
|
11998
11977
|
if (!this.style.area || points.length < 2) return;
|
|
11978
|
+
|
|
11979
|
+
// 基线:取X轴的实际Y位置(chartArea相对坐标),没有X轴时用下边界
|
|
11980
|
+
const axisY = this.graph.xAxis ? this.graph.xAxis.start.y - this.graph.chartArea.position.y : this.graph.chartArea.height;
|
|
11981
|
+
|
|
11982
|
+
// 过滤有效点
|
|
11983
|
+
const validPoints = points.filter(p => p.y != null && typeof p.y !== 'undefined');
|
|
11984
|
+
if (validPoints.length < 2) return;
|
|
11985
|
+
|
|
11986
|
+
// 检测所有点是否在基线的同一侧
|
|
11987
|
+
// y < axisY 表示在基线上方(数据值大于基线值),y > axisY 表示在基线下方
|
|
11988
|
+
let allAbove = true;
|
|
11989
|
+
let allBelow = true;
|
|
11990
|
+
for (const p of validPoints) {
|
|
11991
|
+
if (p.y <= axisY) allBelow = false;
|
|
11992
|
+
if (p.y >= axisY) allAbove = false;
|
|
11993
|
+
}
|
|
11994
|
+
if (allAbove || allBelow) {
|
|
11995
|
+
// 全部在基线同侧:创建单个封闭区域
|
|
11996
|
+
this._createAreaSegment(points, allAbove, axisY);
|
|
11997
|
+
} else {
|
|
11998
|
+
// 混合数据:在交叉点处分割,分别创建封闭区域
|
|
11999
|
+
this._createMixedAreas(points, axisY);
|
|
12000
|
+
}
|
|
12001
|
+
}
|
|
12002
|
+
|
|
12003
|
+
/**
|
|
12004
|
+
* 创建单个面积段
|
|
12005
|
+
* @param {Array} points 线条上的点
|
|
12006
|
+
* @param {boolean} isAbove 是否在基线上方
|
|
12007
|
+
* @param {number} axisY 基线Y坐标(chartArea相对坐标)
|
|
12008
|
+
*/
|
|
12009
|
+
_createAreaSegment(points, isAbove, axisY) {
|
|
11999
12010
|
const start = points[0];
|
|
12000
12011
|
const end = points[points.length - 1];
|
|
12001
12012
|
const style = this.graph.utils.clone(this.style.area, {}, true);
|
|
@@ -12003,12 +12014,21 @@ System.register([], (function (exports) {
|
|
|
12003
12014
|
style.stroke = style.stroke || 'transparent';
|
|
12004
12015
|
if (!style.fill) {
|
|
12005
12016
|
const color = this.graph.utils.hexToRGBA(this.style.stroke);
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12017
|
+
if (isAbove) {
|
|
12018
|
+
// 基线上方:渐变从线条处(顶部)不透明到基线处(底部)透明
|
|
12019
|
+
style.fill = `linear-gradient(50% 0 50% 100%,
|
|
12020
|
+
rgba(${color.r},${color.g},${color.b}, 0) 1,
|
|
12021
|
+
rgba(${color.r},${color.g},${color.b}, 0.1) 0.7,
|
|
12022
|
+
rgba(${color.r},${color.g},${color.b}, 0.3) 0)`;
|
|
12023
|
+
} else {
|
|
12024
|
+
// 基线下方:渐变从基线处(顶部)透明到线条处(底部)不透明
|
|
12025
|
+
style.fill = `linear-gradient(50% 0 50% 100%,
|
|
12026
|
+
rgba(${color.r},${color.g},${color.b}, 0.3) 1,
|
|
12027
|
+
rgba(${color.r},${color.g},${color.b}, 0.1) 0.3,
|
|
12028
|
+
rgba(${color.r},${color.g},${color.b}, 0) 0)`;
|
|
12029
|
+
}
|
|
12010
12030
|
} else if (typeof style.fill === 'function') {
|
|
12011
|
-
style.fill = style.fill.call(this, style);
|
|
12031
|
+
style.fill = style.fill.call(this, style, isAbove);
|
|
12012
12032
|
}
|
|
12013
12033
|
const area = this.graph.createShape('path', {
|
|
12014
12034
|
points: this.graph.utils.clone(points, true),
|
|
@@ -12017,19 +12037,78 @@ System.register([], (function (exports) {
|
|
|
12017
12037
|
height: this.graph.chartArea.height
|
|
12018
12038
|
});
|
|
12019
12039
|
|
|
12020
|
-
//
|
|
12021
|
-
|
|
12040
|
+
// 在首尾加上基线上的点,组成封闭多边形
|
|
12041
|
+
// 如果首/尾点已经在基线上(交叉点),则不重复添加
|
|
12042
|
+
if (Math.abs(start.y - axisY) > 0.5) {
|
|
12022
12043
|
area.points.unshift({
|
|
12023
12044
|
x: start.x,
|
|
12024
|
-
y:
|
|
12045
|
+
y: axisY
|
|
12025
12046
|
});
|
|
12047
|
+
}
|
|
12048
|
+
if (Math.abs(end.y - axisY) > 0.5) {
|
|
12026
12049
|
area.points.push({
|
|
12027
12050
|
x: end.x,
|
|
12028
|
-
y:
|
|
12051
|
+
y: axisY
|
|
12029
12052
|
});
|
|
12030
12053
|
}
|
|
12031
12054
|
this.addShape(area);
|
|
12032
12055
|
}
|
|
12056
|
+
|
|
12057
|
+
/**
|
|
12058
|
+
* 处理跨基线的混合数据,在交叉点处分割成多个独立区域
|
|
12059
|
+
* @param {Array} points 线条上的点
|
|
12060
|
+
* @param {number} axisY 基线Y坐标(chartArea相对坐标)
|
|
12061
|
+
*/
|
|
12062
|
+
_createMixedAreas(points, axisY) {
|
|
12063
|
+
const segments = [];
|
|
12064
|
+
let currentSegment = [];
|
|
12065
|
+
let prevAbove = null;
|
|
12066
|
+
for (let i = 0; i < points.length; i++) {
|
|
12067
|
+
const p = points[i];
|
|
12068
|
+
if (p.y == null || typeof p.y === 'undefined') continue;
|
|
12069
|
+
const isAbove = p.y < axisY;
|
|
12070
|
+
if (currentSegment.length === 0) {
|
|
12071
|
+
currentSegment.push(p);
|
|
12072
|
+
prevAbove = isAbove;
|
|
12073
|
+
} else if (isAbove === prevAbove) {
|
|
12074
|
+
currentSegment.push(p);
|
|
12075
|
+
} else {
|
|
12076
|
+
// 检测到跨基线交叉:计算交叉点
|
|
12077
|
+
const prev = currentSegment[currentSegment.length - 1];
|
|
12078
|
+
const t = (axisY - prev.y) / (p.y - prev.y);
|
|
12079
|
+
const crossPoint = {
|
|
12080
|
+
x: prev.x + (p.x - prev.x) * t,
|
|
12081
|
+
y: axisY
|
|
12082
|
+
};
|
|
12083
|
+
|
|
12084
|
+
// 当前段在交叉点处结束
|
|
12085
|
+
currentSegment.push(crossPoint);
|
|
12086
|
+
if (currentSegment.length >= 2) {
|
|
12087
|
+
segments.push({
|
|
12088
|
+
points: [...currentSegment],
|
|
12089
|
+
above: prevAbove
|
|
12090
|
+
});
|
|
12091
|
+
}
|
|
12092
|
+
|
|
12093
|
+
// 新段从交叉点开始
|
|
12094
|
+
currentSegment = [crossPoint, p];
|
|
12095
|
+
prevAbove = isAbove;
|
|
12096
|
+
}
|
|
12097
|
+
}
|
|
12098
|
+
|
|
12099
|
+
// 最后一段
|
|
12100
|
+
if (currentSegment.length >= 2) {
|
|
12101
|
+
segments.push({
|
|
12102
|
+
points: currentSegment,
|
|
12103
|
+
above: prevAbove
|
|
12104
|
+
});
|
|
12105
|
+
}
|
|
12106
|
+
|
|
12107
|
+
// 为每段创建独立的面积
|
|
12108
|
+
for (const seg of segments) {
|
|
12109
|
+
this._createAreaSegment(seg.points, seg.above, axisY);
|
|
12110
|
+
}
|
|
12111
|
+
}
|
|
12033
12112
|
}
|
|
12034
12113
|
|
|
12035
12114
|
/**
|
|
@@ -12697,8 +12776,10 @@ System.register([], (function (exports) {
|
|
|
12697
12776
|
const value = typeof p.yValue === 'number' ? p.yValue : 0;
|
|
12698
12777
|
const min = this.style.min || 0;
|
|
12699
12778
|
const max = this.style.max || 100;
|
|
12700
|
-
|
|
12701
|
-
const
|
|
12779
|
+
// 度数转弧度(jmArc 内部使用弧度)
|
|
12780
|
+
const DEG = Math.PI / 180;
|
|
12781
|
+
const startAngle = (this.style.startAngle || -150) * DEG;
|
|
12782
|
+
const endAngle = (this.style.endAngle || 150) * DEG;
|
|
12702
12783
|
const angleRange = endAngle - startAngle;
|
|
12703
12784
|
const normalizedValue = Math.max(min, Math.min(max, value));
|
|
12704
12785
|
const ratio = (normalizedValue - min) / (max - min);
|
|
@@ -12779,10 +12860,10 @@ System.register([], (function (exports) {
|
|
|
12779
12860
|
for (let i = 0; i < tickCount; i++) {
|
|
12780
12861
|
const angle = startAngle + angleStep * i;
|
|
12781
12862
|
const value = min + (max - min) / (tickCount - 1) * i;
|
|
12782
|
-
const tickStartX = centerX + Math.cos(angle
|
|
12783
|
-
const tickStartY = centerY + Math.sin(angle
|
|
12784
|
-
const tickEndX = centerX + Math.cos(angle
|
|
12785
|
-
const tickEndY = centerY + Math.sin(angle
|
|
12863
|
+
const tickStartX = centerX + Math.cos(angle) * (radius - 30);
|
|
12864
|
+
const tickStartY = centerY + Math.sin(angle) * (radius - 30);
|
|
12865
|
+
const tickEndX = centerX + Math.cos(angle) * (radius - 10);
|
|
12866
|
+
const tickEndY = centerY + Math.sin(angle) * (radius - 10);
|
|
12786
12867
|
const tickLine = this.graph.createShape('line', {
|
|
12787
12868
|
style: {
|
|
12788
12869
|
stroke: this.style.tickColor || '#666',
|
|
@@ -12799,8 +12880,8 @@ System.register([], (function (exports) {
|
|
|
12799
12880
|
}
|
|
12800
12881
|
});
|
|
12801
12882
|
this.addShape(tickLine);
|
|
12802
|
-
const labelX = centerX + Math.cos(angle
|
|
12803
|
-
const labelY = centerY + Math.sin(angle
|
|
12883
|
+
const labelX = centerX + Math.cos(angle) * (radius - 45);
|
|
12884
|
+
const labelY = centerY + Math.sin(angle) * (radius - 45);
|
|
12804
12885
|
const tickLabel = this.graph.createShape('label', {
|
|
12805
12886
|
style: {
|
|
12806
12887
|
fill: this.style.tickLabelColor || '#333',
|
|
@@ -12824,8 +12905,8 @@ System.register([], (function (exports) {
|
|
|
12824
12905
|
*/
|
|
12825
12906
|
createGaugePointer(centerX, centerY, radius, angle) {
|
|
12826
12907
|
const pointerLength = radius * 0.7;
|
|
12827
|
-
const pointerX = centerX + Math.cos(angle
|
|
12828
|
-
const pointerY = centerY + Math.sin(angle
|
|
12908
|
+
const pointerX = centerX + Math.cos(angle) * pointerLength;
|
|
12909
|
+
const pointerY = centerY + Math.sin(angle) * pointerLength;
|
|
12829
12910
|
const pointerLine = this.graph.createShape('line', {
|
|
12830
12911
|
style: {
|
|
12831
12912
|
stroke: this.style.pointerColor || '#333',
|
|
@@ -13364,7 +13445,9 @@ System.register([], (function (exports) {
|
|
|
13364
13445
|
const centerY = chartHeight / 2;
|
|
13365
13446
|
const maxRadius = Math.min(chartWidth, chartHeight) / 2 - 20;
|
|
13366
13447
|
const lineWidth = this.style.lineWidth || 20;
|
|
13367
|
-
|
|
13448
|
+
// 角度转弧度(jmArc 内部使用弧度)
|
|
13449
|
+
const DEG = Math.PI / 180;
|
|
13450
|
+
const startAngle = (this.style.startAngle !== undefined ? this.style.startAngle : -90) * DEG;
|
|
13368
13451
|
const maxValue = this.style.max || 100;
|
|
13369
13452
|
const field = this.field || 'value';
|
|
13370
13453
|
const len = data.length;
|
|
@@ -13402,7 +13485,7 @@ System.register([], (function (exports) {
|
|
|
13402
13485
|
},
|
|
13403
13486
|
radius: radius,
|
|
13404
13487
|
startAngle: 0,
|
|
13405
|
-
endAngle:
|
|
13488
|
+
endAngle: Math.PI * 2
|
|
13406
13489
|
});
|
|
13407
13490
|
this.addShape(bgArc);
|
|
13408
13491
|
}
|
|
@@ -13413,7 +13496,7 @@ System.register([], (function (exports) {
|
|
|
13413
13496
|
createRingProgress(centerX, centerY, radius, lineWidth, startAngle, ratio, index) {
|
|
13414
13497
|
if (ratio <= 0) return;
|
|
13415
13498
|
const color = this.getColor(null, index);
|
|
13416
|
-
const endAngle = startAngle + ratio *
|
|
13499
|
+
const endAngle = startAngle + ratio * Math.PI * 2;
|
|
13417
13500
|
const progressArc = this.graph.createShape('arc', {
|
|
13418
13501
|
style: {
|
|
13419
13502
|
stroke: color,
|
|
@@ -13969,228 +14052,6 @@ System.register([], (function (exports) {
|
|
|
13969
14052
|
}
|
|
13970
14053
|
}
|
|
13971
14054
|
|
|
13972
|
-
/**
|
|
13973
|
-
* 旭日图
|
|
13974
|
-
*
|
|
13975
|
-
* 旭日图用于展示层级数据的占比关系,由多个同心圆环组成,每个圆环代表一个层级。
|
|
13976
|
-
* 内层圆环是外层圆环的父级,扇形角度代表数据占比。
|
|
13977
|
-
*
|
|
13978
|
-
* 数据格式要求:
|
|
13979
|
-
* - 树形结构数据,每个节点包含 name、value 和 children
|
|
13980
|
-
*
|
|
13981
|
-
* 样式配置:
|
|
13982
|
-
* - innerRadius: 内圆半径,默认 0
|
|
13983
|
-
* - startAngle: 起始角度,默认 0
|
|
13984
|
-
* - showLabels: 是否显示标签,默认 true
|
|
13985
|
-
*
|
|
13986
|
-
* @class jmSunburstSeries
|
|
13987
|
-
* @module jmChart
|
|
13988
|
-
* @extends jmSeries
|
|
13989
|
-
*
|
|
13990
|
-
* @example
|
|
13991
|
-
* chart.createSeries('sunburst', {
|
|
13992
|
-
* data: [{
|
|
13993
|
-
* name: 'Root',
|
|
13994
|
-
* children: [
|
|
13995
|
-
* { name: 'A', value: 30 },
|
|
13996
|
-
* { name: 'B', value: 70 }
|
|
13997
|
-
* ]
|
|
13998
|
-
* }]
|
|
13999
|
-
* });
|
|
14000
|
-
*/
|
|
14001
|
-
class jmSunburstSeries extends jmSeries {
|
|
14002
|
-
constructor(options) {
|
|
14003
|
-
options.style = options.style || options.graph.style.sunburst;
|
|
14004
|
-
super(options);
|
|
14005
|
-
this.maxDepth = 0;
|
|
14006
|
-
}
|
|
14007
|
-
|
|
14008
|
-
/**
|
|
14009
|
-
* 初始化旭日图
|
|
14010
|
-
*/
|
|
14011
|
-
init() {
|
|
14012
|
-
const data = this.option.data || this.data;
|
|
14013
|
-
if (!data || !data.length) return;
|
|
14014
|
-
const chartWidth = this.graph.chartArea.width;
|
|
14015
|
-
const chartHeight = this.graph.chartArea.height;
|
|
14016
|
-
const centerX = chartWidth / 2;
|
|
14017
|
-
const centerY = chartHeight / 2;
|
|
14018
|
-
const maxRadius = Math.min(chartWidth, chartHeight) / 2 - 20;
|
|
14019
|
-
this.maxDepth = this.calculateMaxDepth(data);
|
|
14020
|
-
if (this.maxDepth === 0) return;
|
|
14021
|
-
const ringWidth = maxRadius / this.maxDepth;
|
|
14022
|
-
const innerRadius = this.style.innerRadius || 0;
|
|
14023
|
-
this.drawLevel(data, centerX, centerY, innerRadius, ringWidth, 0, 360, 0);
|
|
14024
|
-
if (this.style.showCenter !== false && innerRadius > 0) {
|
|
14025
|
-
this.drawCenter(centerX, centerY, innerRadius);
|
|
14026
|
-
}
|
|
14027
|
-
}
|
|
14028
|
-
|
|
14029
|
-
/**
|
|
14030
|
-
* 计算最大深度
|
|
14031
|
-
*/
|
|
14032
|
-
calculateMaxDepth(data, depth = 1) {
|
|
14033
|
-
let maxDepth = depth;
|
|
14034
|
-
for (const node of data) {
|
|
14035
|
-
if (node.children && node.children.length > 0) {
|
|
14036
|
-
const childDepth = this.calculateMaxDepth(node.children, depth + 1);
|
|
14037
|
-
maxDepth = Math.max(maxDepth, childDepth);
|
|
14038
|
-
}
|
|
14039
|
-
}
|
|
14040
|
-
return maxDepth;
|
|
14041
|
-
}
|
|
14042
|
-
|
|
14043
|
-
/**
|
|
14044
|
-
* 计算节点总值
|
|
14045
|
-
*/
|
|
14046
|
-
calculateTotalValue(data) {
|
|
14047
|
-
let total = 0;
|
|
14048
|
-
for (const node of data) {
|
|
14049
|
-
if (node.children && node.children.length > 0) {
|
|
14050
|
-
total += this.calculateTotalValue(node.children);
|
|
14051
|
-
} else {
|
|
14052
|
-
total += node.value || 0;
|
|
14053
|
-
}
|
|
14054
|
-
}
|
|
14055
|
-
return total;
|
|
14056
|
-
}
|
|
14057
|
-
|
|
14058
|
-
/**
|
|
14059
|
-
* 绘制层级
|
|
14060
|
-
*/
|
|
14061
|
-
drawLevel(data, centerX, centerY, innerRadius, ringWidth, startAngle, totalAngle, level) {
|
|
14062
|
-
const total = this.calculateTotalValue(data);
|
|
14063
|
-
if (total === 0) return;
|
|
14064
|
-
let currentAngle = startAngle;
|
|
14065
|
-
const outerRadius = innerRadius + ringWidth;
|
|
14066
|
-
for (const node of data) {
|
|
14067
|
-
let nodeValue = 0;
|
|
14068
|
-
if (node.children && node.children.length > 0) {
|
|
14069
|
-
nodeValue = this.calculateTotalValue(node.children);
|
|
14070
|
-
} else {
|
|
14071
|
-
nodeValue = node.value || 0;
|
|
14072
|
-
}
|
|
14073
|
-
const angleRatio = nodeValue / total;
|
|
14074
|
-
const nodeAngle = totalAngle * angleRatio;
|
|
14075
|
-
const endAngle = currentAngle + nodeAngle;
|
|
14076
|
-
if (nodeAngle > 0.1) {
|
|
14077
|
-
const color = this.getColor(node, level);
|
|
14078
|
-
this.drawArc(centerX, centerY, innerRadius, outerRadius, currentAngle, endAngle, color, node);
|
|
14079
|
-
if (this.style.showLabels !== false && nodeAngle > 10) {
|
|
14080
|
-
this.drawLabel(centerX, centerY, innerRadius, outerRadius, currentAngle, endAngle, node);
|
|
14081
|
-
}
|
|
14082
|
-
if (node.children && node.children.length > 0) {
|
|
14083
|
-
this.drawLevel(node.children, centerX, centerY, outerRadius, ringWidth, currentAngle, nodeAngle, level + 1);
|
|
14084
|
-
}
|
|
14085
|
-
}
|
|
14086
|
-
currentAngle = endAngle;
|
|
14087
|
-
}
|
|
14088
|
-
}
|
|
14089
|
-
|
|
14090
|
-
/**
|
|
14091
|
-
* 绘制扇形
|
|
14092
|
-
*/
|
|
14093
|
-
drawArc(centerX, centerY, innerRadius, outerRadius, startAngle, endAngle, color, node) {
|
|
14094
|
-
const arc = this.graph.createShape('arc', {
|
|
14095
|
-
style: {
|
|
14096
|
-
fill: color,
|
|
14097
|
-
stroke: this.style.stroke || '#fff',
|
|
14098
|
-
lineWidth: this.style.lineWidth || 1,
|
|
14099
|
-
zIndex: 1
|
|
14100
|
-
},
|
|
14101
|
-
center: {
|
|
14102
|
-
x: centerX,
|
|
14103
|
-
y: centerY
|
|
14104
|
-
},
|
|
14105
|
-
radius: outerRadius,
|
|
14106
|
-
innerRadius: innerRadius,
|
|
14107
|
-
startAngle: startAngle - 90,
|
|
14108
|
-
endAngle: endAngle - 90
|
|
14109
|
-
});
|
|
14110
|
-
this.addShape(arc);
|
|
14111
|
-
node.shape = arc;
|
|
14112
|
-
}
|
|
14113
|
-
|
|
14114
|
-
/**
|
|
14115
|
-
* 绘制标签
|
|
14116
|
-
*/
|
|
14117
|
-
drawLabel(centerX, centerY, innerRadius, outerRadius, startAngle, endAngle, node) {
|
|
14118
|
-
const midAngle = (startAngle + endAngle) / 2 - 90;
|
|
14119
|
-
const midRadius = (innerRadius + outerRadius) / 2;
|
|
14120
|
-
const x = centerX + midRadius * Math.cos(midAngle * Math.PI / 180);
|
|
14121
|
-
const y = centerY + midRadius * Math.sin(midAngle * Math.PI / 180);
|
|
14122
|
-
const text = node.name || '';
|
|
14123
|
-
if (!text) return;
|
|
14124
|
-
const label = this.graph.createShape('label', {
|
|
14125
|
-
style: {
|
|
14126
|
-
fill: this.style.labelColor || '#fff',
|
|
14127
|
-
font: this.style.labelFont || '12px Arial',
|
|
14128
|
-
textAlign: 'center',
|
|
14129
|
-
textBaseline: 'middle',
|
|
14130
|
-
zIndex: 10
|
|
14131
|
-
},
|
|
14132
|
-
text: text,
|
|
14133
|
-
position: {
|
|
14134
|
-
x,
|
|
14135
|
-
y
|
|
14136
|
-
}
|
|
14137
|
-
});
|
|
14138
|
-
this.addShape(label);
|
|
14139
|
-
}
|
|
14140
|
-
|
|
14141
|
-
/**
|
|
14142
|
-
* 绘制中心
|
|
14143
|
-
*/
|
|
14144
|
-
drawCenter(centerX, centerY, innerRadius) {
|
|
14145
|
-
const centerCircle = this.graph.createShape('circle', {
|
|
14146
|
-
style: {
|
|
14147
|
-
fill: this.style.centerFill || '#fff',
|
|
14148
|
-
stroke: this.style.centerStroke || '#e0e0e0',
|
|
14149
|
-
lineWidth: 1,
|
|
14150
|
-
zIndex: 0
|
|
14151
|
-
},
|
|
14152
|
-
center: {
|
|
14153
|
-
x: centerX,
|
|
14154
|
-
y: centerY
|
|
14155
|
-
},
|
|
14156
|
-
radius: innerRadius
|
|
14157
|
-
});
|
|
14158
|
-
this.addShape(centerCircle);
|
|
14159
|
-
}
|
|
14160
|
-
|
|
14161
|
-
/**
|
|
14162
|
-
* 获取颜色
|
|
14163
|
-
*/
|
|
14164
|
-
getColor(node, level) {
|
|
14165
|
-
if (node.color) return node.color;
|
|
14166
|
-
if (this.style.colors && this.style.colors.length > 0) {
|
|
14167
|
-
return this.style.colors[level % this.style.colors.length];
|
|
14168
|
-
}
|
|
14169
|
-
if (typeof this.style.color === 'function') {
|
|
14170
|
-
return this.style.color.call(this, node, level);
|
|
14171
|
-
}
|
|
14172
|
-
return this.graph.getColor(level);
|
|
14173
|
-
}
|
|
14174
|
-
|
|
14175
|
-
/**
|
|
14176
|
-
* 生成图例
|
|
14177
|
-
*/
|
|
14178
|
-
createLegend() {
|
|
14179
|
-
const style = this.graph.utils.clone(this.style);
|
|
14180
|
-
style.fill = this.style.color || this.graph.getColor(0);
|
|
14181
|
-
style.stroke = style.fill;
|
|
14182
|
-
const shape = this.graph.createShape('circle', {
|
|
14183
|
-
style: style,
|
|
14184
|
-
center: {
|
|
14185
|
-
x: this.graph.style.legend.item.shape.width / 2,
|
|
14186
|
-
y: this.graph.style.legend.item.shape.height / 2
|
|
14187
|
-
},
|
|
14188
|
-
radius: this.graph.style.legend.item.shape.height / 2
|
|
14189
|
-
});
|
|
14190
|
-
this.graph.legend.append(this, shape);
|
|
14191
|
-
}
|
|
14192
|
-
}
|
|
14193
|
-
|
|
14194
14055
|
/**
|
|
14195
14056
|
* 轴
|
|
14196
14057
|
*
|
|
@@ -14910,8 +14771,7 @@ System.register([], (function (exports) {
|
|
|
14910
14771
|
'funnel': jmFunnelSeries,
|
|
14911
14772
|
'ringProgress': jmRingProgressSeries,
|
|
14912
14773
|
'boxPlot': jmBoxPlotSeries,
|
|
14913
|
-
'wordCloud': jmWordCloudSeries
|
|
14914
|
-
'sunburst': jmSunburstSeries
|
|
14774
|
+
'wordCloud': jmWordCloudSeries
|
|
14915
14775
|
};
|
|
14916
14776
|
}
|
|
14917
14777
|
|