jmchart 1.1.96 → 1.1.98

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.
@@ -1408,7 +1408,7 @@ System.register([], function (exports) {
1408
1408
  get context() {
1409
1409
  let s = this.__pro('context');
1410
1410
  if(s) return s;
1411
- else if(this.is('jmGraph') && this.canvas) {
1411
+ else if(this.is('jmGraph') && this.canvas && this.canvas.getContext) {
1412
1412
  return this.context = this.canvas.getContext('2d');
1413
1413
  }
1414
1414
  let g = this.graph;
@@ -3759,39 +3759,21 @@ System.register([], function (exports) {
3759
3759
  */
3760
3760
  draw() {
3761
3761
  try {
3762
- let bounds = this.parent && this.parent.absoluteBounds?this.parent.absoluteBounds:this.absoluteBounds;
3763
- if(!bounds) bounds = this.parent && this.parent.getAbsoluteBounds?this.parent.getAbsoluteBounds():this.getAbsoluteBounds();
3764
- let p = this.getLocation();
3765
- p.left += bounds.left;
3766
- p.top += bounds.top;
3767
3762
 
3768
- let sp = this.sourcePosition;
3769
- let sw = this.sourceWidth;
3770
- let sh = this.sourceHeight;
3771
3763
  let img = this.getImage();
3772
-
3773
- if(sp || typeof sw != 'undefined' || typeof sh != 'undefined') {
3774
- if(typeof sw == 'undefined') sw= p.width || img.width || 0;
3775
- if(typeof sh == 'undefined') sh= p.height || img.height || 0;
3776
- sp = sp || {x:0, y:0};
3777
-
3778
- if(p.width && p.height) this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,p.width,p.height);
3779
- else if(p.width) {
3780
- this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,p.width,sh);
3781
- }
3782
- else if(p.height) {
3783
- this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,sw,p.height);
3784
- }
3785
- else this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,sw,sh);
3786
- }
3787
- else if(p) {
3788
- if(p.width && p.height) this.context.drawImage(img,p.left,p.top,p.width,p.height);
3789
- else if(p.width) this.context.drawImage(img,p.left,p.top,p.width,img.height);
3790
- else if(p.height) this.context.drawImage(img,p.left,p.top,img.width,p.height);
3791
- else this.context.drawImage(img,p.left,p.top);
3764
+ if(this.graph.isWXMiniApp && this.graph.canvas) {
3765
+ // 图片对象
3766
+ const image = this.graph.canvas.createImage();
3767
+ // 图片加载完成回调
3768
+ image.onload = () => {
3769
+ // 将图片绘制到 canvas 上
3770
+ this.drawImg(image);
3771
+ };
3772
+ // 设置图片src
3773
+ image.src = img;
3792
3774
  }
3793
3775
  else {
3794
- this.context.drawImage(img);
3776
+ this.drawImg(img);
3795
3777
  }
3796
3778
  }
3797
3779
  catch(e) {
@@ -3799,6 +3781,43 @@ System.register([], function (exports) {
3799
3781
  }
3800
3782
  }
3801
3783
 
3784
+ // 绘制
3785
+ drawImg(img) {
3786
+ let bounds = this.parent && this.parent.absoluteBounds?this.parent.absoluteBounds:this.absoluteBounds;
3787
+ if(!bounds) bounds = this.parent && this.parent.getAbsoluteBounds?this.parent.getAbsoluteBounds():this.getAbsoluteBounds();
3788
+ let p = this.getLocation();
3789
+ p.left += bounds.left;
3790
+ p.top += bounds.top;
3791
+
3792
+ let sp = this.sourcePosition;
3793
+ let sw = this.sourceWidth;
3794
+ let sh = this.sourceHeight;
3795
+
3796
+ if(sp || typeof sw != 'undefined' || typeof sh != 'undefined') {
3797
+ if(typeof sw == 'undefined') sw= p.width || img.width || 0;
3798
+ if(typeof sh == 'undefined') sh= p.height || img.height || 0;
3799
+ sp = sp || {x:0, y:0};
3800
+
3801
+ if(p.width && p.height) this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,p.width,p.height);
3802
+ else if(p.width) {
3803
+ this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,p.width,sh);
3804
+ }
3805
+ else if(p.height) {
3806
+ this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,sw,p.height);
3807
+ }
3808
+ else this.context.drawImage(img,sp.x,sp.y,sw,sh,p.left,p.top,sw,sh);
3809
+ }
3810
+ else if(p) {
3811
+ if(p.width && p.height) this.context.drawImage(img,p.left,p.top,p.width,p.height);
3812
+ else if(p.width) this.context.drawImage(img,p.left,p.top,p.width,img.height);
3813
+ else if(p.height) this.context.drawImage(img,p.left,p.top,img.width,p.height);
3814
+ else this.context.drawImage(img,p.left,p.top);
3815
+ }
3816
+ else {
3817
+ this.context.drawImage(img);
3818
+ }
3819
+ }
3820
+
3802
3821
  /**
3803
3822
  * 获取当前控件的边界
3804
3823
  *
@@ -3834,7 +3853,7 @@ System.register([], function (exports) {
3834
3853
  else if(src && src.src) {
3835
3854
  this.__img = src;
3836
3855
  }
3837
- else if(document && document.createElement) {
3856
+ else if(typeof document !== 'undefined' && document.createElement) {
3838
3857
  this.__img = document.createElement('img');
3839
3858
  if(src && typeof src == 'string') this.__img.src = src;
3840
3859
  }
@@ -4403,9 +4422,9 @@ System.register([], function (exports) {
4403
4422
  };
4404
4423
 
4405
4424
  // 销毁
4406
- destory() {
4407
- this.mouseHandler.destory();
4408
- this.keyHandler.destory();
4425
+ destroy() {
4426
+ this.mouseHandler.destroy();
4427
+ this.keyHandler.destroy();
4409
4428
  }
4410
4429
  }
4411
4430
 
@@ -4523,7 +4542,7 @@ System.register([], function (exports) {
4523
4542
  }
4524
4543
 
4525
4544
  // 销毁所有事件
4526
- destory() {
4545
+ destroy() {
4527
4546
  for(let name in this.eventEvents) {
4528
4547
  const event = this.eventEvents[name];
4529
4548
  if(!event || !event.fun) continue;
@@ -4599,7 +4618,7 @@ System.register([], function (exports) {
4599
4618
  }
4600
4619
 
4601
4620
  // 销毁所有事件
4602
- destory() {
4621
+ destroy() {
4603
4622
  for(let name in this.eventEvents) {
4604
4623
  const event = this.eventEvents[name];
4605
4624
  if(!event || !event.fun) continue;
@@ -4645,9 +4664,8 @@ System.register([], function (exports) {
4645
4664
  this.util = this.utils = jmUtils;
4646
4665
 
4647
4666
  //如果是小程序
4648
- if(typeof wx != 'undefined' && wx.createCanvasContext) {
4649
- this.context = wx.createCanvasContext(canvas);
4650
- canvas = wx.createSelectorQuery().select('#' + canvas);
4667
+ if(typeof wx != 'undefined' && wx.canIUse && wx.canIUse('canvas')) {
4668
+ if(typeof canvas === 'string') canvas = wx.createSelectorQuery().select('#' + canvas);
4651
4669
  this.isWXMiniApp = true;// 微信小程序平台
4652
4670
  }
4653
4671
  else {
@@ -4668,10 +4686,10 @@ System.register([], function (exports) {
4668
4686
  }
4669
4687
  else {
4670
4688
  this.container = canvas.parentElement;
4671
- }
4672
- this.context = canvas.getContext('2d');
4673
- }
4674
- this.canvas = canvas;
4689
+ }
4690
+ }
4691
+ this.canvas = canvas;
4692
+ this.context = canvas.getContext('2d');
4675
4693
  this.__init(callback);
4676
4694
  }
4677
4695
 
@@ -4722,16 +4740,19 @@ System.register([], function (exports) {
4722
4740
  // 重置canvas大小,并判断高清屏,画图先放大二倍
4723
4741
  resize(w, h) {
4724
4742
 
4725
- const scale = typeof window != 'undefined' && window.devicePixelRatio > 1? window.devicePixelRatio : 1;
4726
- if (scale > 1) {
4743
+ let scale = typeof window != 'undefined' && window.devicePixelRatio > 1? window.devicePixelRatio : 1;
4744
+ if(this.isWXMiniApp) {
4745
+ scale = wx.getSystemInfoSync().pixelRatio || 1;
4746
+ }
4747
+ else if (scale > 1) {
4727
4748
  this.__normalSize = this.__normalSize || { width: 0, height: 0};
4728
4749
  w = w || this.__normalSize.width || this.width, h = h || this.__normalSize.height || this.height;
4729
4750
 
4730
4751
  if(w) this.__normalSize.width = w;
4731
4752
  if(h) this.__normalSize.height = h;
4732
-
4733
- this.canvas.style.width = w + "px";
4734
- this.canvas.style.height = h + "px";
4753
+
4754
+ this.canvas.style && (this.canvas.style.width = w + "px");
4755
+ this.canvas.style && (this.canvas.style.height = h + "px");
4735
4756
  this.canvas.height = h * scale;
4736
4757
  this.canvas.width = w *scale;
4737
4758
  this.context.scale(scale, scale);
@@ -5098,7 +5119,7 @@ System.register([], function (exports) {
5098
5119
  this.___isAutoRefreshing = true;
5099
5120
 
5100
5121
  function update() {
5101
- if(self.destoryed) {
5122
+ if(self.destroyed) {
5102
5123
  self.___isAutoRefreshing = false;
5103
5124
  return;// 已销毁
5104
5125
  }
@@ -5113,9 +5134,9 @@ System.register([], function (exports) {
5113
5134
  }
5114
5135
 
5115
5136
  // 销毁当前对象
5116
- destory() {
5117
- this.eventHandler.destory();
5118
- this.destoryed = true;// 标记已销毁
5137
+ destroy() {
5138
+ this.eventHandler.destroy();
5139
+ this.destroyed = true;// 标记已销毁
5119
5140
  }
5120
5141
  }
5121
5142
 
@@ -5554,7 +5575,7 @@ System.register([], function (exports) {
5554
5575
  this.points = [];
5555
5576
 
5556
5577
  for (const axis of this.radarOption.yAxises) {
5557
- this.points.push(axis.end);
5578
+ axis.end && this.points.push(axis.end);
5558
5579
  }
5559
5580
 
5560
5581
  this.points.push(this.points[0]);
@@ -5586,6 +5607,7 @@ System.register([], function (exports) {
5586
5607
  const curRadius = this.radarOption.radius / this.labelCount * i;
5587
5608
 
5588
5609
  for (const axis of this.radarOption.yAxises) {
5610
+ if (!axis.radarOption) continue;
5589
5611
  const point = {};
5590
5612
  point.x = axis.radarOption.center.x + axis.radarOption.cos * curRadius + bounds.left;
5591
5613
  point.y = axis.radarOption.center.y - axis.radarOption.sin * curRadius + bounds.top;
@@ -6222,28 +6244,9 @@ System.register([], function (exports) {
6222
6244
  }
6223
6245
 
6224
6246
  panel.height = shape.height; //执行进入事件
6225
- //触动图例后加粗显示图
6226
-
6227
- /*const hover = options.hover || function() {
6228
- //应用图的动态样式
6229
- //Object.assign(series.style, series.style.hover);
6230
-
6231
- //Object.assign(this.style, this.style.hover || {});
6232
-
6233
- //series.graph.refresh();
6234
- };
6235
- panel.bind('mouseover', hover);
6236
- //执行离开
6237
- const leave = options.leave || function() {
6238
- //应用图的普通样式
6239
- //Object.assign(series.style, series.style.normal);
6240
-
6241
- //Object.assign(this.style, this.style.normal || {});
6242
- //jmUtils.apply(this.series.style.normal,this.series.style);
6243
- //series.graph.refresh();
6244
- };
6245
- panel.bind('mouseleave', leave);*/
6246
6247
 
6248
+ options.hover && panel.bind('mouseover touchover', options.hover);
6249
+ options.leave && panel.bind('mouseleave touchleave', options.leave);
6247
6250
  const legendPosition = this.legendPosition || this.style.legendPosition || 'right';
6248
6251
 
6249
6252
  if (legendPosition == 'top' || legendPosition == 'bottom') {
@@ -6589,7 +6592,8 @@ System.register([], function (exports) {
6589
6592
 
6590
6593
  p.x = xstep * i + this.xAxis.labelStart;
6591
6594
 
6592
- for (const f of fields) {
6595
+ for (let j = 0; j < fields.length; j++) {
6596
+ const f = fields[j];
6593
6597
  const yv = s[f];
6594
6598
  p.yLabel = p.yValue = yv; // 高度
6595
6599
 
@@ -6999,7 +7003,8 @@ System.register([], function (exports) {
6999
7003
  for (const row of this.data) {
7000
7004
  let max, min;
7001
7005
 
7002
- for (const f of fields) {
7006
+ for (let i = 0; i < fields.length; i++) {
7007
+ const f = fields[i];
7003
7008
  const v = Number(row[f]);
7004
7009
  if (typeof max === 'undefined') max = v;else {
7005
7010
  if (v < 0 || max < 0) max = Math.max(max, v);else {
@@ -7328,7 +7333,7 @@ System.register([], function (exports) {
7328
7333
  const points = this.createPoints();
7329
7334
  if (!points || !points.length) return;
7330
7335
 
7331
- for (let k in points) {
7336
+ for (let k = 0; k < points.length; k++) {
7332
7337
  const p = points[k];
7333
7338
  if (!p) continue; //生成图例前的图标
7334
7339
 
@@ -7346,18 +7351,6 @@ System.register([], function (exports) {
7346
7351
 
7347
7352
  this.graph.legend.append(this, shape, {
7348
7353
  name: this.legendLabel,
7349
- hover: function () {
7350
- //var sp = this.children.get(0);
7351
- //应用图的动态样式
7352
- Object.assign(this.targetShape.style, this.targetShape.style.hover);
7353
- Object.assign(this.style, this.style.hover);
7354
- },
7355
- leave: function () {
7356
- //var sp = this.children.get(0);
7357
- //应用图的普通样式
7358
- Object.assign(this.targetShape.style, this.targetShape.style.normal);
7359
- Object.assign(this.style, this.style.normal);
7360
- },
7361
7354
  data: this.data[k]
7362
7355
  });
7363
7356
  }
@@ -7460,8 +7453,7 @@ System.register([], function (exports) {
7460
7453
  const {
7461
7454
  points,
7462
7455
  dataChanged
7463
- } = this.initDataPoint(this.center, this.radius);
7464
- this.createLegend(points); // 是否正在动画中
7456
+ } = this.initDataPoint(this.center, this.radius); // 是否正在动画中
7465
7457
 
7466
7458
  const isRunningAni = this.enableAnimate && (dataChanged || this.___animateCounter > 0);
7467
7459
  const aniCount = this.style.aniCount || 20;
@@ -7499,6 +7491,8 @@ System.register([], function (exports) {
7499
7491
  return self.option.onLeave.call(this, e);
7500
7492
  });
7501
7493
  }
7494
+
7495
+ this.createLegend(p);
7502
7496
  }
7503
7497
 
7504
7498
  shape.zIndex += p.radius / this.radius; // 用每个轴占比做为排序号,这样占面积最大的排最底层
@@ -7572,6 +7566,7 @@ System.register([], function (exports) {
7572
7566
  const shapePoints = [];
7573
7567
 
7574
7568
  for (const axis of this.axises) {
7569
+ if (!axis || !axis.field) continue;
7575
7570
  const yv = s[axis.field];
7576
7571
  const p = {
7577
7572
  x: center.x,
@@ -7646,44 +7641,23 @@ System.register([], function (exports) {
7646
7641
  * @method createLegend
7647
7642
  */
7648
7643
 
7649
- jmRadarSeries.prototype.createLegend = function (points) {
7650
- if (!points || !points.length) return;
7651
- const legendMap = {};
7644
+ jmRadarSeries.prototype.createLegend = function (point) {
7645
+ if (!point) return; //生成图例前的图标
7652
7646
 
7653
- for (let k in points) {
7654
- const p = points[k];
7655
- if (!p) continue;
7656
- if (legendMap[p.index]) continue; //生成图例前的图标
7647
+ const style = this.graph.utils.clone(point.style); //delete style.stroke;
7657
7648
 
7658
- const style = this.graph.utils.clone(p.style);
7659
- style.fill = style.fill; //delete style.stroke;
7660
-
7661
- const shape = legendMap[p.index] = this.graph.createShape('rect', {
7662
- style: style,
7663
- position: {
7664
- x: 0,
7665
- y: 0
7666
- }
7667
- }); //shape.targetShape = p.shape;
7668
- //此处重写图例事件
7649
+ const shape = this.graph.createShape('rect', {
7650
+ style: style,
7651
+ position: {
7652
+ x: 0,
7653
+ y: 0
7654
+ }
7655
+ }); //此处重写图例事件
7669
7656
 
7670
- this.graph.legend.append(this, shape, {
7671
- name: this.legendLabel,
7672
- hover: function () {
7673
- //var sp = this.children.get(0);
7674
- //应用图的动态样式
7675
- Object.assign(this.targetShape.style, this.targetShape.style.hover);
7676
- Object.assign(this.style, this.style.hover);
7677
- },
7678
- leave: function () {
7679
- //var sp = this.children.get(0);
7680
- //应用图的普通样式
7681
- Object.assign(this.targetShape.style, this.targetShape.style.normal);
7682
- Object.assign(this.style, this.style.normal);
7683
- },
7684
- data: p.data
7685
- });
7686
- }
7657
+ this.graph.legend.append(this, shape, {
7658
+ name: this.legendLabel,
7659
+ data: point.data
7660
+ });
7687
7661
  };
7688
7662
 
7689
7663
  /**
@@ -8249,6 +8223,7 @@ System.register([], function (exports) {
8249
8223
  this.start.x = this.end.x = isTocuhGraph ? point.x + graph.chartArea.position.x : point.x;
8250
8224
 
8251
8225
  for (const p of point.points) {
8226
+ if (!p || typeof p.y === 'undefined') continue;
8252
8227
  this.markArc = graph.createShape('circle', {
8253
8228
  style: this.style,
8254
8229
  radius: (this.style.radius || 5) * this.graph.devicePixelRatio
@@ -8951,6 +8926,12 @@ System.register([], function (exports) {
8951
8926
  }
8952
8927
 
8953
8928
  return serie;
8929
+ } // 销毁
8930
+
8931
+
8932
+ destroy() {
8933
+ super.destroy();
8934
+ this.touchGraph && this.touchGraph.destroy();
8954
8935
  }
8955
8936
 
8956
8937
  } exports({ default: jmChart, jmChart: jmChart });
@@ -8997,8 +8978,7 @@ System.register([], function (exports) {
8997
8978
 
8998
8979
  // 销毁
8999
8980
  destroyed() {
9000
- this.chartInstance && this.chartInstance.destory();
9001
- this.chartInstance && this.chartInstance.touchGraph && this.chartInstance.touchGraph.destory();
8981
+ this.chartInstance && this.chartInstance.destroy();
9002
8982
  },
9003
8983
 
9004
8984
  watch: {
package/example/line.html CHANGED
@@ -93,7 +93,7 @@
93
93
  minYValue: 0,
94
94
  maxYValue: 200 ,
95
95
  style: {
96
- // 画圆滑的曲线
96
+ // 画圆滑的曲线 , 否则就是折线
97
97
  curve: true,// 填充图形
98
98
  label: {
99
99
  show: true
@@ -12,7 +12,11 @@
12
12
  width:100%;
13
13
  height:100%;
14
14
  }
15
+ #mycanvas {
16
+ margin-top: 50px;
17
+ }
15
18
  #mycanvas canvas, #mycanvas div{
19
+
16
20
  background-color:#fff;
17
21
  margin:0 auto;
18
22
  }
@@ -36,11 +40,11 @@
36
40
 
37
41
 
38
42
  function inichart(w, h) {
39
- var chart1 = new jmChart('mycanvas1', {
43
+ var chart1 = new jmChart('mycanvas', {
40
44
  width: w,
41
45
  height: h,
42
46
  enableAnimate: true,
43
- autoRefresh: true,
47
+ //autoRefresh: false,
44
48
  yLabelFormat: function() {
45
49
  return this.field;
46
50
  },
@@ -151,10 +155,8 @@
151
155
  </script>
152
156
  </head>
153
157
  <body>
154
- <div id="mycanvas1">
158
+ <div id="mycanvas">
155
159
  </div>
156
- <div id="mycanvas2">
157
- </div>
158
160
  <button id="btnRedraw">重绘</button>
159
161
  </body>
160
162
  </html>
@@ -61,6 +61,13 @@
61
61
  left: 100,
62
62
  right: 100
63
63
  },
64
+ markLine: {
65
+ longtap: false, // 长按才出现标线
66
+ lock: {
67
+ y: 10,
68
+ x: 10
69
+ }
70
+ },
64
71
  //layout: 'inside'
65
72
  },
66
73
  xAxisOption: {
@@ -77,6 +84,11 @@
77
84
  chart.on('touchPointChange', function(args) {
78
85
  console.log(args);
79
86
  });
87
+ // 滑动标线,阻止默认事件
88
+ chart.on('marklinemove', (args)=>{
89
+ //args.event.preventDefault();// 阻止默认行为
90
+ //args.event.stopPropagation();
91
+ });
80
92
 
81
93
  var line1 = chart.createSeries('line', {
82
94
  field: 'y1',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.1.96",
3
+ "version": "1.1.98",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "directories": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/jiamao/jmchart#readme",
30
30
  "dependencies": {
31
- "jmgraph": "^3.1.90"
31
+ "jmgraph": "^3.1.94"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/core": "^7.10.2",
@@ -43,8 +43,7 @@ export default {
43
43
 
44
44
  // 销毁
45
45
  destroyed() {
46
- this.chartInstance && this.chartInstance.destory();
47
- this.chartInstance && this.chartInstance.touchGraph && this.chartInstance.touchGraph.destory();
46
+ this.chartInstance && this.chartInstance.destroy();
48
47
  },
49
48
 
50
49
  watch: {
@@ -124,7 +124,7 @@ export default class jmAxis extends jmArrowLine {
124
124
  if(this.radarOption && this.type === 'x') {
125
125
  this.points = [];
126
126
  for(const axis of this.radarOption.yAxises) {
127
- this.points.push(axis.end);
127
+ axis.end && this.points.push(axis.end);
128
128
  }
129
129
  this.points.push(this.points[0]);
130
130
  return this.points;
@@ -153,6 +153,7 @@ export default class jmAxis extends jmArrowLine {
153
153
  const points = [];
154
154
  const curRadius = this.radarOption.radius / this.labelCount * i;
155
155
  for(const axis of this.radarOption.yAxises) {
156
+ if(!axis.radarOption) continue;
156
157
  const point = {};
157
158
  point.x = axis.radarOption.center.x + axis.radarOption.cos * curRadius + bounds.left;
158
159
  point.y = axis.radarOption.center.y - axis.radarOption.sin * curRadius + bounds.top;
@@ -73,26 +73,8 @@ jmLegend.prototype.append = function(series, shape, options = {}) {
73
73
  panel.height = shape.height;
74
74
 
75
75
  //执行进入事件
76
- //触动图例后加粗显示图
77
- /*const hover = options.hover || function() {
78
- //应用图的动态样式
79
- //Object.assign(series.style, series.style.hover);
80
-
81
- //Object.assign(this.style, this.style.hover || {});
82
-
83
- //series.graph.refresh();
84
- };
85
- panel.bind('mouseover', hover);
86
- //执行离开
87
- const leave = options.leave || function() {
88
- //应用图的普通样式
89
- //Object.assign(series.style, series.style.normal);
90
-
91
- //Object.assign(this.style, this.style.normal || {});
92
- //jmUtils.apply(this.series.style.normal,this.series.style);
93
- //series.graph.refresh();
94
- };
95
- panel.bind('mouseleave', leave);*/
76
+ options.hover && panel.bind('mouseover touchover', options.hover);
77
+ options.leave && panel.bind('mouseleave touchleave', options.leave);
96
78
 
97
79
  const legendPosition = this.legendPosition || this.style.legendPosition || 'right';
98
80
  if(legendPosition == 'top' || legendPosition == 'bottom') {
@@ -70,6 +70,7 @@ export default class jmMarkLine extends jmLine {
70
70
  this.start.x = this.end.x = isTocuhGraph? (point.x + graph.chartArea.position.x): point.x;
71
71
 
72
72
  for(const p of point.points) {
73
+ if(!p || typeof p.y === 'undefined') continue;
73
74
  this.markArc = graph.createShape('circle', {
74
75
  style: this.style,
75
76
  radius: (this.style.radius || 5) * this.graph.devicePixelRatio
package/src/jmChart.js CHANGED
@@ -415,4 +415,10 @@ export default class jmChart extends jmGraph {
415
415
  }
416
416
  return serie;
417
417
  }
418
+
419
+ // 销毁
420
+ destroy() {
421
+ super.destroy();
422
+ this.touchGraph && this.touchGraph.destroy();
423
+ }
418
424
  }
@@ -314,7 +314,7 @@ jmPieSeries.prototype.createLegend = function() {
314
314
  const points = this.createPoints();
315
315
  if(!points || !points.length) return;
316
316
 
317
- for(let k in points) {
317
+ for(let k=0; k < points.length; k++) {
318
318
  const p = points[k];
319
319
  if(!p) continue;
320
320
 
@@ -330,18 +330,6 @@ jmPieSeries.prototype.createLegend = function() {
330
330
  //此处重写图例事件
331
331
  this.graph.legend.append(this, shape, {
332
332
  name: this.legendLabel,
333
- hover: function() {
334
- //var sp = this.children.get(0);
335
- //应用图的动态样式
336
- Object.assign(this.targetShape.style, this.targetShape.style.hover);
337
- Object.assign(this.style, this.style.hover);
338
- },
339
- leave: function() {
340
- //var sp = this.children.get(0);
341
- //应用图的普通样式
342
- Object.assign(this.targetShape.style, this.targetShape.style.normal);
343
- Object.assign(this.style, this.style.normal);
344
- },
345
333
  data: this.data[k]
346
334
  });
347
335
  }