jmchart 1.1.79 → 1.1.90
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 +30 -28
- package/build.js +35 -35
- package/dist/jmchart.amd.js +700 -444
- package/dist/jmchart.cjs.js +699 -443
- package/dist/jmchart.esm.js +699 -444
- package/dist/jmchart.iife.js +701 -443
- package/dist/jmchart.system.js +699 -443
- package/example/bar.html +180 -180
- package/example/candlestick.html +288 -0
- package/example/index.html +294 -0
- package/example/js/vconsole.js +10 -0
- package/example/line.html +300 -297
- package/example/pie.html +353 -353
- package/example/stackBar.html +142 -142
- package/example/stackLine.html +147 -147
- package/example/test.html +40 -40
- package/example/vue.html +322 -322
- package/example/wk/line.html +314 -312
- package/index.js +8 -8
- package/package.json +42 -42
- package/rollup.config.js +26 -26
- package/server.js +45 -45
- package/src/common/style.js +259 -242
- package/src/common/tooltip.js +165 -165
- package/src/common/utils.js +21 -21
- package/src/component/vchart.js +130 -130
- package/src/core/axis/axis.js +622 -622
- package/src/core/legend/legend.js +163 -163
- package/src/core/markLine/manager.js +152 -0
- package/src/core/{axis → markLine}/markLine.js +190 -190
- package/src/jmChart.js +416 -464
- package/src/series/barSeries.js +135 -135
- package/src/series/candlestickSeries.js +114 -0
- package/src/series/lineSeries.js +243 -243
- package/src/series/pieSeries.js +350 -350
- package/src/series/series.js +397 -396
- package/src/series/stackBarSeries.js +144 -144
- package/src/series/stackLineSeries.js +145 -145
package/dist/jmchart.system.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
System.register([], function (exports
|
|
1
|
+
System.register([], function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
return {
|
|
4
4
|
execute: function () {
|
|
@@ -876,6 +876,23 @@ System.register([], function (exports, module) {
|
|
|
876
876
|
}
|
|
877
877
|
return r;
|
|
878
878
|
}
|
|
879
|
+
// window.requestAnimationFrame() 告诉浏览器——你希望执行一个动画,并且要求浏览器在下次重绘之前调用指定的回调函数更新动画。该方法需要传入一个回调函数作为参数,该回调函数会在浏览器下一次重绘之前执行
|
|
880
|
+
static requestAnimationFrame(callback) {
|
|
881
|
+
if(typeof requestAnimationFrame === 'undefined') {
|
|
882
|
+
return setTimeout(callback, 20);
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
return requestAnimationFrame(callback);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
static cancelAnimationFrame(handler) {
|
|
889
|
+
if(typeof requestAnimationFrame === 'undefined') {
|
|
890
|
+
return clearTimeout(handler);
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
return cancelAnimationFrame(handler);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
879
896
|
}
|
|
880
897
|
|
|
881
898
|
/**
|
|
@@ -3968,7 +3985,7 @@ System.register([], function (exports, module) {
|
|
|
3968
3985
|
|
|
3969
3986
|
//获取当前控件的绝对位置
|
|
3970
3987
|
let bounds = this.parent && this.parent.absoluteBounds?this.parent.absoluteBounds:this.absoluteBounds;
|
|
3971
|
-
|
|
3988
|
+
this.testSize();
|
|
3972
3989
|
let location = this.location;
|
|
3973
3990
|
let x = location.left + bounds.left;
|
|
3974
3991
|
let y = location.top + bounds.top;
|
|
@@ -4341,6 +4358,7 @@ System.register([], function (exports, module) {
|
|
|
4341
4358
|
|
|
4342
4359
|
touchStart(evt) {
|
|
4343
4360
|
evt = evt || window.event;
|
|
4361
|
+
evt.eventName = 'touchstart';
|
|
4344
4362
|
this.container.raiseEvent('touchstart',evt);
|
|
4345
4363
|
let t = evt.target || evt.srcElement;
|
|
4346
4364
|
if(t == this.target) {
|
|
@@ -4351,6 +4369,7 @@ System.register([], function (exports, module) {
|
|
|
4351
4369
|
|
|
4352
4370
|
touchMove(evt) {
|
|
4353
4371
|
evt = evt || window.event;
|
|
4372
|
+
evt.eventName = 'touchmove';
|
|
4354
4373
|
this.container.raiseEvent('touchmove',evt);
|
|
4355
4374
|
let t = evt.target || evt.srcElement;
|
|
4356
4375
|
if(t == this.target) {
|
|
@@ -4361,6 +4380,7 @@ System.register([], function (exports, module) {
|
|
|
4361
4380
|
|
|
4362
4381
|
touchEnd(evt) {
|
|
4363
4382
|
evt = evt || window.event;
|
|
4383
|
+
evt.eventName = 'touchend';
|
|
4364
4384
|
|
|
4365
4385
|
this.container.raiseEvent('touchend',evt);
|
|
4366
4386
|
let t = evt.target || evt.srcElement;
|
|
@@ -4372,6 +4392,7 @@ System.register([], function (exports, module) {
|
|
|
4372
4392
|
|
|
4373
4393
|
touchCancel(evt) {
|
|
4374
4394
|
evt = evt || window.event;
|
|
4395
|
+
evt.eventName = 'touchcancel';
|
|
4375
4396
|
|
|
4376
4397
|
this.container.raiseEvent('touchcancel',evt);
|
|
4377
4398
|
let t = evt.target || evt.srcElement;
|
|
@@ -4412,7 +4433,8 @@ System.register([], function (exports, module) {
|
|
|
4412
4433
|
|
|
4413
4434
|
this.eventEvents['mousedown'] = jmUtils.bindEvent(this.target,'mousedown',function(evt) {
|
|
4414
4435
|
evt = evt || window.event;
|
|
4415
|
-
|
|
4436
|
+
evt.eventName = 'mousedown';
|
|
4437
|
+
container.raiseEvent('mousedown',evt);
|
|
4416
4438
|
//if(r === false) {
|
|
4417
4439
|
//if(evt.preventDefault) evt.preventDefault();
|
|
4418
4440
|
//return false;
|
|
@@ -4421,9 +4443,10 @@ System.register([], function (exports, module) {
|
|
|
4421
4443
|
|
|
4422
4444
|
this.eventEvents['mousedown'] = jmUtils.bindEvent(this.target,'mousemove',function(evt) {
|
|
4423
4445
|
evt = evt || window.event;
|
|
4446
|
+
evt.eventName = 'mousemove';
|
|
4424
4447
|
let target = evt.target || evt.srcElement;
|
|
4425
4448
|
if(target == canvas) {
|
|
4426
|
-
|
|
4449
|
+
container.raiseEvent('mousemove',evt);
|
|
4427
4450
|
//if(r === false) {
|
|
4428
4451
|
if(evt.preventDefault) evt.preventDefault();
|
|
4429
4452
|
return false;
|
|
@@ -4432,19 +4455,23 @@ System.register([], function (exports, module) {
|
|
|
4432
4455
|
});
|
|
4433
4456
|
|
|
4434
4457
|
this.eventEvents['mousedown'] = jmUtils.bindEvent(this.target,'mouseover',function(evt) {
|
|
4435
|
-
evt = evt || window.event;
|
|
4458
|
+
evt = evt || window.event;
|
|
4459
|
+
evt.eventName = 'mouseover';
|
|
4436
4460
|
container.raiseEvent('mouseover',evt);
|
|
4437
4461
|
});
|
|
4438
4462
|
this.eventEvents['mouseleave'] = jmUtils.bindEvent(this.target,'mouseleave',function(evt) {
|
|
4439
|
-
evt = evt || window.event;
|
|
4463
|
+
evt = evt || window.event;
|
|
4464
|
+
evt.eventName = 'mouseleave';
|
|
4440
4465
|
container.raiseEvent('mouseleave',evt);
|
|
4441
4466
|
});
|
|
4442
4467
|
this.eventEvents['mouseout'] = jmUtils.bindEvent(this.target,'mouseout',function(evt) {
|
|
4443
|
-
evt = evt || window.event;
|
|
4468
|
+
evt = evt || window.event;
|
|
4469
|
+
evt.eventName = 'mouseout';
|
|
4444
4470
|
container.raiseEvent('mouseout',evt);
|
|
4445
4471
|
});
|
|
4446
4472
|
doc && (this.eventEvents['mouseup'] = jmUtils.bindEvent(doc,'mouseup',function(evt) {
|
|
4447
|
-
evt = evt || window.event;
|
|
4473
|
+
evt = evt || window.event;
|
|
4474
|
+
evt.eventName = 'mouseup';
|
|
4448
4475
|
//let target = evt.target || evt.srcElement;
|
|
4449
4476
|
//if(target == canvas) {
|
|
4450
4477
|
let r = container.raiseEvent('mouseup',evt);
|
|
@@ -4457,33 +4484,40 @@ System.register([], function (exports, module) {
|
|
|
4457
4484
|
|
|
4458
4485
|
this.eventEvents['dblclick'] = jmUtils.bindEvent(this.target,'dblclick',function(evt) {
|
|
4459
4486
|
evt = evt || window.event;
|
|
4487
|
+
evt.eventName = 'dblclick';
|
|
4460
4488
|
container.raiseEvent('dblclick',evt);
|
|
4461
4489
|
});
|
|
4462
4490
|
this.eventEvents['click'] = jmUtils.bindEvent(this.target,'click',function(evt) {
|
|
4463
4491
|
evt = evt || window.event;
|
|
4492
|
+
evt.eventName = 'click';
|
|
4464
4493
|
container.raiseEvent('click',evt);
|
|
4465
4494
|
});
|
|
4466
4495
|
|
|
4467
4496
|
doc && (this.eventEvents['resize'] = jmUtils.bindEvent(doc,'resize',function(evt) {
|
|
4468
4497
|
evt = evt || window.event;
|
|
4498
|
+
evt.eventName = 'resize';
|
|
4469
4499
|
return container.raiseEvent('resize',evt);
|
|
4470
4500
|
}));
|
|
4471
4501
|
|
|
4472
4502
|
// passive: false 为了让浏览器不告警并且preventDefault有效
|
|
4473
4503
|
// 另一种处理:touch-action: none; 这样任何触摸事件都不会产生默认行为,但是 touch 事件照样触发。
|
|
4474
4504
|
this.eventEvents['touchstart'] = jmUtils.bindEvent(this.target,'touchstart', function(evt) {
|
|
4505
|
+
evt.eventName = 'touchstart';
|
|
4475
4506
|
return instance.touchStart(evt);
|
|
4476
4507
|
},{ passive: false });
|
|
4477
4508
|
|
|
4478
4509
|
this.eventEvents['touchmove'] = jmUtils.bindEvent(this.target,'touchmove', function(evt) {
|
|
4510
|
+
evt.eventName = 'touchmove';
|
|
4479
4511
|
return instance.touchMove(evt);
|
|
4480
4512
|
},{ passive: false });
|
|
4481
4513
|
|
|
4482
4514
|
doc && (this.eventEvents['touchend'] = jmUtils.bindEvent(doc,'touchend', function(evt) {
|
|
4515
|
+
evt.eventName = 'touchend';
|
|
4483
4516
|
return instance.touchEnd(evt);
|
|
4484
4517
|
},{ passive: false }));
|
|
4485
4518
|
|
|
4486
4519
|
doc && (this.eventEvents['touchcancel'] = jmUtils.bindEvent(doc,'touchcancel', function(evt) {
|
|
4520
|
+
evt.eventName = 'touchcancel';
|
|
4487
4521
|
return instance.touchCancel(evt);
|
|
4488
4522
|
},{ passive: false }));
|
|
4489
4523
|
}
|
|
@@ -4538,7 +4572,7 @@ System.register([], function (exports, module) {
|
|
|
4538
4572
|
return true;
|
|
4539
4573
|
};
|
|
4540
4574
|
|
|
4541
|
-
doc && (this.eventEvents['
|
|
4575
|
+
doc && (this.eventEvents['keypress'] = jmUtils.bindEvent(doc,'keypress',function(evt) {
|
|
4542
4576
|
evt = evt || window.event;
|
|
4543
4577
|
if(!checkKeyEvent(evt)) return;//如果事件为其它输入框,则不响应
|
|
4544
4578
|
let r = container.raiseEvent('keypress',evt);
|
|
@@ -4546,7 +4580,7 @@ System.register([], function (exports, module) {
|
|
|
4546
4580
|
evt.preventDefault();
|
|
4547
4581
|
return r;
|
|
4548
4582
|
}));
|
|
4549
|
-
doc && (this.eventEvents['
|
|
4583
|
+
doc && (this.eventEvents['keydown'] = jmUtils.bindEvent(doc,'keydown',function(evt) {
|
|
4550
4584
|
evt = evt || window.event;
|
|
4551
4585
|
if(!checkKeyEvent(evt)) return;//如果事件为其它输入框,则不响应
|
|
4552
4586
|
let r = container.raiseEvent('keydown',evt);
|
|
@@ -4554,7 +4588,7 @@ System.register([], function (exports, module) {
|
|
|
4554
4588
|
evt.preventDefault();
|
|
4555
4589
|
return r;
|
|
4556
4590
|
}));
|
|
4557
|
-
doc && (this.eventEvents['
|
|
4591
|
+
doc && (this.eventEvents['keyup'] = jmUtils.bindEvent(doc,'keyup',function(evt) {
|
|
4558
4592
|
evt = evt || window.event;
|
|
4559
4593
|
if(!checkKeyEvent(evt)) return;//如果事件为其它输入框,则不响应
|
|
4560
4594
|
let r = container.raiseEvent('keyup',evt);
|
|
@@ -4585,7 +4619,7 @@ System.register([], function (exports, module) {
|
|
|
4585
4619
|
* @param {object} option 参数:{width:宽,height:高}
|
|
4586
4620
|
* @param {function} callback 初始化后的回调
|
|
4587
4621
|
*/
|
|
4588
|
-
class jmGraph extends jmControl {
|
|
4622
|
+
class jmGraph$1 extends jmControl {
|
|
4589
4623
|
|
|
4590
4624
|
constructor(canvas, option, callback) {
|
|
4591
4625
|
if(typeof option == 'function') {
|
|
@@ -4763,7 +4797,7 @@ System.register([], function (exports, module) {
|
|
|
4763
4797
|
* @return {jmGraph} jmGraph实例对象
|
|
4764
4798
|
*/
|
|
4765
4799
|
static create(...args) {
|
|
4766
|
-
return new jmGraph(...args);
|
|
4800
|
+
return new jmGraph$1(...args);
|
|
4767
4801
|
}
|
|
4768
4802
|
|
|
4769
4803
|
/**
|
|
@@ -5063,26 +5097,19 @@ System.register([], function (exports, module) {
|
|
|
5063
5097
|
if(this.___isAutoRefreshing) return;
|
|
5064
5098
|
const self = this;
|
|
5065
5099
|
this.___isAutoRefreshing = true;
|
|
5066
|
-
|
|
5067
|
-
if(typeof requestAnimationFrame === 'undefined') {
|
|
5068
|
-
requestAnimationFrameFun = (fun) => {
|
|
5069
|
-
if(this.__requestAnimationFrameFunHandler) clearTimeout(this.__requestAnimationFrameFunHandler);
|
|
5070
|
-
this.__requestAnimationFrameFunHandler = setTimeout(fun, 20);
|
|
5071
|
-
};
|
|
5072
|
-
}
|
|
5073
|
-
else {
|
|
5074
|
-
requestAnimationFrameFun = requestAnimationFrame;
|
|
5075
|
-
}
|
|
5100
|
+
|
|
5076
5101
|
function update() {
|
|
5077
5102
|
if(self.destoryed) {
|
|
5078
5103
|
self.___isAutoRefreshing = false;
|
|
5079
5104
|
return;// 已销毁
|
|
5080
5105
|
}
|
|
5081
5106
|
if(self.needUpdate) self.redraw();
|
|
5082
|
-
|
|
5107
|
+
self.__requestAnimationFrameFunHandler && jmUtils.cancelAnimationFrame(self.__requestAnimationFrameFunHandler);
|
|
5108
|
+
self.__requestAnimationFrameFunHandler = jmUtils.requestAnimationFrame(update);
|
|
5083
5109
|
if(callback) callback();
|
|
5084
5110
|
}
|
|
5085
|
-
|
|
5111
|
+
self.__requestAnimationFrameFunHandler && jmUtils.cancelAnimationFrame(self.__requestAnimationFrameFunHandler);
|
|
5112
|
+
self.__requestAnimationFrameFunHandler = jmUtils.requestAnimationFrame(update);
|
|
5086
5113
|
return this;
|
|
5087
5114
|
}
|
|
5088
5115
|
|
|
@@ -5109,7 +5136,7 @@ System.register([], function (exports, module) {
|
|
|
5109
5136
|
"resize": jmResize
|
|
5110
5137
|
};
|
|
5111
5138
|
|
|
5112
|
-
class jmGraph
|
|
5139
|
+
class jmGraph extends jmGraph$1 {
|
|
5113
5140
|
constructor(canvas, option, callback) {
|
|
5114
5141
|
|
|
5115
5142
|
const targetType = new.target;
|
|
@@ -5119,9 +5146,9 @@ System.register([], function (exports, module) {
|
|
|
5119
5146
|
option.shapes = Object.assign(shapes, option.shapes||{});
|
|
5120
5147
|
|
|
5121
5148
|
//不是用new实例化的话,返回一个promise
|
|
5122
|
-
if(!targetType || !(targetType.prototype instanceof jmGraph)) {
|
|
5149
|
+
if(!targetType || !(targetType.prototype instanceof jmGraph$1)) {
|
|
5123
5150
|
return new Promise(function(resolve, reject){
|
|
5124
|
-
var g = new jmGraph
|
|
5151
|
+
var g = new jmGraph(canvas, option, callback);
|
|
5125
5152
|
if(resolve) resolve(g);
|
|
5126
5153
|
});
|
|
5127
5154
|
}
|
|
@@ -5135,12 +5162,12 @@ System.register([], function (exports, module) {
|
|
|
5135
5162
|
}
|
|
5136
5163
|
}
|
|
5137
5164
|
|
|
5138
|
-
/**
|
|
5139
|
-
* 基础样式
|
|
5140
|
-
*
|
|
5141
|
-
* @class jmChartStyle
|
|
5142
|
-
* @module jmChart
|
|
5143
|
-
* @static
|
|
5165
|
+
/**
|
|
5166
|
+
* 基础样式
|
|
5167
|
+
*
|
|
5168
|
+
* @class jmChartStyle
|
|
5169
|
+
* @module jmChart
|
|
5170
|
+
* @static
|
|
5144
5171
|
*/
|
|
5145
5172
|
var defaultStyle = {
|
|
5146
5173
|
layout: 'normal',
|
|
@@ -5276,13 +5303,13 @@ System.register([], function (exports, module) {
|
|
|
5276
5303
|
// 图形样式集
|
|
5277
5304
|
chartColors: ['#249FDA', '#EA3B7C', '#8EBC00', '#309B46', '#4B507E', '#D8E404', '#EB792A', '#A00DA0'],
|
|
5278
5305
|
|
|
5279
|
-
/*tooltip: {
|
|
5280
|
-
'background-color': 'rgb(255,255,255)',
|
|
5281
|
-
'padding':'4px',
|
|
5282
|
-
'opacity':'0.8',
|
|
5283
|
-
'border':'1px solid #000',
|
|
5284
|
-
'box-shadow': '0 0 3px #000',
|
|
5285
|
-
'border-radius': '6px'
|
|
5306
|
+
/*tooltip: {
|
|
5307
|
+
'background-color': 'rgb(255,255,255)',
|
|
5308
|
+
'padding':'4px',
|
|
5309
|
+
'opacity':'0.8',
|
|
5310
|
+
'border':'1px solid #000',
|
|
5311
|
+
'box-shadow': '0 0 3px #000',
|
|
5312
|
+
'border-radius': '6px'
|
|
5286
5313
|
},*/
|
|
5287
5314
|
line: {
|
|
5288
5315
|
normal: {
|
|
@@ -5389,18 +5416,35 @@ System.register([], function (exports, module) {
|
|
|
5389
5416
|
blur: 2,
|
|
5390
5417
|
color: '#ccc'
|
|
5391
5418
|
}
|
|
5419
|
+
},
|
|
5420
|
+
candlestick: {
|
|
5421
|
+
normal: {
|
|
5422
|
+
lineWidth: 1,
|
|
5423
|
+
zIndex: 18,
|
|
5424
|
+
cursor: 'default'
|
|
5425
|
+
},
|
|
5426
|
+
hover: {
|
|
5427
|
+
//zIndex: 100,
|
|
5428
|
+
cursor: 'pointer'
|
|
5429
|
+
},
|
|
5430
|
+
perWidth: 0.5,
|
|
5431
|
+
// 阴线颜色
|
|
5432
|
+
negativeColor: 'green',
|
|
5433
|
+
// 阳线颜色
|
|
5434
|
+
masculineColor: 'red',
|
|
5435
|
+
lineWidth: 1
|
|
5392
5436
|
}
|
|
5393
5437
|
};
|
|
5394
5438
|
|
|
5395
|
-
/**
|
|
5396
|
-
* 轴
|
|
5397
|
-
*
|
|
5398
|
-
* @class jmAxis
|
|
5399
|
-
* @module jmChart
|
|
5400
|
-
* @param {jmChart} chart 当前图表
|
|
5401
|
-
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
5402
|
-
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
5403
|
-
* @param {object} [style] 样式
|
|
5439
|
+
/**
|
|
5440
|
+
* 轴
|
|
5441
|
+
*
|
|
5442
|
+
* @class jmAxis
|
|
5443
|
+
* @module jmChart
|
|
5444
|
+
* @param {jmChart} chart 当前图表
|
|
5445
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
5446
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
5447
|
+
* @param {object} [style] 样式
|
|
5404
5448
|
*/
|
|
5405
5449
|
|
|
5406
5450
|
class jmAxis extends jmArrowLine {
|
|
@@ -5447,21 +5491,21 @@ System.register([], function (exports, module) {
|
|
|
5447
5491
|
|
|
5448
5492
|
if (typeof options.minXValue !== 'undefined') this.minValue = options.minXValue; // 最小值,如果指定了,则轴的最小值为它或更小的值
|
|
5449
5493
|
} else {
|
|
5450
|
-
if (typeof options.maxYValue !== 'undefined') this.maxValue = options.maxYValue; // 最大的值,如果指定了,则如果有数值比它大才会修改上限,否则以它为上限
|
|
5494
|
+
if (typeof options.maxYValue !== 'undefined' && (options.maxYValue > this.maxValue || typeof this.maxValue === 'undefined')) this.maxValue = options.maxYValue; // 最大的值,如果指定了,则如果有数值比它大才会修改上限,否则以它为上限
|
|
5451
5495
|
|
|
5452
|
-
if (typeof options.minYValue !== 'undefined') this.minValue = options.minYValue; // 最小值,如果指定了,则轴的最小值为它或更小的值
|
|
5496
|
+
if (typeof options.minYValue !== 'undefined' && (options.minYValue < this.minValue || typeof this.minValue === 'undefined')) this.minValue = options.minYValue; // 最小值,如果指定了,则轴的最小值为它或更小的值
|
|
5453
5497
|
}
|
|
5454
5498
|
}
|
|
5455
|
-
/**
|
|
5456
|
-
* 轴类型(x/y/radar),默认为x
|
|
5457
|
-
*
|
|
5458
|
-
* @property type
|
|
5459
|
-
* @type string
|
|
5499
|
+
/**
|
|
5500
|
+
* 轴类型(x/y/radar),默认为x
|
|
5501
|
+
*
|
|
5502
|
+
* @property type
|
|
5503
|
+
* @type string
|
|
5460
5504
|
*/
|
|
5461
5505
|
|
|
5462
5506
|
|
|
5463
|
-
/**
|
|
5464
|
-
* 关联访问的是chart的数据源
|
|
5507
|
+
/**
|
|
5508
|
+
* 关联访问的是chart的数据源
|
|
5465
5509
|
*/
|
|
5466
5510
|
get data() {
|
|
5467
5511
|
return this.graph.data;
|
|
@@ -5470,10 +5514,10 @@ System.register([], function (exports, module) {
|
|
|
5470
5514
|
set data(d) {
|
|
5471
5515
|
this.graph.data = d;
|
|
5472
5516
|
}
|
|
5473
|
-
/**
|
|
5474
|
-
* 计算当前轴的位置
|
|
5475
|
-
*
|
|
5476
|
-
* @method reset
|
|
5517
|
+
/**
|
|
5518
|
+
* 计算当前轴的位置
|
|
5519
|
+
*
|
|
5520
|
+
* @method reset
|
|
5477
5521
|
*/
|
|
5478
5522
|
|
|
5479
5523
|
|
|
@@ -5531,10 +5575,10 @@ System.register([], function (exports, module) {
|
|
|
5531
5575
|
|
|
5532
5576
|
super.draw();
|
|
5533
5577
|
}
|
|
5534
|
-
/**
|
|
5535
|
-
* 生成轴标签
|
|
5536
|
-
*
|
|
5537
|
-
* @method createLabel
|
|
5578
|
+
/**
|
|
5579
|
+
* 生成轴标签
|
|
5580
|
+
*
|
|
5581
|
+
* @method createLabel
|
|
5538
5582
|
*/
|
|
5539
5583
|
|
|
5540
5584
|
|
|
@@ -5551,11 +5595,11 @@ System.register([], function (exports, module) {
|
|
|
5551
5595
|
this.createYLabel();
|
|
5552
5596
|
}
|
|
5553
5597
|
}
|
|
5554
|
-
/**
|
|
5555
|
-
* 生成X轴标签
|
|
5556
|
-
*
|
|
5557
|
-
* @method createXLabel
|
|
5558
|
-
* @private
|
|
5598
|
+
/**
|
|
5599
|
+
* 生成X轴标签
|
|
5600
|
+
*
|
|
5601
|
+
* @method createXLabel
|
|
5602
|
+
* @private
|
|
5559
5603
|
*/
|
|
5560
5604
|
|
|
5561
5605
|
|
|
@@ -5579,7 +5623,7 @@ System.register([], function (exports, module) {
|
|
|
5579
5623
|
|
|
5580
5624
|
if (!text) continue; /// 只有一条数据,就取这条数据就可以了
|
|
5581
5625
|
|
|
5582
|
-
const w =
|
|
5626
|
+
const w = i * step;
|
|
5583
5627
|
const label = this.graph.createShape('label', {
|
|
5584
5628
|
style: this.style.xLabel
|
|
5585
5629
|
});
|
|
@@ -5646,11 +5690,11 @@ System.register([], function (exports, module) {
|
|
|
5646
5690
|
}
|
|
5647
5691
|
}
|
|
5648
5692
|
}
|
|
5649
|
-
/**
|
|
5650
|
-
* 生成Y轴标签
|
|
5651
|
-
*
|
|
5652
|
-
* @method createYLabel
|
|
5653
|
-
* @private
|
|
5693
|
+
/**
|
|
5694
|
+
* 生成Y轴标签
|
|
5695
|
+
*
|
|
5696
|
+
* @method createYLabel
|
|
5697
|
+
* @private
|
|
5654
5698
|
*/
|
|
5655
5699
|
|
|
5656
5700
|
|
|
@@ -5663,8 +5707,8 @@ System.register([], function (exports, module) {
|
|
|
5663
5707
|
|
|
5664
5708
|
let count = this.labelCount;
|
|
5665
5709
|
const mm = max - min;
|
|
5666
|
-
/*if(mm <= 10) {
|
|
5667
|
-
count = mm;
|
|
5710
|
+
/*if(mm <= 10) {
|
|
5711
|
+
count = mm;
|
|
5668
5712
|
}*/
|
|
5669
5713
|
// mm 放大10000倍,这里结果也需要除于10000
|
|
5670
5714
|
|
|
@@ -5776,10 +5820,10 @@ System.register([], function (exports, module) {
|
|
|
5776
5820
|
}
|
|
5777
5821
|
}
|
|
5778
5822
|
}
|
|
5779
|
-
/**
|
|
5780
|
-
* 获取当前轴所占宽
|
|
5781
|
-
*
|
|
5782
|
-
* @method width
|
|
5823
|
+
/**
|
|
5824
|
+
* 获取当前轴所占宽
|
|
5825
|
+
*
|
|
5826
|
+
* @method width
|
|
5783
5827
|
*/
|
|
5784
5828
|
|
|
5785
5829
|
|
|
@@ -5794,10 +5838,10 @@ System.register([], function (exports, module) {
|
|
|
5794
5838
|
set width(w) {
|
|
5795
5839
|
this._width = w;
|
|
5796
5840
|
}
|
|
5797
|
-
/**
|
|
5798
|
-
* 获取当前轴所占高
|
|
5799
|
-
*
|
|
5800
|
-
* @method height
|
|
5841
|
+
/**
|
|
5842
|
+
* 获取当前轴所占高
|
|
5843
|
+
*
|
|
5844
|
+
* @method height
|
|
5801
5845
|
*/
|
|
5802
5846
|
|
|
5803
5847
|
|
|
@@ -5807,12 +5851,12 @@ System.register([], function (exports, module) {
|
|
|
5807
5851
|
|
|
5808
5852
|
|
|
5809
5853
|
set height(h) {}
|
|
5810
|
-
/**
|
|
5811
|
-
* 获取或设置当前轴最大值
|
|
5812
|
-
*
|
|
5813
|
-
* @method max
|
|
5814
|
-
* @param {number/date/string} 当前轴的最大值
|
|
5815
|
-
* @return 当前轴的最大值
|
|
5854
|
+
/**
|
|
5855
|
+
* 获取或设置当前轴最大值
|
|
5856
|
+
*
|
|
5857
|
+
* @method max
|
|
5858
|
+
* @param {number/date/string} 当前轴的最大值
|
|
5859
|
+
* @return 当前轴的最大值
|
|
5816
5860
|
*/
|
|
5817
5861
|
|
|
5818
5862
|
|
|
@@ -5861,12 +5905,12 @@ System.register([], function (exports, module) {
|
|
|
5861
5905
|
|
|
5862
5906
|
return this._max;
|
|
5863
5907
|
}
|
|
5864
|
-
/**
|
|
5865
|
-
* 获取或设置当前轴最小值
|
|
5866
|
-
*
|
|
5867
|
-
* @method max
|
|
5868
|
-
* @param {number/date/string} 当前轴的最小值
|
|
5869
|
-
* @return 当前轴的最小值
|
|
5908
|
+
/**
|
|
5909
|
+
* 获取或设置当前轴最小值
|
|
5910
|
+
*
|
|
5911
|
+
* @method max
|
|
5912
|
+
* @param {number/date/string} 当前轴的最小值
|
|
5913
|
+
* @return 当前轴的最小值
|
|
5870
5914
|
*/
|
|
5871
5915
|
|
|
5872
5916
|
|
|
@@ -5913,10 +5957,10 @@ System.register([], function (exports, module) {
|
|
|
5913
5957
|
|
|
5914
5958
|
return this.dataType == 'string' ? 0 : this._min;
|
|
5915
5959
|
}
|
|
5916
|
-
/**
|
|
5917
|
-
* 清除一些属性
|
|
5918
|
-
*
|
|
5919
|
-
* @method clear
|
|
5960
|
+
/**
|
|
5961
|
+
* 清除一些属性
|
|
5962
|
+
*
|
|
5963
|
+
* @method clear
|
|
5920
5964
|
*/
|
|
5921
5965
|
|
|
5922
5966
|
|
|
@@ -5924,11 +5968,11 @@ System.register([], function (exports, module) {
|
|
|
5924
5968
|
this._min = null;
|
|
5925
5969
|
this._max = null;
|
|
5926
5970
|
}
|
|
5927
|
-
/**
|
|
5928
|
-
* 计算当前轴的单位偏移量
|
|
5929
|
-
*
|
|
5930
|
-
* @method step
|
|
5931
|
-
* @return {number} 单位偏移量
|
|
5971
|
+
/**
|
|
5972
|
+
* 计算当前轴的单位偏移量
|
|
5973
|
+
*
|
|
5974
|
+
* @method step
|
|
5975
|
+
* @return {number} 单位偏移量
|
|
5932
5976
|
*/
|
|
5933
5977
|
|
|
5934
5978
|
|
|
@@ -5977,12 +6021,12 @@ System.register([], function (exports, module) {
|
|
|
5977
6021
|
|
|
5978
6022
|
}
|
|
5979
6023
|
|
|
5980
|
-
/**
|
|
5981
|
-
* 图例的容器
|
|
5982
|
-
*
|
|
5983
|
-
* @class jmLegend
|
|
5984
|
-
* @module jmChart
|
|
5985
|
-
* @param {jmChart} chart 当前图表
|
|
6024
|
+
/**
|
|
6025
|
+
* 图例的容器
|
|
6026
|
+
*
|
|
6027
|
+
* @class jmLegend
|
|
6028
|
+
* @module jmChart
|
|
6029
|
+
* @param {jmChart} chart 当前图表
|
|
5986
6030
|
*/
|
|
5987
6031
|
|
|
5988
6032
|
class jmLegend extends jmRect {
|
|
@@ -5994,20 +6038,20 @@ System.register([], function (exports, module) {
|
|
|
5994
6038
|
};
|
|
5995
6039
|
super(options);
|
|
5996
6040
|
|
|
5997
|
-
_defineProperty(this, "legendPosition", '
|
|
6041
|
+
_defineProperty(this, "legendPosition", '');
|
|
5998
6042
|
}
|
|
5999
|
-
/**
|
|
6000
|
-
* 图例放置位置
|
|
6043
|
+
/**
|
|
6044
|
+
* 图例放置位置
|
|
6001
6045
|
*/
|
|
6002
6046
|
|
|
6003
6047
|
|
|
6004
6048
|
}
|
|
6005
|
-
/**
|
|
6006
|
-
* 添加图例
|
|
6007
|
-
*
|
|
6008
|
-
* @method append
|
|
6009
|
-
* @param {jmSeries} series 当前图序列
|
|
6010
|
-
* @param {jmControl} shape 当前图例的图形对象
|
|
6049
|
+
/**
|
|
6050
|
+
* 添加图例
|
|
6051
|
+
*
|
|
6052
|
+
* @method append
|
|
6053
|
+
* @param {jmSeries} series 当前图序列
|
|
6054
|
+
* @param {jmControl} shape 当前图例的图形对象
|
|
6011
6055
|
*/
|
|
6012
6056
|
|
|
6013
6057
|
jmLegend.prototype.append = function (series, shape, options = {}) {
|
|
@@ -6047,24 +6091,27 @@ System.register([], function (exports, module) {
|
|
|
6047
6091
|
panel.height = shape.height; //执行进入事件
|
|
6048
6092
|
//触动图例后加粗显示图
|
|
6049
6093
|
|
|
6050
|
-
/*const hover = options.hover || function() {
|
|
6051
|
-
//应用图的动态样式
|
|
6052
|
-
//Object.assign(series.style, series.style.hover);
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
//
|
|
6063
|
-
|
|
6064
|
-
|
|
6094
|
+
/*const hover = options.hover || function() {
|
|
6095
|
+
//应用图的动态样式
|
|
6096
|
+
//Object.assign(series.style, series.style.hover);
|
|
6097
|
+
|
|
6098
|
+
//Object.assign(this.style, this.style.hover || {});
|
|
6099
|
+
|
|
6100
|
+
//series.graph.refresh();
|
|
6101
|
+
};
|
|
6102
|
+
panel.bind('mouseover', hover);
|
|
6103
|
+
//执行离开
|
|
6104
|
+
const leave = options.leave || function() {
|
|
6105
|
+
//应用图的普通样式
|
|
6106
|
+
//Object.assign(series.style, series.style.normal);
|
|
6107
|
+
|
|
6108
|
+
//Object.assign(this.style, this.style.normal || {});
|
|
6109
|
+
//jmUtils.apply(this.series.style.normal,this.series.style);
|
|
6110
|
+
//series.graph.refresh();
|
|
6111
|
+
};
|
|
6065
6112
|
panel.bind('mouseleave', leave);*/
|
|
6066
6113
|
|
|
6067
|
-
const legendPosition = this.legendPosition || this.style.legendPosition;
|
|
6114
|
+
const legendPosition = this.legendPosition || this.style.legendPosition || 'right';
|
|
6068
6115
|
|
|
6069
6116
|
if (legendPosition == 'top' || legendPosition == 'bottom') {
|
|
6070
6117
|
//顶部和底部图例横排,每次右移位一个单位图例
|
|
@@ -6081,10 +6128,10 @@ System.register([], function (exports, module) {
|
|
|
6081
6128
|
|
|
6082
6129
|
this.needUpdate = true;
|
|
6083
6130
|
};
|
|
6084
|
-
/**
|
|
6085
|
-
* 初始化图例
|
|
6086
|
-
*
|
|
6087
|
-
* @method init
|
|
6131
|
+
/**
|
|
6132
|
+
* 初始化图例
|
|
6133
|
+
*
|
|
6134
|
+
* @method init
|
|
6088
6135
|
*/
|
|
6089
6136
|
|
|
6090
6137
|
|
|
@@ -6096,10 +6143,10 @@ System.register([], function (exports, module) {
|
|
|
6096
6143
|
this.style.lineWidth = 0;
|
|
6097
6144
|
this.children.clear();
|
|
6098
6145
|
};
|
|
6099
|
-
/**
|
|
6100
|
-
* 重置图例属性,根据图例内容计算期大小并更新画图区域大小
|
|
6101
|
-
*
|
|
6102
|
-
* @method reset
|
|
6146
|
+
/**
|
|
6147
|
+
* 重置图例属性,根据图例内容计算期大小并更新画图区域大小
|
|
6148
|
+
*
|
|
6149
|
+
* @method reset
|
|
6103
6150
|
*/
|
|
6104
6151
|
|
|
6105
6152
|
|
|
@@ -6144,11 +6191,11 @@ System.register([], function (exports, module) {
|
|
|
6144
6191
|
};
|
|
6145
6192
|
|
|
6146
6193
|
var utils = {
|
|
6147
|
-
/**
|
|
6148
|
-
* 对比二个数组数据是否改变
|
|
6149
|
-
* @param {Array} source 被对比的数、组
|
|
6150
|
-
* @param {Array} target 对比数组
|
|
6151
|
-
* @param {Function} compare 比较函数
|
|
6194
|
+
/**
|
|
6195
|
+
* 对比二个数组数据是否改变
|
|
6196
|
+
* @param {Array} source 被对比的数、组
|
|
6197
|
+
* @param {Array} target 对比数组
|
|
6198
|
+
* @param {Function} compare 比较函数
|
|
6152
6199
|
*/
|
|
6153
6200
|
arrayIsChange(source, target, compare) {
|
|
6154
6201
|
if (!source || !target) return true;
|
|
@@ -6165,14 +6212,14 @@ System.register([], function (exports, module) {
|
|
|
6165
6212
|
|
|
6166
6213
|
};
|
|
6167
6214
|
|
|
6168
|
-
/**
|
|
6169
|
-
* 图形基类
|
|
6170
|
-
*
|
|
6171
|
-
* @class jmSeries
|
|
6172
|
-
* @module jmChart
|
|
6173
|
-
* @param {jmChart} chart 当前图表
|
|
6174
|
-
* @param {array} mappings 图形字段映射
|
|
6175
|
-
* @param {style} style 样式
|
|
6215
|
+
/**
|
|
6216
|
+
* 图形基类
|
|
6217
|
+
*
|
|
6218
|
+
* @class jmSeries
|
|
6219
|
+
* @module jmChart
|
|
6220
|
+
* @param {jmChart} chart 当前图表
|
|
6221
|
+
* @param {array} mappings 图形字段映射
|
|
6222
|
+
* @param {style} style 样式
|
|
6176
6223
|
*/
|
|
6177
6224
|
//构造线图
|
|
6178
6225
|
|
|
@@ -6216,8 +6263,8 @@ System.register([], function (exports, module) {
|
|
|
6216
6263
|
maxYValue: options.maxYValue
|
|
6217
6264
|
});
|
|
6218
6265
|
}
|
|
6219
|
-
/**
|
|
6220
|
-
* 关联访问的是chart的数据源
|
|
6266
|
+
/**
|
|
6267
|
+
* 关联访问的是chart的数据源
|
|
6221
6268
|
*/
|
|
6222
6269
|
|
|
6223
6270
|
|
|
@@ -6239,11 +6286,11 @@ System.register([], function (exports, module) {
|
|
|
6239
6286
|
set enableAnimate(v) {
|
|
6240
6287
|
this.option.enableAnimate = v;
|
|
6241
6288
|
}
|
|
6242
|
-
/**
|
|
6243
|
-
* 图例名称
|
|
6244
|
-
*
|
|
6245
|
-
* @property legendLabel
|
|
6246
|
-
* @type string
|
|
6289
|
+
/**
|
|
6290
|
+
* 图例名称
|
|
6291
|
+
*
|
|
6292
|
+
* @property legendLabel
|
|
6293
|
+
* @type string
|
|
6247
6294
|
*/
|
|
6248
6295
|
|
|
6249
6296
|
|
|
@@ -6273,10 +6320,10 @@ System.register([], function (exports, module) {
|
|
|
6273
6320
|
points: this.dataPoints
|
|
6274
6321
|
};
|
|
6275
6322
|
}
|
|
6276
|
-
/**
|
|
6277
|
-
* 根据X轴坐标,获取它最近的数据描点
|
|
6278
|
-
* 离点最近的一个描点
|
|
6279
|
-
* @param {number} x X轴坐标
|
|
6323
|
+
/**
|
|
6324
|
+
* 根据X轴坐标,获取它最近的数据描点
|
|
6325
|
+
* 离点最近的一个描点
|
|
6326
|
+
* @param {number} x X轴坐标
|
|
6280
6327
|
*/
|
|
6281
6328
|
|
|
6282
6329
|
|
|
@@ -6296,7 +6343,7 @@ System.register([], function (exports, module) {
|
|
|
6296
6343
|
} // 下一个点
|
|
6297
6344
|
|
|
6298
6345
|
|
|
6299
|
-
if (
|
|
6346
|
+
if (p.x > x) {
|
|
6300
6347
|
// 没有上一个,只能返回这个了
|
|
6301
6348
|
if (prePoint && x - prePoint.x < p.x - x) return prePoint;else return p;
|
|
6302
6349
|
}
|
|
@@ -6304,9 +6351,9 @@ System.register([], function (exports, module) {
|
|
|
6304
6351
|
|
|
6305
6352
|
return null;
|
|
6306
6353
|
}
|
|
6307
|
-
/**
|
|
6308
|
-
* 根据X轴值获取数据点
|
|
6309
|
-
* @param {number} xValue X轴值
|
|
6354
|
+
/**
|
|
6355
|
+
* 根据X轴值获取数据点
|
|
6356
|
+
* @param {number} xValue X轴值
|
|
6310
6357
|
*/
|
|
6311
6358
|
|
|
6312
6359
|
|
|
@@ -6320,11 +6367,11 @@ System.register([], function (exports, module) {
|
|
|
6320
6367
|
|
|
6321
6368
|
return null;
|
|
6322
6369
|
}
|
|
6323
|
-
/**
|
|
6324
|
-
* 重置属性
|
|
6325
|
-
* 根据数据源计算轴的属性
|
|
6326
|
-
*
|
|
6327
|
-
* @method reset
|
|
6370
|
+
/**
|
|
6371
|
+
* 重置属性
|
|
6372
|
+
* 根据数据源计算轴的属性
|
|
6373
|
+
*
|
|
6374
|
+
* @method reset
|
|
6328
6375
|
*/
|
|
6329
6376
|
|
|
6330
6377
|
|
|
@@ -6368,10 +6415,10 @@ System.register([], function (exports, module) {
|
|
|
6368
6415
|
this.xAxis.min(xv);
|
|
6369
6416
|
}
|
|
6370
6417
|
}
|
|
6371
|
-
/**
|
|
6372
|
-
* 生成序列图描点
|
|
6373
|
-
*
|
|
6374
|
-
* @method createPoints
|
|
6418
|
+
/**
|
|
6419
|
+
* 生成序列图描点
|
|
6420
|
+
*
|
|
6421
|
+
* @method createPoints
|
|
6375
6422
|
*/
|
|
6376
6423
|
|
|
6377
6424
|
|
|
@@ -6402,7 +6449,7 @@ System.register([], function (exports, module) {
|
|
|
6402
6449
|
style: this.graph.utils.clone(this.style)
|
|
6403
6450
|
}; // 这里的点应相对于chartArea
|
|
6404
6451
|
|
|
6405
|
-
p.x = xstep *
|
|
6452
|
+
p.x = xstep * i + this.xAxis.labelStart;
|
|
6406
6453
|
|
|
6407
6454
|
for (const f of fields) {
|
|
6408
6455
|
const yv = s[f];
|
|
@@ -6413,7 +6460,8 @@ System.register([], function (exports, module) {
|
|
|
6413
6460
|
x: p.x,
|
|
6414
6461
|
// 高度
|
|
6415
6462
|
height: p.height,
|
|
6416
|
-
yValue: yv
|
|
6463
|
+
yValue: yv,
|
|
6464
|
+
field: f
|
|
6417
6465
|
}; //如果Y值不存在。则此点无效,不画图
|
|
6418
6466
|
|
|
6419
6467
|
if (yv == null || typeof yv == 'undefined') {
|
|
@@ -6448,10 +6496,10 @@ System.register([], function (exports, module) {
|
|
|
6448
6496
|
return this.style.color;
|
|
6449
6497
|
}
|
|
6450
6498
|
}
|
|
6451
|
-
/**
|
|
6452
|
-
* 生成图例
|
|
6453
|
-
*
|
|
6454
|
-
* @method createLegend
|
|
6499
|
+
/**
|
|
6500
|
+
* 生成图例
|
|
6501
|
+
*
|
|
6502
|
+
* @method createLegend
|
|
6455
6503
|
*/
|
|
6456
6504
|
|
|
6457
6505
|
|
|
@@ -6503,9 +6551,9 @@ System.register([], function (exports, module) {
|
|
|
6503
6551
|
});
|
|
6504
6552
|
this.addShape(label);
|
|
6505
6553
|
}
|
|
6506
|
-
/**
|
|
6507
|
-
* 在图上加下定制图形
|
|
6508
|
-
* @param {jmShape} shape 图形
|
|
6554
|
+
/**
|
|
6555
|
+
* 在图上加下定制图形
|
|
6556
|
+
* @param {jmShape} shape 图形
|
|
6509
6557
|
*/
|
|
6510
6558
|
|
|
6511
6559
|
|
|
@@ -6514,13 +6562,13 @@ System.register([], function (exports, module) {
|
|
|
6514
6562
|
this.shapes.add(shape);
|
|
6515
6563
|
return shape;
|
|
6516
6564
|
}
|
|
6517
|
-
/**
|
|
6518
|
-
* 获取指定事件的集合
|
|
6519
|
-
* 比如mousedown,mouseup等
|
|
6520
|
-
*
|
|
6521
|
-
* @method getEvent
|
|
6522
|
-
* @param {string} name 事件名称
|
|
6523
|
-
* @return {list} 事件委托的集合
|
|
6565
|
+
/**
|
|
6566
|
+
* 获取指定事件的集合
|
|
6567
|
+
* 比如mousedown,mouseup等
|
|
6568
|
+
*
|
|
6569
|
+
* @method getEvent
|
|
6570
|
+
* @param {string} name 事件名称
|
|
6571
|
+
* @return {list} 事件委托的集合
|
|
6524
6572
|
*/
|
|
6525
6573
|
|
|
6526
6574
|
|
|
@@ -6544,14 +6592,14 @@ System.register([], function (exports, module) {
|
|
|
6544
6592
|
|
|
6545
6593
|
}
|
|
6546
6594
|
|
|
6547
|
-
/**
|
|
6548
|
-
* 柱图
|
|
6549
|
-
*
|
|
6550
|
-
* @class jmBarSeries
|
|
6551
|
-
* @module jmChart
|
|
6552
|
-
* @param {jmChart} chart 当前图表
|
|
6553
|
-
* @param {array} mappings 图形字段映射
|
|
6554
|
-
* @param {style} style 样式
|
|
6595
|
+
/**
|
|
6596
|
+
* 柱图
|
|
6597
|
+
*
|
|
6598
|
+
* @class jmBarSeries
|
|
6599
|
+
* @module jmChart
|
|
6600
|
+
* @param {jmChart} chart 当前图表
|
|
6601
|
+
* @param {array} mappings 图形字段映射
|
|
6602
|
+
* @param {style} style 样式
|
|
6555
6603
|
*/
|
|
6556
6604
|
//构造函数
|
|
6557
6605
|
|
|
@@ -6559,11 +6607,11 @@ System.register([], function (exports, module) {
|
|
|
6559
6607
|
constructor(options) {
|
|
6560
6608
|
super(options);
|
|
6561
6609
|
}
|
|
6562
|
-
/**
|
|
6563
|
-
* 绘制当前图形
|
|
6564
|
-
*
|
|
6565
|
-
* @method beginDraw
|
|
6566
|
-
* @for jmBarSeries
|
|
6610
|
+
/**
|
|
6611
|
+
* 绘制当前图形
|
|
6612
|
+
*
|
|
6613
|
+
* @method beginDraw
|
|
6614
|
+
* @for jmBarSeries
|
|
6567
6615
|
*/
|
|
6568
6616
|
|
|
6569
6617
|
|
|
@@ -6670,9 +6718,9 @@ System.register([], function (exports, module) {
|
|
|
6670
6718
|
this.barTotalWidth = maxWidth * this.graph.barSeriesCount;
|
|
6671
6719
|
}
|
|
6672
6720
|
}
|
|
6673
|
-
/**
|
|
6674
|
-
* 在图上加下定制图形
|
|
6675
|
-
* @param {jmShape} shape 图形
|
|
6721
|
+
/**
|
|
6722
|
+
* 在图上加下定制图形
|
|
6723
|
+
* @param {jmShape} shape 图形
|
|
6676
6724
|
*/
|
|
6677
6725
|
|
|
6678
6726
|
|
|
@@ -6684,14 +6732,14 @@ System.register([], function (exports, module) {
|
|
|
6684
6732
|
|
|
6685
6733
|
}
|
|
6686
6734
|
|
|
6687
|
-
/**
|
|
6688
|
-
* 柱图
|
|
6689
|
-
*
|
|
6690
|
-
* @class jmBarSeries
|
|
6691
|
-
* @module jmChart
|
|
6692
|
-
* @param {jmChart} chart 当前图表
|
|
6693
|
-
* @param {array} mappings 图形字段映射
|
|
6694
|
-
* @param {style} style 样式
|
|
6735
|
+
/**
|
|
6736
|
+
* 柱图
|
|
6737
|
+
*
|
|
6738
|
+
* @class jmBarSeries
|
|
6739
|
+
* @module jmChart
|
|
6740
|
+
* @param {jmChart} chart 当前图表
|
|
6741
|
+
* @param {array} mappings 图形字段映射
|
|
6742
|
+
* @param {style} style 样式
|
|
6695
6743
|
*/
|
|
6696
6744
|
//构造函数
|
|
6697
6745
|
|
|
@@ -6699,11 +6747,11 @@ System.register([], function (exports, module) {
|
|
|
6699
6747
|
constructor(options) {
|
|
6700
6748
|
super(options);
|
|
6701
6749
|
}
|
|
6702
|
-
/**
|
|
6703
|
-
* 绘制当前图形
|
|
6704
|
-
*
|
|
6705
|
-
* @method beginDraw
|
|
6706
|
-
* @for jmBarSeries
|
|
6750
|
+
/**
|
|
6751
|
+
* 绘制当前图形
|
|
6752
|
+
*
|
|
6753
|
+
* @method beginDraw
|
|
6754
|
+
* @for jmBarSeries
|
|
6707
6755
|
*/
|
|
6708
6756
|
|
|
6709
6757
|
|
|
@@ -6833,14 +6881,14 @@ System.register([], function (exports, module) {
|
|
|
6833
6881
|
|
|
6834
6882
|
}
|
|
6835
6883
|
|
|
6836
|
-
/**
|
|
6837
|
-
* 饼图
|
|
6838
|
-
*
|
|
6839
|
-
* @class jmPieSeries
|
|
6840
|
-
* @module jmChart
|
|
6841
|
-
* @param {jmChart} chart 当前图表
|
|
6842
|
-
* @param {array} mappings 图形字段映射
|
|
6843
|
-
* @param {style} style 样式
|
|
6884
|
+
/**
|
|
6885
|
+
* 饼图
|
|
6886
|
+
*
|
|
6887
|
+
* @class jmPieSeries
|
|
6888
|
+
* @module jmChart
|
|
6889
|
+
* @param {jmChart} chart 当前图表
|
|
6890
|
+
* @param {array} mappings 图形字段映射
|
|
6891
|
+
* @param {style} style 样式
|
|
6844
6892
|
*/
|
|
6845
6893
|
//构造函数
|
|
6846
6894
|
|
|
@@ -6924,10 +6972,10 @@ System.register([], function (exports, module) {
|
|
|
6924
6972
|
set startAngle(v) {
|
|
6925
6973
|
this.option.startAngle = v;
|
|
6926
6974
|
}
|
|
6927
|
-
/**
|
|
6928
|
-
* 生成序列图描点
|
|
6929
|
-
*
|
|
6930
|
-
* @method createPoints
|
|
6975
|
+
/**
|
|
6976
|
+
* 生成序列图描点
|
|
6977
|
+
*
|
|
6978
|
+
* @method createPoints
|
|
6931
6979
|
*/
|
|
6932
6980
|
|
|
6933
6981
|
|
|
@@ -7017,8 +7065,8 @@ System.register([], function (exports, module) {
|
|
|
7017
7065
|
maxRadius: p.maxRadius,
|
|
7018
7066
|
minRadius: p.minRadius
|
|
7019
7067
|
});
|
|
7020
|
-
/**
|
|
7021
|
-
* 因为jmgraph是按图形形状来计算所占区域和大小的, 这里我们把扇形占区域改为整个图圆。这样计算大小和渐变时才好闭合。
|
|
7068
|
+
/**
|
|
7069
|
+
* 因为jmgraph是按图形形状来计算所占区域和大小的, 这里我们把扇形占区域改为整个图圆。这样计算大小和渐变时才好闭合。
|
|
7022
7070
|
*/
|
|
7023
7071
|
|
|
7024
7072
|
p.shape.getLocation = function () {
|
|
@@ -7127,10 +7175,10 @@ System.register([], function (exports, module) {
|
|
|
7127
7175
|
}
|
|
7128
7176
|
|
|
7129
7177
|
}
|
|
7130
|
-
/**
|
|
7131
|
-
* 生成图例
|
|
7132
|
-
*
|
|
7133
|
-
* @method createLegend
|
|
7178
|
+
/**
|
|
7179
|
+
* 生成图例
|
|
7180
|
+
*
|
|
7181
|
+
* @method createLegend
|
|
7134
7182
|
*/
|
|
7135
7183
|
|
|
7136
7184
|
jmPieSeries.prototype.createLegend = function () {
|
|
@@ -7172,14 +7220,14 @@ System.register([], function (exports, module) {
|
|
|
7172
7220
|
}
|
|
7173
7221
|
};
|
|
7174
7222
|
|
|
7175
|
-
/**
|
|
7176
|
-
* 图形基类
|
|
7177
|
-
*
|
|
7178
|
-
* @class jmLineSeries
|
|
7179
|
-
* @module jmChart
|
|
7180
|
-
* @param {jmChart} chart 当前图表
|
|
7181
|
-
* @param {array} mappings 图形字段映射
|
|
7182
|
-
* @param {style} style 样式
|
|
7223
|
+
/**
|
|
7224
|
+
* 图形基类
|
|
7225
|
+
*
|
|
7226
|
+
* @class jmLineSeries
|
|
7227
|
+
* @module jmChart
|
|
7228
|
+
* @param {jmChart} chart 当前图表
|
|
7229
|
+
* @param {array} mappings 图形字段映射
|
|
7230
|
+
* @param {style} style 样式
|
|
7183
7231
|
*/
|
|
7184
7232
|
//构造函数
|
|
7185
7233
|
|
|
@@ -7188,11 +7236,11 @@ System.register([], function (exports, module) {
|
|
|
7188
7236
|
options.style = options.style || options.graph.style.line;
|
|
7189
7237
|
super(options); //this.on('beginDraw', this[PreDrawKey]);
|
|
7190
7238
|
}
|
|
7191
|
-
/**
|
|
7192
|
-
* 绘制图形前 初始化线条
|
|
7193
|
-
*
|
|
7194
|
-
* @method preDraw
|
|
7195
|
-
* @for jmLineSeries
|
|
7239
|
+
/**
|
|
7240
|
+
* 绘制图形前 初始化线条
|
|
7241
|
+
*
|
|
7242
|
+
* @method preDraw
|
|
7243
|
+
* @for jmLineSeries
|
|
7196
7244
|
*/
|
|
7197
7245
|
|
|
7198
7246
|
|
|
@@ -7243,8 +7291,8 @@ System.register([], function (exports, module) {
|
|
|
7243
7291
|
shapePoints = this.createCurePoints(shapePoints, p);
|
|
7244
7292
|
} // 如果是虚线
|
|
7245
7293
|
else if (this.style.lineType === 'dotted') {
|
|
7246
|
-
|
|
7247
|
-
|
|
7294
|
+
shapePoints = this.createDotLine(shapePoints, p);
|
|
7295
|
+
}
|
|
7248
7296
|
|
|
7249
7297
|
shapePoints.push(p);
|
|
7250
7298
|
this.createItemLabel(p); // 生成关健值标注
|
|
@@ -7327,10 +7375,10 @@ System.register([], function (exports, module) {
|
|
|
7327
7375
|
|
|
7328
7376
|
return shapePoints;
|
|
7329
7377
|
}
|
|
7330
|
-
/**
|
|
7331
|
-
* 生成图例
|
|
7332
|
-
*
|
|
7333
|
-
* @method createLegend
|
|
7378
|
+
/**
|
|
7379
|
+
* 生成图例
|
|
7380
|
+
*
|
|
7381
|
+
* @method createLegend
|
|
7334
7382
|
*/
|
|
7335
7383
|
|
|
7336
7384
|
|
|
@@ -7419,14 +7467,14 @@ System.register([], function (exports, module) {
|
|
|
7419
7467
|
|
|
7420
7468
|
}
|
|
7421
7469
|
|
|
7422
|
-
/**
|
|
7423
|
-
* 二条线组成的区域图表
|
|
7424
|
-
*
|
|
7425
|
-
* @class jmStackLineSeries
|
|
7426
|
-
* @module jmChart
|
|
7427
|
-
* @param {jmChart} chart 当前图表
|
|
7428
|
-
* @param {array} mappings 图形字段映射
|
|
7429
|
-
* @param {style} style 样式
|
|
7470
|
+
/**
|
|
7471
|
+
* 二条线组成的区域图表
|
|
7472
|
+
*
|
|
7473
|
+
* @class jmStackLineSeries
|
|
7474
|
+
* @module jmChart
|
|
7475
|
+
* @param {jmChart} chart 当前图表
|
|
7476
|
+
* @param {array} mappings 图形字段映射
|
|
7477
|
+
* @param {style} style 样式
|
|
7430
7478
|
*/
|
|
7431
7479
|
//构造函数
|
|
7432
7480
|
|
|
@@ -7435,11 +7483,11 @@ System.register([], function (exports, module) {
|
|
|
7435
7483
|
options.style = options.style || options.graph.style.stackLine;
|
|
7436
7484
|
super(options);
|
|
7437
7485
|
}
|
|
7438
|
-
/**
|
|
7439
|
-
* 绘制图形前 初始化线条
|
|
7440
|
-
*
|
|
7441
|
-
* @method preDraw
|
|
7442
|
-
* @for jmLineSeries
|
|
7486
|
+
/**
|
|
7487
|
+
* 绘制图形前 初始化线条
|
|
7488
|
+
*
|
|
7489
|
+
* @method preDraw
|
|
7490
|
+
* @for jmLineSeries
|
|
7443
7491
|
*/
|
|
7444
7492
|
|
|
7445
7493
|
|
|
@@ -7489,9 +7537,9 @@ System.register([], function (exports, module) {
|
|
|
7489
7537
|
endShapePoints = this.createCurePoints(endShapePoints, p.points[1]);
|
|
7490
7538
|
} // 如果是虚线
|
|
7491
7539
|
else if (this.style.lineType === 'dotted') {
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7540
|
+
startShapePoints = this.createDotLine(startShapePoints, p.points[0]);
|
|
7541
|
+
endShapePoints = this.createDotLine(endShapePoints, p.points[1]);
|
|
7542
|
+
}
|
|
7495
7543
|
|
|
7496
7544
|
startShapePoints.push(p.points[0]);
|
|
7497
7545
|
endShapePoints.push(p.points[1]); // 生成标点的回调
|
|
@@ -7519,10 +7567,10 @@ System.register([], function (exports, module) {
|
|
|
7519
7567
|
areaEnd.m = false;
|
|
7520
7568
|
this.createArea(areaPoints, false);
|
|
7521
7569
|
}
|
|
7522
|
-
/**
|
|
7523
|
-
* 生成图例
|
|
7524
|
-
*
|
|
7525
|
-
* @method createLegend
|
|
7570
|
+
/**
|
|
7571
|
+
* 生成图例
|
|
7572
|
+
*
|
|
7573
|
+
* @method createLegend
|
|
7526
7574
|
*/
|
|
7527
7575
|
|
|
7528
7576
|
|
|
@@ -7570,15 +7618,114 @@ System.register([], function (exports, module) {
|
|
|
7570
7618
|
|
|
7571
7619
|
}
|
|
7572
7620
|
|
|
7573
|
-
/**
|
|
7574
|
-
*
|
|
7575
|
-
*
|
|
7576
|
-
* @class
|
|
7577
|
-
* @module jmChart
|
|
7578
|
-
* @param {jmChart} chart 当前图表
|
|
7579
|
-
* @param {
|
|
7580
|
-
* @param {
|
|
7581
|
-
|
|
7621
|
+
/**
|
|
7622
|
+
* K线图
|
|
7623
|
+
*
|
|
7624
|
+
* @class jmCandlestickSeries
|
|
7625
|
+
* @module jmChart
|
|
7626
|
+
* @param {jmChart} chart 当前图表
|
|
7627
|
+
* @param {array} mappings 图形字段映射
|
|
7628
|
+
* @param {style} style 样式
|
|
7629
|
+
*/
|
|
7630
|
+
//构造函数
|
|
7631
|
+
|
|
7632
|
+
class jmCandlestickSeries extends jmSeries {
|
|
7633
|
+
constructor(options) {
|
|
7634
|
+
options.style = options.style || options.graph.style.line;
|
|
7635
|
+
super(options); //this.on('beginDraw', this[PreDrawKey]);
|
|
7636
|
+
}
|
|
7637
|
+
/**
|
|
7638
|
+
* 绘制图形前 初始化线条
|
|
7639
|
+
*
|
|
7640
|
+
* @method preDraw
|
|
7641
|
+
* @for jmLineSeries
|
|
7642
|
+
*/
|
|
7643
|
+
|
|
7644
|
+
|
|
7645
|
+
init() {
|
|
7646
|
+
//生成描点位
|
|
7647
|
+
const {
|
|
7648
|
+
points
|
|
7649
|
+
} = this.initDataPoint(); //去除多余的线条
|
|
7650
|
+
//当数据源线条数比现有的少时,删除多余的线条
|
|
7651
|
+
|
|
7652
|
+
const len = points.length;
|
|
7653
|
+
this.initWidth(len);
|
|
7654
|
+
const w = this.barWidth / 2; //实心处宽度的一半
|
|
7655
|
+
|
|
7656
|
+
for (let i = 0; i < len; i++) {
|
|
7657
|
+
const p = points[i]; //如果当前点无效,则跳致下一点
|
|
7658
|
+
|
|
7659
|
+
if (typeof p.y === 'undefined' || p.y === null) {
|
|
7660
|
+
//prePoint = null;
|
|
7661
|
+
continue;
|
|
7662
|
+
}
|
|
7663
|
+
|
|
7664
|
+
const sp = this.addShape(this.graph.createPath([], p.style));
|
|
7665
|
+
const bl = {
|
|
7666
|
+
x: p.x - w,
|
|
7667
|
+
y: p.points[0].y
|
|
7668
|
+
};
|
|
7669
|
+
const br = {
|
|
7670
|
+
x: p.x + w,
|
|
7671
|
+
y: p.points[0].y
|
|
7672
|
+
};
|
|
7673
|
+
const tl = {
|
|
7674
|
+
x: p.x - w,
|
|
7675
|
+
y: p.points[1].y
|
|
7676
|
+
};
|
|
7677
|
+
const tr = {
|
|
7678
|
+
x: p.x + w,
|
|
7679
|
+
y: p.points[1].y
|
|
7680
|
+
}; // 默认认为是阳线
|
|
7681
|
+
|
|
7682
|
+
let tm = p.points[1];
|
|
7683
|
+
let bm = p.points[0];
|
|
7684
|
+
p.style.stroke = p.style.fill = p.style.masculineColor || 'red'; // 开盘大于收盘,则阴线
|
|
7685
|
+
|
|
7686
|
+
if (p.points[0].yValue > p.points[1].yValue) {
|
|
7687
|
+
p.style.stroke = p.style.fill = p.style.negativeColor || 'green';
|
|
7688
|
+
bl.y = br.y = p.points[1].y;
|
|
7689
|
+
tl.y = tr.y = p.points[0].y;
|
|
7690
|
+
tm = p.points[0];
|
|
7691
|
+
bm = p.points[1];
|
|
7692
|
+
}
|
|
7693
|
+
|
|
7694
|
+
sp.points.push(p.points[2], tm, tl, bl, bm, p.points[3], bm, br, tr, tm, p.points[2]); // 生成关健值标注
|
|
7695
|
+
|
|
7696
|
+
this.emit('onPointCreated', p);
|
|
7697
|
+
}
|
|
7698
|
+
} // 计算实心体宽度
|
|
7699
|
+
|
|
7700
|
+
|
|
7701
|
+
initWidth(count) {
|
|
7702
|
+
//计算每个柱子占宽
|
|
7703
|
+
//每项柱子占宽除以柱子个数,默认最大宽度为30
|
|
7704
|
+
const maxWidth = this.xAxis.width / count;
|
|
7705
|
+
|
|
7706
|
+
if (this.style.barWidth > 0) {
|
|
7707
|
+
this.barWidth = Number(this.style.barWidth);
|
|
7708
|
+
} else {
|
|
7709
|
+
this.barWidth = maxWidth * (this.style.perWidth || 0.4);
|
|
7710
|
+
}
|
|
7711
|
+
|
|
7712
|
+
if (this.barWidth > maxWidth) {
|
|
7713
|
+
this.barWidth = maxWidth;
|
|
7714
|
+
this.barTotalWidth = maxWidth * count;
|
|
7715
|
+
}
|
|
7716
|
+
}
|
|
7717
|
+
|
|
7718
|
+
}
|
|
7719
|
+
|
|
7720
|
+
/**
|
|
7721
|
+
* 轴
|
|
7722
|
+
*
|
|
7723
|
+
* @class jmAxis
|
|
7724
|
+
* @module jmChart
|
|
7725
|
+
* @param {jmChart} chart 当前图表
|
|
7726
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
7727
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
7728
|
+
* @param {object} [style] 样式
|
|
7582
7729
|
*/
|
|
7583
7730
|
|
|
7584
7731
|
class jmMarkLine extends jmLine {
|
|
@@ -7587,8 +7734,8 @@ System.register([], function (exports, module) {
|
|
|
7587
7734
|
this.visible = false;
|
|
7588
7735
|
this.markLineType = options.type || 'x'; // 为横轴x或纵轴y
|
|
7589
7736
|
|
|
7590
|
-
/**
|
|
7591
|
-
* 当前图形下的所有子图
|
|
7737
|
+
/**
|
|
7738
|
+
* 当前图形下的所有子图
|
|
7592
7739
|
*/
|
|
7593
7740
|
|
|
7594
7741
|
this.shapes = new jmList();
|
|
@@ -7616,14 +7763,13 @@ System.register([], function (exports, module) {
|
|
|
7616
7763
|
if (this.markLineType === 'y') {
|
|
7617
7764
|
const touchPoints = []; // 命中的数据点
|
|
7618
7765
|
|
|
7619
|
-
let touchChange = false;
|
|
7766
|
+
let touchChange = false; // chartGraph 表示图表层,有可能当前graph为操作层
|
|
7767
|
+
|
|
7768
|
+
const graph = this.graph.chartGraph || this.graph;
|
|
7769
|
+
const isTocuhGraph = graph !== this.graph; // 不在图表图层,在操作图层的情况
|
|
7620
7770
|
|
|
7621
7771
|
try {
|
|
7622
|
-
// chartGraph 表示图表层,有可能当前graph为操作层
|
|
7623
|
-
const graph = this.graph.chartGraph || this.graph;
|
|
7624
|
-
const isTocuhGraph = graph !== this.graph; // 不在图表图层,在操作图层的情况
|
|
7625
7772
|
// 查找最近的X坐标
|
|
7626
|
-
|
|
7627
7773
|
const findX = isTocuhGraph ? this.start.x - graph.chartArea.position.x : this.start.x; // 根据线条数生成标点个数
|
|
7628
7774
|
|
|
7629
7775
|
for (const serie of graph.series) {
|
|
@@ -7652,8 +7798,8 @@ System.register([], function (exports, module) {
|
|
|
7652
7798
|
serie.lastMarkPoint = point; // 记下最后一次改变的点
|
|
7653
7799
|
// 同时改变下X轴标线的位置,它的Y坐标跟随最后一个命中的线点
|
|
7654
7800
|
|
|
7655
|
-
if (graph && graph.xMarkLine) {
|
|
7656
|
-
graph.xMarkLine.start.y = graph.xMarkLine.end.y = isTocuhGraph ? point.y + graph.chartArea.position.y : point.y;
|
|
7801
|
+
if (graph && graph.markLine && graph.markLine.xMarkLine) {
|
|
7802
|
+
graph.markLine.xMarkLine.start.y = graph.markLine.xMarkLine.end.y = isTocuhGraph ? point.y + graph.chartArea.position.y : point.y;
|
|
7657
7803
|
}
|
|
7658
7804
|
}
|
|
7659
7805
|
} catch (e) {
|
|
@@ -7668,9 +7814,9 @@ System.register([], function (exports, module) {
|
|
|
7668
7814
|
}, 10);
|
|
7669
7815
|
}
|
|
7670
7816
|
}
|
|
7671
|
-
/**
|
|
7672
|
-
* 移动标线
|
|
7673
|
-
* @param { object } args 移动事件参数
|
|
7817
|
+
/**
|
|
7818
|
+
* 移动标线
|
|
7819
|
+
* @param { object } args 移动事件参数
|
|
7674
7820
|
*/
|
|
7675
7821
|
|
|
7676
7822
|
|
|
@@ -7734,8 +7880,8 @@ System.register([], function (exports, module) {
|
|
|
7734
7880
|
this.needUpdate = true;
|
|
7735
7881
|
}
|
|
7736
7882
|
}
|
|
7737
|
-
/**
|
|
7738
|
-
* 中止
|
|
7883
|
+
/**
|
|
7884
|
+
* 中止
|
|
7739
7885
|
*/
|
|
7740
7886
|
|
|
7741
7887
|
|
|
@@ -7746,16 +7892,173 @@ System.register([], function (exports, module) {
|
|
|
7746
7892
|
|
|
7747
7893
|
}
|
|
7748
7894
|
|
|
7749
|
-
/**
|
|
7750
|
-
*
|
|
7751
|
-
*
|
|
7752
|
-
*
|
|
7753
|
-
* @
|
|
7754
|
-
* @
|
|
7755
|
-
* @param {
|
|
7895
|
+
/**
|
|
7896
|
+
* 轴
|
|
7897
|
+
*
|
|
7898
|
+
* @class jmMarkLineManager
|
|
7899
|
+
* @module jmChart
|
|
7900
|
+
* @param {jmChart} chart 当前图表
|
|
7901
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
7902
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
7903
|
+
* @param {object} [style] 样式
|
|
7904
|
+
*/
|
|
7905
|
+
|
|
7906
|
+
class jmMarkLineManager {
|
|
7907
|
+
constructor(chart) {
|
|
7908
|
+
this.chart = chart;
|
|
7909
|
+
this.init(chart);
|
|
7910
|
+
} // 初始化
|
|
7911
|
+
|
|
7912
|
+
|
|
7913
|
+
init(chart) {
|
|
7914
|
+
const graph = chart.touchGraph || chart;
|
|
7915
|
+
graph.on('beginDraw', () => {
|
|
7916
|
+
// 重置标线,会处理小圆圈问题
|
|
7917
|
+
this.xMarkLine && this.xMarkLine.init();
|
|
7918
|
+
this.yMarkLine && this.yMarkLine.init();
|
|
7919
|
+
});
|
|
7920
|
+
|
|
7921
|
+
if (chart.style.markLine) {
|
|
7922
|
+
// 生成标线,可以跟随鼠标或手指滑动
|
|
7923
|
+
if (chart.style.markLine && chart.style.markLine.x) {
|
|
7924
|
+
this.xMarkLine = graph.createShape(jmMarkLine, {
|
|
7925
|
+
type: 'x',
|
|
7926
|
+
style: chart.style.markLine
|
|
7927
|
+
});
|
|
7928
|
+
const area = graph.chartArea || graph;
|
|
7929
|
+
area.children.add(this.xMarkLine);
|
|
7930
|
+
}
|
|
7931
|
+
|
|
7932
|
+
if (chart.style.markLine && chart.style.markLine.y) {
|
|
7933
|
+
this.yMarkLine = graph.createShape(jmMarkLine, {
|
|
7934
|
+
type: 'y',
|
|
7935
|
+
style: chart.style.markLine
|
|
7936
|
+
});
|
|
7937
|
+
const area = graph.chartArea || graph;
|
|
7938
|
+
area.children.add(this.yMarkLine);
|
|
7939
|
+
}
|
|
7940
|
+
|
|
7941
|
+
let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
|
|
7942
|
+
|
|
7943
|
+
let longtapHandler = 0;
|
|
7944
|
+
let touchStartPos = {
|
|
7945
|
+
x: 0,
|
|
7946
|
+
y: 0
|
|
7947
|
+
};
|
|
7948
|
+
graph.on('mousedown touchstart', args => {
|
|
7949
|
+
// 如果长按才启用
|
|
7950
|
+
if (chart.style.markLine.longtap) {
|
|
7951
|
+
longtap = 1;
|
|
7952
|
+
longtapHandler && graph.utils.cancelAnimationFrame(longtapHandler);
|
|
7953
|
+
let tapStartTime = Date.now();
|
|
7954
|
+
|
|
7955
|
+
const reqFun = () => {
|
|
7956
|
+
const elapsed = Date.now() - tapStartTime;
|
|
7957
|
+
|
|
7958
|
+
if (longtap === 1 || longtap === 2) {
|
|
7959
|
+
// 如果还未过一定时间,则继续等待
|
|
7960
|
+
if (elapsed < 500) {
|
|
7961
|
+
longtapHandler = graph.utils.requestAnimationFrame(reqFun);
|
|
7962
|
+
return;
|
|
7963
|
+
}
|
|
7964
|
+
|
|
7965
|
+
longtap = 2;
|
|
7966
|
+
this.startMove(args);
|
|
7967
|
+
chart.emit('marklinelongtapstart', args);
|
|
7968
|
+
}
|
|
7969
|
+
}; // 如果一定时间后还没有取消,则表示长按了
|
|
7970
|
+
|
|
7971
|
+
|
|
7972
|
+
longtapHandler = graph.utils.requestAnimationFrame(reqFun); //args.event.stopPropagation();
|
|
7973
|
+
|
|
7974
|
+
args.event.preventDefault(); // 阻止默认行为
|
|
7975
|
+
} else {
|
|
7976
|
+
this.startMove(args);
|
|
7977
|
+
}
|
|
7978
|
+
|
|
7979
|
+
args.longtap = longtap;
|
|
7980
|
+
touchStartPos = args.position;
|
|
7981
|
+
}); // 移动标线
|
|
7982
|
+
|
|
7983
|
+
graph.on('mousemove touchmove', args => {
|
|
7984
|
+
const ox = args.position.x - touchStartPos.x;
|
|
7985
|
+
const oy = args.position.y - touchStartPos.y;
|
|
7986
|
+
const offpos = Math.sqrt(ox * ox + oy * oy);
|
|
7987
|
+
if (longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
|
|
7988
|
+
|
|
7989
|
+
args.longtap = longtap;
|
|
7990
|
+
this.move(args);
|
|
7991
|
+
}); // 取消移动
|
|
7992
|
+
|
|
7993
|
+
graph.on('mouseup touchend touchcancel touchleave', args => {
|
|
7994
|
+
longtap = 0;
|
|
7995
|
+
this.endMove(args);
|
|
7996
|
+
});
|
|
7997
|
+
}
|
|
7998
|
+
} // 开始移动标线
|
|
7999
|
+
|
|
8000
|
+
|
|
8001
|
+
startMove(args, markLineType = 'xy') {
|
|
8002
|
+
if (this.xMarkLine && markLineType.includes('x')) {
|
|
8003
|
+
this.xMarkLine.visible = true;
|
|
8004
|
+
this.xMarkLine.move(args);
|
|
8005
|
+
}
|
|
8006
|
+
|
|
8007
|
+
if (this.yMarkLine && markLineType.includes('y')) {
|
|
8008
|
+
this.yMarkLine.visible = true;
|
|
8009
|
+
this.yMarkLine.move(args);
|
|
8010
|
+
}
|
|
8011
|
+
|
|
8012
|
+
if (!args.cancel) this.chart.emit('marklinestartmove', args);
|
|
8013
|
+
} // 移动标线
|
|
8014
|
+
|
|
8015
|
+
|
|
8016
|
+
move(args) {
|
|
8017
|
+
let moved = false;
|
|
8018
|
+
|
|
8019
|
+
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
8020
|
+
this.xMarkLine.move(args);
|
|
8021
|
+
moved = true;
|
|
8022
|
+
}
|
|
8023
|
+
|
|
8024
|
+
if (this.yMarkLine && this.yMarkLine.visible) {
|
|
8025
|
+
this.yMarkLine.move(args);
|
|
8026
|
+
moved = true;
|
|
8027
|
+
}
|
|
8028
|
+
|
|
8029
|
+
if (moved) {
|
|
8030
|
+
args.event.stopPropagation();
|
|
8031
|
+
args.event.preventDefault(); // 阻止默认行为
|
|
8032
|
+
|
|
8033
|
+
if (!args.cancel) this.chart.emit('marklinemove', args);
|
|
8034
|
+
}
|
|
8035
|
+
} // 终止动移
|
|
8036
|
+
|
|
8037
|
+
|
|
8038
|
+
endMove(args) {
|
|
8039
|
+
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
8040
|
+
this.xMarkLine.cancel(args);
|
|
8041
|
+
}
|
|
8042
|
+
|
|
8043
|
+
if (this.yMarkLine && this.yMarkLine.visible) {
|
|
8044
|
+
this.yMarkLine.cancel(args);
|
|
8045
|
+
}
|
|
8046
|
+
|
|
8047
|
+
if (!args.cancel) this.chart.emit('marklineendmove', args);
|
|
8048
|
+
}
|
|
8049
|
+
|
|
8050
|
+
}
|
|
8051
|
+
|
|
8052
|
+
/**
|
|
8053
|
+
* jm图表组件
|
|
8054
|
+
* option参数:graph=jmgraph
|
|
8055
|
+
*
|
|
8056
|
+
* @class jmChart
|
|
8057
|
+
* @module jmChart
|
|
8058
|
+
* @param {element} container 图表容器
|
|
7756
8059
|
*/
|
|
7757
8060
|
|
|
7758
|
-
class jmChart extends jmGraph
|
|
8061
|
+
class jmChart extends jmGraph {
|
|
7759
8062
|
constructor(container, options) {
|
|
7760
8063
|
options = options || {};
|
|
7761
8064
|
const enableAnimate = !!options.enableAnimate;
|
|
@@ -7781,13 +8084,13 @@ System.register([], function (exports, module) {
|
|
|
7781
8084
|
|
|
7782
8085
|
this.createTouchGraph(this.container, options);
|
|
7783
8086
|
}
|
|
7784
|
-
/**
|
|
7785
|
-
* 绑定的数据源
|
|
8087
|
+
/**
|
|
8088
|
+
* 绑定的数据源
|
|
7786
8089
|
*/
|
|
7787
8090
|
|
|
7788
8091
|
|
|
7789
|
-
/**
|
|
7790
|
-
* 是否启用动画
|
|
8092
|
+
/**
|
|
8093
|
+
* 是否启用动画
|
|
7791
8094
|
*/
|
|
7792
8095
|
get enableAnimate() {
|
|
7793
8096
|
if (typeof this.option.enableAnimate !== 'undefined') return !!this.option.enableAnimate;else {
|
|
@@ -7798,8 +8101,8 @@ System.register([], function (exports, module) {
|
|
|
7798
8101
|
set enableAnimate(v) {
|
|
7799
8102
|
this.option.enableAnimate = v;
|
|
7800
8103
|
}
|
|
7801
|
-
/**
|
|
7802
|
-
* Y轴的基线 默认是0
|
|
8104
|
+
/**
|
|
8105
|
+
* Y轴的基线 默认是0
|
|
7803
8106
|
*/
|
|
7804
8107
|
|
|
7805
8108
|
|
|
@@ -7813,11 +8116,11 @@ System.register([], function (exports, module) {
|
|
|
7813
8116
|
|
|
7814
8117
|
|
|
7815
8118
|
init(options) {
|
|
7816
|
-
/**
|
|
7817
|
-
* 绘图区域
|
|
7818
|
-
*
|
|
7819
|
-
* @property chartArea
|
|
7820
|
-
* @type jmControl
|
|
8119
|
+
/**
|
|
8120
|
+
* 绘图区域
|
|
8121
|
+
*
|
|
8122
|
+
* @property chartArea
|
|
8123
|
+
* @type jmControl
|
|
7821
8124
|
*/
|
|
7822
8125
|
if (!this.chartArea) {
|
|
7823
8126
|
this.chartArea = this.createShape('rect', {
|
|
@@ -7829,11 +8132,11 @@ System.register([], function (exports, module) {
|
|
|
7829
8132
|
});
|
|
7830
8133
|
this.children.add(this.chartArea);
|
|
7831
8134
|
}
|
|
7832
|
-
/**
|
|
7833
|
-
* 图例
|
|
7834
|
-
*
|
|
7835
|
-
* @property legend
|
|
7836
|
-
* @type jmLegend
|
|
8135
|
+
/**
|
|
8136
|
+
* 图例
|
|
8137
|
+
*
|
|
8138
|
+
* @property legend
|
|
8139
|
+
* @type jmLegend
|
|
7837
8140
|
*/
|
|
7838
8141
|
|
|
7839
8142
|
|
|
@@ -7845,11 +8148,11 @@ System.register([], function (exports, module) {
|
|
|
7845
8148
|
if (options.legendVisible === false) {
|
|
7846
8149
|
this.legend.visible = false;
|
|
7847
8150
|
}
|
|
7848
|
-
/**
|
|
7849
|
-
* 图表提示控件
|
|
7850
|
-
*
|
|
7851
|
-
* @property tooltip
|
|
7852
|
-
* @type jmTooltip
|
|
8151
|
+
/**
|
|
8152
|
+
* 图表提示控件
|
|
8153
|
+
*
|
|
8154
|
+
* @property tooltip
|
|
8155
|
+
* @type jmTooltip
|
|
7853
8156
|
*/
|
|
7854
8157
|
//this.tooltip = this.graph.createShape('tooltip',{style:this.style.tooltip});
|
|
7855
8158
|
//this.chartArea.children.add(this.tooltip);
|
|
@@ -7867,84 +8170,36 @@ System.register([], function (exports, module) {
|
|
|
7867
8170
|
container && (container.style.position = 'relative');
|
|
7868
8171
|
options = this.utils.clone(options, {
|
|
7869
8172
|
autoRefresh: true
|
|
7870
|
-
}, true);
|
|
7871
|
-
let graph = this.touchGraph = this; // 生成图层, 当图刷新慢时,需要用一个操作图层来进行滑动等操作重绘
|
|
8173
|
+
}, true); // 生成图层, 当图刷新慢时,需要用一个操作图层来进行滑动等操作重绘
|
|
7872
8174
|
// isWXMiniApp 非微信小程序下才能创建
|
|
7873
8175
|
|
|
7874
|
-
if (!
|
|
8176
|
+
if (!this.isWXMiniApp && container && options.touchGraph) {
|
|
7875
8177
|
let cn = document.createElement('canvas');
|
|
7876
8178
|
cn.width = container.offsetWidth || container.clientWidth;
|
|
7877
8179
|
cn.height = container.offsetHeight || container.clientHeight;
|
|
7878
8180
|
cn.style.position = 'absolute';
|
|
7879
8181
|
cn.style.top = 0;
|
|
7880
8182
|
cn.style.left = 0;
|
|
7881
|
-
this.touchGraph =
|
|
8183
|
+
this.touchGraph = new jmGraph(cn, options);
|
|
7882
8184
|
container.appendChild(cn);
|
|
7883
8185
|
this.touchGraph.chartGraph = this;
|
|
7884
8186
|
this.on('propertyChange', (name, args) => {
|
|
7885
8187
|
if (['width', 'height'].includes(name)) {
|
|
7886
8188
|
this.touchGraph[name] = args.newValue / this.devicePixelRatio;
|
|
7887
8189
|
}
|
|
7888
|
-
});
|
|
7889
|
-
}
|
|
8190
|
+
}); // 把上层canvse事件传递给绘图层对象
|
|
7890
8191
|
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
// 重置标线,会处理小圆圈问题
|
|
7894
|
-
this.xMarkLine && this.xMarkLine.init();
|
|
7895
|
-
this.yMarkLine && this.yMarkLine.init();
|
|
7896
|
-
}); // 生成标线,可以跟随鼠标或手指滑动
|
|
8192
|
+
this.touchGraph.on('mousedown touchstart mousemove touchmove mouseup touchend touchcancel touchleave', args => {
|
|
8193
|
+
const eventName = args.event.eventName || args.event.type;
|
|
7897
8194
|
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
type: 'x',
|
|
7901
|
-
style: this.style.markLine
|
|
7902
|
-
});
|
|
7903
|
-
const area = graph.chartArea || graph;
|
|
7904
|
-
area.children.add(this.xMarkLine);
|
|
7905
|
-
}
|
|
7906
|
-
|
|
7907
|
-
if (this.style.markLine && this.style.markLine.y) {
|
|
7908
|
-
this.yMarkLine = graph.createShape(jmMarkLine, {
|
|
7909
|
-
type: 'y',
|
|
7910
|
-
style: this.style.markLine
|
|
7911
|
-
});
|
|
7912
|
-
const area = graph.chartArea || graph;
|
|
7913
|
-
area.children.add(this.yMarkLine);
|
|
7914
|
-
}
|
|
7915
|
-
|
|
7916
|
-
graph.on('mousedown touchstart', args => {
|
|
7917
|
-
if (this.xMarkLine) {
|
|
7918
|
-
this.xMarkLine.visible = true;
|
|
7919
|
-
this.xMarkLine.move(args);
|
|
7920
|
-
}
|
|
7921
|
-
|
|
7922
|
-
if (this.yMarkLine) {
|
|
7923
|
-
this.yMarkLine.visible = true;
|
|
7924
|
-
this.yMarkLine.move(args);
|
|
7925
|
-
}
|
|
7926
|
-
}); // 移动标线
|
|
7927
|
-
|
|
7928
|
-
graph.on('mousemove touchmove', args => {
|
|
7929
|
-
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
7930
|
-
this.xMarkLine.move(args);
|
|
7931
|
-
}
|
|
7932
|
-
|
|
7933
|
-
if (this.yMarkLine && this.yMarkLine.visible) {
|
|
7934
|
-
this.yMarkLine.move(args);
|
|
8195
|
+
if (eventName) {
|
|
8196
|
+
this.emit(eventName, args);
|
|
7935
8197
|
}
|
|
7936
|
-
});
|
|
8198
|
+
});
|
|
8199
|
+
} // 初始化标线
|
|
7937
8200
|
|
|
7938
|
-
graph.on('mouseup touchend touchcancel touchleave', args => {
|
|
7939
|
-
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
7940
|
-
this.xMarkLine.cancel(args);
|
|
7941
|
-
}
|
|
7942
8201
|
|
|
7943
|
-
|
|
7944
|
-
this.yMarkLine.cancel(args);
|
|
7945
|
-
}
|
|
7946
|
-
});
|
|
7947
|
-
}
|
|
8202
|
+
this.markLine = new jmMarkLineManager(this);
|
|
7948
8203
|
} // 重置整个图表
|
|
7949
8204
|
|
|
7950
8205
|
|
|
@@ -7977,11 +8232,11 @@ System.register([], function (exports, module) {
|
|
|
7977
8232
|
delete this.yAxises;
|
|
7978
8233
|
}
|
|
7979
8234
|
}
|
|
7980
|
-
/**
|
|
7981
|
-
* 获取颜色
|
|
7982
|
-
*
|
|
7983
|
-
* @method getColor
|
|
7984
|
-
* @param {int} index 颜色索引
|
|
8235
|
+
/**
|
|
8236
|
+
* 获取颜色
|
|
8237
|
+
*
|
|
8238
|
+
* @method getColor
|
|
8239
|
+
* @param {int} index 颜色索引
|
|
7985
8240
|
*/
|
|
7986
8241
|
|
|
7987
8242
|
|
|
@@ -7993,11 +8248,11 @@ System.register([], function (exports, module) {
|
|
|
7993
8248
|
|
|
7994
8249
|
return this.style.chartColors[index];
|
|
7995
8250
|
}
|
|
7996
|
-
/**
|
|
7997
|
-
* 绘制当前图表
|
|
7998
|
-
* 先绘制轴等基础信息
|
|
7999
|
-
*
|
|
8000
|
-
* @method beginDraw
|
|
8251
|
+
/**
|
|
8252
|
+
* 绘制当前图表
|
|
8253
|
+
* 先绘制轴等基础信息
|
|
8254
|
+
*
|
|
8255
|
+
* @method beginDraw
|
|
8001
8256
|
*/
|
|
8002
8257
|
|
|
8003
8258
|
|
|
@@ -8062,10 +8317,10 @@ System.register([], function (exports, module) {
|
|
|
8062
8317
|
serie.init && serie.init();
|
|
8063
8318
|
}); //console.log('beginDraw4', Date.now() - startTime);
|
|
8064
8319
|
}
|
|
8065
|
-
/**
|
|
8066
|
-
* 重新定位区域的位置
|
|
8067
|
-
*
|
|
8068
|
-
* @method resetAreaPosition
|
|
8320
|
+
/**
|
|
8321
|
+
* 重新定位区域的位置
|
|
8322
|
+
*
|
|
8323
|
+
* @method resetAreaPosition
|
|
8069
8324
|
*/
|
|
8070
8325
|
|
|
8071
8326
|
|
|
@@ -8077,15 +8332,15 @@ System.register([], function (exports, module) {
|
|
|
8077
8332
|
this.chartArea.width = w;
|
|
8078
8333
|
this.chartArea.height = h;
|
|
8079
8334
|
}
|
|
8080
|
-
/**
|
|
8081
|
-
* 创建轴
|
|
8082
|
-
*
|
|
8083
|
-
* @method createAxis
|
|
8084
|
-
* @for jmChart
|
|
8085
|
-
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
8086
|
-
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
8087
|
-
* @param {object} [style] 样式
|
|
8088
|
-
* @return {axis} 轴
|
|
8335
|
+
/**
|
|
8336
|
+
* 创建轴
|
|
8337
|
+
*
|
|
8338
|
+
* @method createAxis
|
|
8339
|
+
* @for jmChart
|
|
8340
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
8341
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
8342
|
+
* @param {object} [style] 样式
|
|
8343
|
+
* @return {axis} 轴
|
|
8089
8344
|
*/
|
|
8090
8345
|
|
|
8091
8346
|
|
|
@@ -8097,12 +8352,12 @@ System.register([], function (exports, module) {
|
|
|
8097
8352
|
this.children.add(axis);
|
|
8098
8353
|
return axis;
|
|
8099
8354
|
}
|
|
8100
|
-
/**
|
|
8101
|
-
* 生成X轴
|
|
8102
|
-
*
|
|
8103
|
-
* @method createXAxis
|
|
8104
|
-
* @param {string} x轴的数据类型(string/number/date)
|
|
8105
|
-
* @param {bool} 是否从0开始
|
|
8355
|
+
/**
|
|
8356
|
+
* 生成X轴
|
|
8357
|
+
*
|
|
8358
|
+
* @method createXAxis
|
|
8359
|
+
* @param {string} x轴的数据类型(string/number/date)
|
|
8360
|
+
* @param {bool} 是否从0开始
|
|
8106
8361
|
*/
|
|
8107
8362
|
|
|
8108
8363
|
|
|
@@ -8129,13 +8384,13 @@ System.register([], function (exports, module) {
|
|
|
8129
8384
|
|
|
8130
8385
|
return this.xAxis;
|
|
8131
8386
|
}
|
|
8132
|
-
/**
|
|
8133
|
-
* 生成Y轴
|
|
8134
|
-
*
|
|
8135
|
-
* @method createYAxis
|
|
8136
|
-
* @param {int} Y轴索引,可以创建多个Y轴
|
|
8137
|
-
* @param {string} y轴的数据类型(string/number/date)
|
|
8138
|
-
* @param {bool} 是否从0开始
|
|
8387
|
+
/**
|
|
8388
|
+
* 生成Y轴
|
|
8389
|
+
*
|
|
8390
|
+
* @method createYAxis
|
|
8391
|
+
* @param {int} Y轴索引,可以创建多个Y轴
|
|
8392
|
+
* @param {string} y轴的数据类型(string/number/date)
|
|
8393
|
+
* @param {bool} 是否从0开始
|
|
8139
8394
|
*/
|
|
8140
8395
|
|
|
8141
8396
|
|
|
@@ -8164,14 +8419,14 @@ System.register([], function (exports, module) {
|
|
|
8164
8419
|
var yaxis = this.yAxises[options.index] || (this.yAxises[options.index] = this.createAxis(options));
|
|
8165
8420
|
return yaxis;
|
|
8166
8421
|
}
|
|
8167
|
-
/**
|
|
8168
|
-
* 创建图形
|
|
8169
|
-
*
|
|
8170
|
-
* @method createSeries
|
|
8171
|
-
* @for jmChart
|
|
8172
|
-
* @param {string} [type] 图类型,(line/bar/pie/radar)
|
|
8173
|
-
* @param {object} [options] 生成图表选项 {xField, yField, index}
|
|
8174
|
-
* @return {series} 图形
|
|
8422
|
+
/**
|
|
8423
|
+
* 创建图形
|
|
8424
|
+
*
|
|
8425
|
+
* @method createSeries
|
|
8426
|
+
* @for jmChart
|
|
8427
|
+
* @param {string} [type] 图类型,(line/bar/pie/radar)
|
|
8428
|
+
* @param {object} [options] 生成图表选项 {xField, yField, index}
|
|
8429
|
+
* @return {series} 图形
|
|
8175
8430
|
*/
|
|
8176
8431
|
|
|
8177
8432
|
|
|
@@ -8182,7 +8437,8 @@ System.register([], function (exports, module) {
|
|
|
8182
8437
|
'bar': jmBarSeries,
|
|
8183
8438
|
'stackBar': jmStackBarSeries,
|
|
8184
8439
|
'pie': jmPieSeries,
|
|
8185
|
-
'stackLine': jmStackLineSeries
|
|
8440
|
+
'stackLine': jmStackLineSeries,
|
|
8441
|
+
'candlestick': jmCandlestickSeries
|
|
8186
8442
|
};
|
|
8187
8443
|
} //默认样式为类型对应的样式
|
|
8188
8444
|
|