jmchart 1.2.16 → 1.2.18

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 CHANGED
@@ -11,7 +11,7 @@ jmchart 是一个轻量级、高性能的图表组件,支持微信小程序,
11
11
 
12
12
  - **轻量级**:代码体积小,加载速度快
13
13
  - **高性能**:优化的渲染引擎,支持大数据量
14
- - **多图表类型**:支持 17+ 种图表类型
14
+ - **多图表类型**:支持 16+ 种图表类型
15
15
  - **动画效果**:支持流畅的入场动画
16
16
  - **响应式**:自适应容器大小
17
17
  - **跨平台**:支持浏览器和微信小程序
@@ -46,7 +46,6 @@ jmchart 是一个轻量级、高性能的图表组件,支持微信小程序,
46
46
  | 漏斗图 | `funnel` | 展示转化率分析 |
47
47
  | 环形进度图 | `ringProgress` | 展示进度完成情况 |
48
48
  | 词云图 | `wordCloud` | 展示文本词频分布 |
49
- | 旭日图 | `sunburst` | 展示层级数据占比 |
50
49
  | 范围图 | `range` | 展示数据的上下限范围 |
51
50
  | 堆叠柱状图 | `stackBar` | 多系列数据堆叠 |
52
51
 
@@ -523,40 +522,6 @@ chart.data = [
523
522
  ];
524
523
  ```
525
524
 
526
- #### 旭日图
527
-
528
- ```javascript
529
- chart.createSeries('sunburst', {
530
- data: sunburstData, // 树形结构数据
531
- style: {
532
- innerRadius: 30, // 内圆半径
533
- showLabels: true, // 是否显示标签
534
- stroke: '#fff', // 边框颜色
535
- labelColor: '#fff' // 标签颜色
536
- }
537
- });
538
- // 数据格式(树形结构)
539
- const sunburstData = [{
540
- name: '根节点',
541
- children: [
542
- {
543
- name: '分类A',
544
- children: [
545
- { name: 'A1', value: 30 },
546
- { name: 'A2', value: 20 }
547
- ]
548
- },
549
- {
550
- name: '分类B',
551
- children: [
552
- { name: 'B1', value: 25 },
553
- { name: 'B2', value: 35 }
554
- ]
555
- }
556
- ]
557
- }];
558
- ```
559
-
560
525
  ## API 文档
561
526
 
562
527
  ### jmChart 类
@@ -634,7 +599,7 @@ MIT
634
599
  ## 更新日志
635
600
 
636
601
  ### v1.3.0
637
- - 新增图表类型:漏斗图、环形进度图、箱线图、词云图、旭日图
602
+ - 新增图表类型:漏斗图、环形进度图、箱线图、词云图
638
603
  - 新增综合示例页面 (all-charts.html)
639
604
  - 优化图表数据处理逻辑,支持无坐标轴图表
640
605
  - 完善文档和代码注释
@@ -9660,27 +9660,6 @@ define(['exports'], (function (exports) { 'use strict';
9660
9660
  spiral: true,
9661
9661
  zIndex: 11,
9662
9662
  cursor: 'default'
9663
- },
9664
- sunburst: {
9665
- normal: {
9666
- zIndex: 11,
9667
- cursor: 'default'
9668
- },
9669
- hover: {
9670
- cursor: 'pointer'
9671
- },
9672
- innerRadius: 0,
9673
- startAngle: 0,
9674
- showLabels: true,
9675
- showCenter: true,
9676
- centerFill: '#fff',
9677
- centerStroke: '#e0e0e0',
9678
- stroke: '#fff',
9679
- lineWidth: 1,
9680
- labelColor: '#fff',
9681
- labelFont: '12px Arial',
9682
- zIndex: 11,
9683
- cursor: 'default'
9684
9663
  }
9685
9664
  };
9686
9665
 
@@ -11989,10 +11968,42 @@ define(['exports'], (function (exports) { 'use strict';
11989
11968
  this.graph.legend.append(this, shape);
11990
11969
  }
11991
11970
 
11992
- // 生成布效果
11993
- createArea(points, needClosePoint = true) {
11971
+ // 生成面积效果
11972
+ createArea(points) {
11994
11973
  // 有指定绘制区域效果才展示
11995
11974
  if (!this.style.area || points.length < 2) return;
11975
+
11976
+ // 基线:取X轴的实际Y位置(chartArea相对坐标),没有X轴时用下边界
11977
+ const axisY = this.graph.xAxis ? this.graph.xAxis.start.y - this.graph.chartArea.position.y : this.graph.chartArea.height;
11978
+
11979
+ // 过滤有效点
11980
+ const validPoints = points.filter(p => p.y != null && typeof p.y !== 'undefined');
11981
+ if (validPoints.length < 2) return;
11982
+
11983
+ // 检测所有点是否在基线的同一侧
11984
+ // y < axisY 表示在基线上方(数据值大于基线值),y > axisY 表示在基线下方
11985
+ let allAbove = true;
11986
+ let allBelow = true;
11987
+ for (const p of validPoints) {
11988
+ if (p.y <= axisY) allBelow = false;
11989
+ if (p.y >= axisY) allAbove = false;
11990
+ }
11991
+ if (allAbove || allBelow) {
11992
+ // 全部在基线同侧:创建单个封闭区域
11993
+ this._createAreaSegment(points, allAbove, axisY);
11994
+ } else {
11995
+ // 混合数据:在交叉点处分割,分别创建封闭区域
11996
+ this._createMixedAreas(points, axisY);
11997
+ }
11998
+ }
11999
+
12000
+ /**
12001
+ * 创建单个面积段
12002
+ * @param {Array} points 线条上的点
12003
+ * @param {boolean} isAbove 是否在基线上方
12004
+ * @param {number} axisY 基线Y坐标(chartArea相对坐标)
12005
+ */
12006
+ _createAreaSegment(points, isAbove, axisY) {
11996
12007
  const start = points[0];
11997
12008
  const end = points[points.length - 1];
11998
12009
  const style = this.graph.utils.clone(this.style.area, {}, true);
@@ -12000,12 +12011,21 @@ define(['exports'], (function (exports) { 'use strict';
12000
12011
  style.stroke = style.stroke || 'transparent';
12001
12012
  if (!style.fill) {
12002
12013
  const color = this.graph.utils.hexToRGBA(this.style.stroke);
12003
- style.fill = `linear-gradient(50% 0 50% 100%,
12004
- rgba(${color.r},${color.g},${color.b}, 0) 1,
12005
- rgba(${color.r},${color.g},${color.b}, 0.1) 0.7,
12006
- rgba(${color.r},${color.g},${color.b}, 0.3) 0)`;
12014
+ if (isAbove) {
12015
+ // 基线上方:渐变从线条处(顶部)不透明到基线处(底部)透明
12016
+ style.fill = `linear-gradient(50% 0 50% 100%,
12017
+ rgba(${color.r},${color.g},${color.b}, 0) 1,
12018
+ rgba(${color.r},${color.g},${color.b}, 0.1) 0.7,
12019
+ rgba(${color.r},${color.g},${color.b}, 0.3) 0)`;
12020
+ } else {
12021
+ // 基线下方:渐变从基线处(顶部)透明到线条处(底部)不透明
12022
+ style.fill = `linear-gradient(50% 0 50% 100%,
12023
+ rgba(${color.r},${color.g},${color.b}, 0.3) 1,
12024
+ rgba(${color.r},${color.g},${color.b}, 0.1) 0.3,
12025
+ rgba(${color.r},${color.g},${color.b}, 0) 0)`;
12026
+ }
12007
12027
  } else if (typeof style.fill === 'function') {
12008
- style.fill = style.fill.call(this, style);
12028
+ style.fill = style.fill.call(this, style, isAbove);
12009
12029
  }
12010
12030
  const area = this.graph.createShape('path', {
12011
12031
  points: this.graph.utils.clone(points, true),
@@ -12014,19 +12034,78 @@ define(['exports'], (function (exports) { 'use strict';
12014
12034
  height: this.graph.chartArea.height
12015
12035
  });
12016
12036
 
12017
- // 在点集合前后加上落地到X轴的点就可以组成一个封闭的图形area
12018
- if (needClosePoint) {
12037
+ // 在首尾加上基线上的点,组成封闭多边形
12038
+ // 如果首/尾点已经在基线上(交叉点),则不重复添加
12039
+ if (Math.abs(start.y - axisY) > 0.5) {
12019
12040
  area.points.unshift({
12020
12041
  x: start.x,
12021
- y: this.baseY
12042
+ y: axisY
12022
12043
  });
12044
+ }
12045
+ if (Math.abs(end.y - axisY) > 0.5) {
12023
12046
  area.points.push({
12024
12047
  x: end.x,
12025
- y: this.baseY
12048
+ y: axisY
12026
12049
  });
12027
12050
  }
12028
12051
  this.addShape(area);
12029
12052
  }
12053
+
12054
+ /**
12055
+ * 处理跨基线的混合数据,在交叉点处分割成多个独立区域
12056
+ * @param {Array} points 线条上的点
12057
+ * @param {number} axisY 基线Y坐标(chartArea相对坐标)
12058
+ */
12059
+ _createMixedAreas(points, axisY) {
12060
+ const segments = [];
12061
+ let currentSegment = [];
12062
+ let prevAbove = null;
12063
+ for (let i = 0; i < points.length; i++) {
12064
+ const p = points[i];
12065
+ if (p.y == null || typeof p.y === 'undefined') continue;
12066
+ const isAbove = p.y < axisY;
12067
+ if (currentSegment.length === 0) {
12068
+ currentSegment.push(p);
12069
+ prevAbove = isAbove;
12070
+ } else if (isAbove === prevAbove) {
12071
+ currentSegment.push(p);
12072
+ } else {
12073
+ // 检测到跨基线交叉:计算交叉点
12074
+ const prev = currentSegment[currentSegment.length - 1];
12075
+ const t = (axisY - prev.y) / (p.y - prev.y);
12076
+ const crossPoint = {
12077
+ x: prev.x + (p.x - prev.x) * t,
12078
+ y: axisY
12079
+ };
12080
+
12081
+ // 当前段在交叉点处结束
12082
+ currentSegment.push(crossPoint);
12083
+ if (currentSegment.length >= 2) {
12084
+ segments.push({
12085
+ points: [...currentSegment],
12086
+ above: prevAbove
12087
+ });
12088
+ }
12089
+
12090
+ // 新段从交叉点开始
12091
+ currentSegment = [crossPoint, p];
12092
+ prevAbove = isAbove;
12093
+ }
12094
+ }
12095
+
12096
+ // 最后一段
12097
+ if (currentSegment.length >= 2) {
12098
+ segments.push({
12099
+ points: currentSegment,
12100
+ above: prevAbove
12101
+ });
12102
+ }
12103
+
12104
+ // 为每段创建独立的面积
12105
+ for (const seg of segments) {
12106
+ this._createAreaSegment(seg.points, seg.above, axisY);
12107
+ }
12108
+ }
12030
12109
  }
12031
12110
 
12032
12111
  /**
@@ -12694,8 +12773,10 @@ define(['exports'], (function (exports) { 'use strict';
12694
12773
  const value = typeof p.yValue === 'number' ? p.yValue : 0;
12695
12774
  const min = this.style.min || 0;
12696
12775
  const max = this.style.max || 100;
12697
- const startAngle = this.style.startAngle || -150;
12698
- const endAngle = this.style.endAngle || 150;
12776
+ // 度数转弧度(jmArc 内部使用弧度)
12777
+ const DEG = Math.PI / 180;
12778
+ const startAngle = (this.style.startAngle || -150) * DEG;
12779
+ const endAngle = (this.style.endAngle || 150) * DEG;
12699
12780
  const angleRange = endAngle - startAngle;
12700
12781
  const normalizedValue = Math.max(min, Math.min(max, value));
12701
12782
  const ratio = (normalizedValue - min) / (max - min);
@@ -12776,10 +12857,10 @@ define(['exports'], (function (exports) { 'use strict';
12776
12857
  for (let i = 0; i < tickCount; i++) {
12777
12858
  const angle = startAngle + angleStep * i;
12778
12859
  const value = min + (max - min) / (tickCount - 1) * i;
12779
- const tickStartX = centerX + Math.cos(angle * Math.PI / 180) * (radius - 30);
12780
- const tickStartY = centerY + Math.sin(angle * Math.PI / 180) * (radius - 30);
12781
- const tickEndX = centerX + Math.cos(angle * Math.PI / 180) * (radius - 10);
12782
- const tickEndY = centerY + Math.sin(angle * Math.PI / 180) * (radius - 10);
12860
+ const tickStartX = centerX + Math.cos(angle) * (radius - 30);
12861
+ const tickStartY = centerY + Math.sin(angle) * (radius - 30);
12862
+ const tickEndX = centerX + Math.cos(angle) * (radius - 10);
12863
+ const tickEndY = centerY + Math.sin(angle) * (radius - 10);
12783
12864
  const tickLine = this.graph.createShape('line', {
12784
12865
  style: {
12785
12866
  stroke: this.style.tickColor || '#666',
@@ -12796,8 +12877,8 @@ define(['exports'], (function (exports) { 'use strict';
12796
12877
  }
12797
12878
  });
12798
12879
  this.addShape(tickLine);
12799
- const labelX = centerX + Math.cos(angle * Math.PI / 180) * (radius - 45);
12800
- const labelY = centerY + Math.sin(angle * Math.PI / 180) * (radius - 45);
12880
+ const labelX = centerX + Math.cos(angle) * (radius - 45);
12881
+ const labelY = centerY + Math.sin(angle) * (radius - 45);
12801
12882
  const tickLabel = this.graph.createShape('label', {
12802
12883
  style: {
12803
12884
  fill: this.style.tickLabelColor || '#333',
@@ -12810,7 +12891,7 @@ define(['exports'], (function (exports) { 'use strict';
12810
12891
  x: labelX,
12811
12892
  y: labelY
12812
12893
  },
12813
- text: value.toString()
12894
+ text: Number(value.toFixed(2)).toString()
12814
12895
  });
12815
12896
  this.addShape(tickLabel);
12816
12897
  }
@@ -12821,8 +12902,8 @@ define(['exports'], (function (exports) { 'use strict';
12821
12902
  */
12822
12903
  createGaugePointer(centerX, centerY, radius, angle) {
12823
12904
  const pointerLength = radius * 0.7;
12824
- const pointerX = centerX + Math.cos(angle * Math.PI / 180) * pointerLength;
12825
- const pointerY = centerY + Math.sin(angle * Math.PI / 180) * pointerLength;
12905
+ const pointerX = centerX + Math.cos(angle) * pointerLength;
12906
+ const pointerY = centerY + Math.sin(angle) * pointerLength;
12826
12907
  const pointerLine = this.graph.createShape('line', {
12827
12908
  style: {
12828
12909
  stroke: this.style.pointerColor || '#333',
@@ -12864,6 +12945,10 @@ define(['exports'], (function (exports) { 'use strict';
12864
12945
  * 创建仪表盘值标签
12865
12946
  */
12866
12947
  createGaugeValueLabel(centerX, centerY, radius, value) {
12948
+ // 使用 itemLabelFormat 格式化,如果没有则默认最多保留2位小数
12949
+ const text = this.option.itemLabelFormat ? this.option.itemLabelFormat.call(this, {
12950
+ yValue: value
12951
+ }) : Number(value.toFixed(2)).toString();
12867
12952
  const valueLabel = this.graph.createShape('label', {
12868
12953
  style: {
12869
12954
  fill: this.style.valueColor || '#333',
@@ -12876,7 +12961,7 @@ define(['exports'], (function (exports) { 'use strict';
12876
12961
  x: centerX,
12877
12962
  y: centerY + radius * 0.3
12878
12963
  },
12879
- text: value.toString()
12964
+ text: text
12880
12965
  });
12881
12966
  this.addShape(valueLabel);
12882
12967
  if (this.style.unit) {
@@ -13361,7 +13446,9 @@ define(['exports'], (function (exports) { 'use strict';
13361
13446
  const centerY = chartHeight / 2;
13362
13447
  const maxRadius = Math.min(chartWidth, chartHeight) / 2 - 20;
13363
13448
  const lineWidth = this.style.lineWidth || 20;
13364
- const startAngle = this.style.startAngle !== undefined ? this.style.startAngle : -90;
13449
+ // 角度转弧度(jmArc 内部使用弧度)
13450
+ const DEG = Math.PI / 180;
13451
+ const startAngle = (this.style.startAngle !== undefined ? this.style.startAngle : -90) * DEG;
13365
13452
  const maxValue = this.style.max || 100;
13366
13453
  const field = this.field || 'value';
13367
13454
  const len = data.length;
@@ -13399,7 +13486,7 @@ define(['exports'], (function (exports) { 'use strict';
13399
13486
  },
13400
13487
  radius: radius,
13401
13488
  startAngle: 0,
13402
- endAngle: 360
13489
+ endAngle: Math.PI * 2
13403
13490
  });
13404
13491
  this.addShape(bgArc);
13405
13492
  }
@@ -13410,7 +13497,7 @@ define(['exports'], (function (exports) { 'use strict';
13410
13497
  createRingProgress(centerX, centerY, radius, lineWidth, startAngle, ratio, index) {
13411
13498
  if (ratio <= 0) return;
13412
13499
  const color = this.getColor(null, index);
13413
- const endAngle = startAngle + ratio * 360;
13500
+ const endAngle = startAngle + ratio * Math.PI * 2;
13414
13501
  const progressArc = this.graph.createShape('arc', {
13415
13502
  style: {
13416
13503
  stroke: color,
@@ -13966,228 +14053,6 @@ define(['exports'], (function (exports) { 'use strict';
13966
14053
  }
13967
14054
  }
13968
14055
 
13969
- /**
13970
- * 旭日图
13971
- *
13972
- * 旭日图用于展示层级数据的占比关系,由多个同心圆环组成,每个圆环代表一个层级。
13973
- * 内层圆环是外层圆环的父级,扇形角度代表数据占比。
13974
- *
13975
- * 数据格式要求:
13976
- * - 树形结构数据,每个节点包含 name、value 和 children
13977
- *
13978
- * 样式配置:
13979
- * - innerRadius: 内圆半径,默认 0
13980
- * - startAngle: 起始角度,默认 0
13981
- * - showLabels: 是否显示标签,默认 true
13982
- *
13983
- * @class jmSunburstSeries
13984
- * @module jmChart
13985
- * @extends jmSeries
13986
- *
13987
- * @example
13988
- * chart.createSeries('sunburst', {
13989
- * data: [{
13990
- * name: 'Root',
13991
- * children: [
13992
- * { name: 'A', value: 30 },
13993
- * { name: 'B', value: 70 }
13994
- * ]
13995
- * }]
13996
- * });
13997
- */
13998
- class jmSunburstSeries extends jmSeries {
13999
- constructor(options) {
14000
- options.style = options.style || options.graph.style.sunburst;
14001
- super(options);
14002
- this.maxDepth = 0;
14003
- }
14004
-
14005
- /**
14006
- * 初始化旭日图
14007
- */
14008
- init() {
14009
- const data = this.option.data || this.data;
14010
- if (!data || !data.length) return;
14011
- const chartWidth = this.graph.chartArea.width;
14012
- const chartHeight = this.graph.chartArea.height;
14013
- const centerX = chartWidth / 2;
14014
- const centerY = chartHeight / 2;
14015
- const maxRadius = Math.min(chartWidth, chartHeight) / 2 - 20;
14016
- this.maxDepth = this.calculateMaxDepth(data);
14017
- if (this.maxDepth === 0) return;
14018
- const ringWidth = maxRadius / this.maxDepth;
14019
- const innerRadius = this.style.innerRadius || 0;
14020
- this.drawLevel(data, centerX, centerY, innerRadius, ringWidth, 0, 360, 0);
14021
- if (this.style.showCenter !== false && innerRadius > 0) {
14022
- this.drawCenter(centerX, centerY, innerRadius);
14023
- }
14024
- }
14025
-
14026
- /**
14027
- * 计算最大深度
14028
- */
14029
- calculateMaxDepth(data, depth = 1) {
14030
- let maxDepth = depth;
14031
- for (const node of data) {
14032
- if (node.children && node.children.length > 0) {
14033
- const childDepth = this.calculateMaxDepth(node.children, depth + 1);
14034
- maxDepth = Math.max(maxDepth, childDepth);
14035
- }
14036
- }
14037
- return maxDepth;
14038
- }
14039
-
14040
- /**
14041
- * 计算节点总值
14042
- */
14043
- calculateTotalValue(data) {
14044
- let total = 0;
14045
- for (const node of data) {
14046
- if (node.children && node.children.length > 0) {
14047
- total += this.calculateTotalValue(node.children);
14048
- } else {
14049
- total += node.value || 0;
14050
- }
14051
- }
14052
- return total;
14053
- }
14054
-
14055
- /**
14056
- * 绘制层级
14057
- */
14058
- drawLevel(data, centerX, centerY, innerRadius, ringWidth, startAngle, totalAngle, level) {
14059
- const total = this.calculateTotalValue(data);
14060
- if (total === 0) return;
14061
- let currentAngle = startAngle;
14062
- const outerRadius = innerRadius + ringWidth;
14063
- for (const node of data) {
14064
- let nodeValue = 0;
14065
- if (node.children && node.children.length > 0) {
14066
- nodeValue = this.calculateTotalValue(node.children);
14067
- } else {
14068
- nodeValue = node.value || 0;
14069
- }
14070
- const angleRatio = nodeValue / total;
14071
- const nodeAngle = totalAngle * angleRatio;
14072
- const endAngle = currentAngle + nodeAngle;
14073
- if (nodeAngle > 0.1) {
14074
- const color = this.getColor(node, level);
14075
- this.drawArc(centerX, centerY, innerRadius, outerRadius, currentAngle, endAngle, color, node);
14076
- if (this.style.showLabels !== false && nodeAngle > 10) {
14077
- this.drawLabel(centerX, centerY, innerRadius, outerRadius, currentAngle, endAngle, node);
14078
- }
14079
- if (node.children && node.children.length > 0) {
14080
- this.drawLevel(node.children, centerX, centerY, outerRadius, ringWidth, currentAngle, nodeAngle, level + 1);
14081
- }
14082
- }
14083
- currentAngle = endAngle;
14084
- }
14085
- }
14086
-
14087
- /**
14088
- * 绘制扇形
14089
- */
14090
- drawArc(centerX, centerY, innerRadius, outerRadius, startAngle, endAngle, color, node) {
14091
- const arc = this.graph.createShape('arc', {
14092
- style: {
14093
- fill: color,
14094
- stroke: this.style.stroke || '#fff',
14095
- lineWidth: this.style.lineWidth || 1,
14096
- zIndex: 1
14097
- },
14098
- center: {
14099
- x: centerX,
14100
- y: centerY
14101
- },
14102
- radius: outerRadius,
14103
- innerRadius: innerRadius,
14104
- startAngle: startAngle - 90,
14105
- endAngle: endAngle - 90
14106
- });
14107
- this.addShape(arc);
14108
- node.shape = arc;
14109
- }
14110
-
14111
- /**
14112
- * 绘制标签
14113
- */
14114
- drawLabel(centerX, centerY, innerRadius, outerRadius, startAngle, endAngle, node) {
14115
- const midAngle = (startAngle + endAngle) / 2 - 90;
14116
- const midRadius = (innerRadius + outerRadius) / 2;
14117
- const x = centerX + midRadius * Math.cos(midAngle * Math.PI / 180);
14118
- const y = centerY + midRadius * Math.sin(midAngle * Math.PI / 180);
14119
- const text = node.name || '';
14120
- if (!text) return;
14121
- const label = this.graph.createShape('label', {
14122
- style: {
14123
- fill: this.style.labelColor || '#fff',
14124
- font: this.style.labelFont || '12px Arial',
14125
- textAlign: 'center',
14126
- textBaseline: 'middle',
14127
- zIndex: 10
14128
- },
14129
- text: text,
14130
- position: {
14131
- x,
14132
- y
14133
- }
14134
- });
14135
- this.addShape(label);
14136
- }
14137
-
14138
- /**
14139
- * 绘制中心
14140
- */
14141
- drawCenter(centerX, centerY, innerRadius) {
14142
- const centerCircle = this.graph.createShape('circle', {
14143
- style: {
14144
- fill: this.style.centerFill || '#fff',
14145
- stroke: this.style.centerStroke || '#e0e0e0',
14146
- lineWidth: 1,
14147
- zIndex: 0
14148
- },
14149
- center: {
14150
- x: centerX,
14151
- y: centerY
14152
- },
14153
- radius: innerRadius
14154
- });
14155
- this.addShape(centerCircle);
14156
- }
14157
-
14158
- /**
14159
- * 获取颜色
14160
- */
14161
- getColor(node, level) {
14162
- if (node.color) return node.color;
14163
- if (this.style.colors && this.style.colors.length > 0) {
14164
- return this.style.colors[level % this.style.colors.length];
14165
- }
14166
- if (typeof this.style.color === 'function') {
14167
- return this.style.color.call(this, node, level);
14168
- }
14169
- return this.graph.getColor(level);
14170
- }
14171
-
14172
- /**
14173
- * 生成图例
14174
- */
14175
- createLegend() {
14176
- const style = this.graph.utils.clone(this.style);
14177
- style.fill = this.style.color || this.graph.getColor(0);
14178
- style.stroke = style.fill;
14179
- const shape = this.graph.createShape('circle', {
14180
- style: style,
14181
- center: {
14182
- x: this.graph.style.legend.item.shape.width / 2,
14183
- y: this.graph.style.legend.item.shape.height / 2
14184
- },
14185
- radius: this.graph.style.legend.item.shape.height / 2
14186
- });
14187
- this.graph.legend.append(this, shape);
14188
- }
14189
- }
14190
-
14191
14056
  /**
14192
14057
  * 轴
14193
14058
  *
@@ -14907,8 +14772,7 @@ define(['exports'], (function (exports) { 'use strict';
14907
14772
  'funnel': jmFunnelSeries,
14908
14773
  'ringProgress': jmRingProgressSeries,
14909
14774
  'boxPlot': jmBoxPlotSeries,
14910
- 'wordCloud': jmWordCloudSeries,
14911
- 'sunburst': jmSunburstSeries
14775
+ 'wordCloud': jmWordCloudSeries
14912
14776
  };
14913
14777
  }
14914
14778