jmchart 1.1.81 → 1.1.91
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 +682 -427
- package/dist/jmchart.cjs.js +680 -425
- package/dist/jmchart.esm.js +679 -424
- package/dist/jmchart.iife.js +681 -426
- package/dist/jmchart.system.js +684 -429
- package/example/bar.html +186 -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 +93 -40
- package/example/vue.html +322 -322
- package/example/wk/line.html +314 -314
- package/index.js +8 -8
- package/package.json +42 -42
- package/rollup.config.js +26 -26
- package/server.js +48 -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 +153 -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.amd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(['exports'],
|
|
1
|
+
define(['exports'], function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
function _defineProperty(obj, key, value) {
|
|
4
4
|
if (key in obj) {
|
|
@@ -340,7 +340,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
340
340
|
let isTouch = false;
|
|
341
341
|
let touches = evt.changedTouches || evt.targetTouches || evt.touches;
|
|
342
342
|
let target = evt.target || evt.srcElement;
|
|
343
|
-
if(touches) {
|
|
343
|
+
if(touches && touches.length) {
|
|
344
344
|
evt = touches[0];//兼容touch事件
|
|
345
345
|
if(!evt.target) evt.target = target;
|
|
346
346
|
isTouch = true;
|
|
@@ -873,6 +873,23 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
873
873
|
}
|
|
874
874
|
return r;
|
|
875
875
|
}
|
|
876
|
+
// window.requestAnimationFrame() 告诉浏览器——你希望执行一个动画,并且要求浏览器在下次重绘之前调用指定的回调函数更新动画。该方法需要传入一个回调函数作为参数,该回调函数会在浏览器下一次重绘之前执行
|
|
877
|
+
static requestAnimationFrame(callback) {
|
|
878
|
+
if(typeof requestAnimationFrame === 'undefined') {
|
|
879
|
+
return setTimeout(callback, 20);
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
return requestAnimationFrame(callback);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
static cancelAnimationFrame(handler) {
|
|
886
|
+
if(typeof requestAnimationFrame === 'undefined') {
|
|
887
|
+
return clearTimeout(handler);
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
return cancelAnimationFrame(handler);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
876
893
|
}
|
|
877
894
|
|
|
878
895
|
/**
|
|
@@ -4338,6 +4355,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4338
4355
|
|
|
4339
4356
|
touchStart(evt) {
|
|
4340
4357
|
evt = evt || window.event;
|
|
4358
|
+
evt.eventName = 'touchstart';
|
|
4341
4359
|
this.container.raiseEvent('touchstart',evt);
|
|
4342
4360
|
let t = evt.target || evt.srcElement;
|
|
4343
4361
|
if(t == this.target) {
|
|
@@ -4348,6 +4366,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4348
4366
|
|
|
4349
4367
|
touchMove(evt) {
|
|
4350
4368
|
evt = evt || window.event;
|
|
4369
|
+
evt.eventName = 'touchmove';
|
|
4351
4370
|
this.container.raiseEvent('touchmove',evt);
|
|
4352
4371
|
let t = evt.target || evt.srcElement;
|
|
4353
4372
|
if(t == this.target) {
|
|
@@ -4358,6 +4377,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4358
4377
|
|
|
4359
4378
|
touchEnd(evt) {
|
|
4360
4379
|
evt = evt || window.event;
|
|
4380
|
+
evt.eventName = 'touchend';
|
|
4361
4381
|
|
|
4362
4382
|
this.container.raiseEvent('touchend',evt);
|
|
4363
4383
|
let t = evt.target || evt.srcElement;
|
|
@@ -4369,6 +4389,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4369
4389
|
|
|
4370
4390
|
touchCancel(evt) {
|
|
4371
4391
|
evt = evt || window.event;
|
|
4392
|
+
evt.eventName = 'touchcancel';
|
|
4372
4393
|
|
|
4373
4394
|
this.container.raiseEvent('touchcancel',evt);
|
|
4374
4395
|
let t = evt.target || evt.srcElement;
|
|
@@ -4409,6 +4430,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4409
4430
|
|
|
4410
4431
|
this.eventEvents['mousedown'] = jmUtils.bindEvent(this.target,'mousedown',function(evt) {
|
|
4411
4432
|
evt = evt || window.event;
|
|
4433
|
+
evt.eventName = 'mousedown';
|
|
4412
4434
|
container.raiseEvent('mousedown',evt);
|
|
4413
4435
|
//if(r === false) {
|
|
4414
4436
|
//if(evt.preventDefault) evt.preventDefault();
|
|
@@ -4418,6 +4440,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4418
4440
|
|
|
4419
4441
|
this.eventEvents['mousedown'] = jmUtils.bindEvent(this.target,'mousemove',function(evt) {
|
|
4420
4442
|
evt = evt || window.event;
|
|
4443
|
+
evt.eventName = 'mousemove';
|
|
4421
4444
|
let target = evt.target || evt.srcElement;
|
|
4422
4445
|
if(target == canvas) {
|
|
4423
4446
|
container.raiseEvent('mousemove',evt);
|
|
@@ -4429,19 +4452,23 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4429
4452
|
});
|
|
4430
4453
|
|
|
4431
4454
|
this.eventEvents['mousedown'] = jmUtils.bindEvent(this.target,'mouseover',function(evt) {
|
|
4432
|
-
evt = evt || window.event;
|
|
4455
|
+
evt = evt || window.event;
|
|
4456
|
+
evt.eventName = 'mouseover';
|
|
4433
4457
|
container.raiseEvent('mouseover',evt);
|
|
4434
4458
|
});
|
|
4435
4459
|
this.eventEvents['mouseleave'] = jmUtils.bindEvent(this.target,'mouseleave',function(evt) {
|
|
4436
|
-
evt = evt || window.event;
|
|
4460
|
+
evt = evt || window.event;
|
|
4461
|
+
evt.eventName = 'mouseleave';
|
|
4437
4462
|
container.raiseEvent('mouseleave',evt);
|
|
4438
4463
|
});
|
|
4439
4464
|
this.eventEvents['mouseout'] = jmUtils.bindEvent(this.target,'mouseout',function(evt) {
|
|
4440
|
-
evt = evt || window.event;
|
|
4465
|
+
evt = evt || window.event;
|
|
4466
|
+
evt.eventName = 'mouseout';
|
|
4441
4467
|
container.raiseEvent('mouseout',evt);
|
|
4442
4468
|
});
|
|
4443
4469
|
doc && (this.eventEvents['mouseup'] = jmUtils.bindEvent(doc,'mouseup',function(evt) {
|
|
4444
|
-
evt = evt || window.event;
|
|
4470
|
+
evt = evt || window.event;
|
|
4471
|
+
evt.eventName = 'mouseup';
|
|
4445
4472
|
//let target = evt.target || evt.srcElement;
|
|
4446
4473
|
//if(target == canvas) {
|
|
4447
4474
|
let r = container.raiseEvent('mouseup',evt);
|
|
@@ -4454,33 +4481,40 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4454
4481
|
|
|
4455
4482
|
this.eventEvents['dblclick'] = jmUtils.bindEvent(this.target,'dblclick',function(evt) {
|
|
4456
4483
|
evt = evt || window.event;
|
|
4484
|
+
evt.eventName = 'dblclick';
|
|
4457
4485
|
container.raiseEvent('dblclick',evt);
|
|
4458
4486
|
});
|
|
4459
4487
|
this.eventEvents['click'] = jmUtils.bindEvent(this.target,'click',function(evt) {
|
|
4460
4488
|
evt = evt || window.event;
|
|
4489
|
+
evt.eventName = 'click';
|
|
4461
4490
|
container.raiseEvent('click',evt);
|
|
4462
4491
|
});
|
|
4463
4492
|
|
|
4464
4493
|
doc && (this.eventEvents['resize'] = jmUtils.bindEvent(doc,'resize',function(evt) {
|
|
4465
4494
|
evt = evt || window.event;
|
|
4495
|
+
evt.eventName = 'resize';
|
|
4466
4496
|
return container.raiseEvent('resize',evt);
|
|
4467
4497
|
}));
|
|
4468
4498
|
|
|
4469
4499
|
// passive: false 为了让浏览器不告警并且preventDefault有效
|
|
4470
4500
|
// 另一种处理:touch-action: none; 这样任何触摸事件都不会产生默认行为,但是 touch 事件照样触发。
|
|
4471
4501
|
this.eventEvents['touchstart'] = jmUtils.bindEvent(this.target,'touchstart', function(evt) {
|
|
4502
|
+
evt.eventName = 'touchstart';
|
|
4472
4503
|
return instance.touchStart(evt);
|
|
4473
4504
|
},{ passive: false });
|
|
4474
4505
|
|
|
4475
4506
|
this.eventEvents['touchmove'] = jmUtils.bindEvent(this.target,'touchmove', function(evt) {
|
|
4507
|
+
evt.eventName = 'touchmove';
|
|
4476
4508
|
return instance.touchMove(evt);
|
|
4477
4509
|
},{ passive: false });
|
|
4478
4510
|
|
|
4479
4511
|
doc && (this.eventEvents['touchend'] = jmUtils.bindEvent(doc,'touchend', function(evt) {
|
|
4512
|
+
evt.eventName = 'touchend';
|
|
4480
4513
|
return instance.touchEnd(evt);
|
|
4481
4514
|
},{ passive: false }));
|
|
4482
4515
|
|
|
4483
4516
|
doc && (this.eventEvents['touchcancel'] = jmUtils.bindEvent(doc,'touchcancel', function(evt) {
|
|
4517
|
+
evt.eventName = 'touchcancel';
|
|
4484
4518
|
return instance.touchCancel(evt);
|
|
4485
4519
|
},{ passive: false }));
|
|
4486
4520
|
}
|
|
@@ -4535,7 +4569,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4535
4569
|
return true;
|
|
4536
4570
|
};
|
|
4537
4571
|
|
|
4538
|
-
doc && (this.eventEvents['
|
|
4572
|
+
doc && (this.eventEvents['keypress'] = jmUtils.bindEvent(doc,'keypress',function(evt) {
|
|
4539
4573
|
evt = evt || window.event;
|
|
4540
4574
|
if(!checkKeyEvent(evt)) return;//如果事件为其它输入框,则不响应
|
|
4541
4575
|
let r = container.raiseEvent('keypress',evt);
|
|
@@ -4543,7 +4577,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4543
4577
|
evt.preventDefault();
|
|
4544
4578
|
return r;
|
|
4545
4579
|
}));
|
|
4546
|
-
doc && (this.eventEvents['
|
|
4580
|
+
doc && (this.eventEvents['keydown'] = jmUtils.bindEvent(doc,'keydown',function(evt) {
|
|
4547
4581
|
evt = evt || window.event;
|
|
4548
4582
|
if(!checkKeyEvent(evt)) return;//如果事件为其它输入框,则不响应
|
|
4549
4583
|
let r = container.raiseEvent('keydown',evt);
|
|
@@ -4551,7 +4585,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4551
4585
|
evt.preventDefault();
|
|
4552
4586
|
return r;
|
|
4553
4587
|
}));
|
|
4554
|
-
doc && (this.eventEvents['
|
|
4588
|
+
doc && (this.eventEvents['keyup'] = jmUtils.bindEvent(doc,'keyup',function(evt) {
|
|
4555
4589
|
evt = evt || window.event;
|
|
4556
4590
|
if(!checkKeyEvent(evt)) return;//如果事件为其它输入框,则不响应
|
|
4557
4591
|
let r = container.raiseEvent('keyup',evt);
|
|
@@ -4591,7 +4625,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4591
4625
|
}
|
|
4592
4626
|
|
|
4593
4627
|
option = option || {};
|
|
4594
|
-
|
|
4628
|
+
option.mode = option.mode || '2d'; // webgl | 2d
|
|
4595
4629
|
option.interactive = true;
|
|
4596
4630
|
|
|
4597
4631
|
super(option, 'jmGraph');
|
|
@@ -4631,8 +4665,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4631
4665
|
}
|
|
4632
4666
|
else {
|
|
4633
4667
|
this.container = canvas.parentElement;
|
|
4634
|
-
}
|
|
4635
|
-
|
|
4668
|
+
}
|
|
4636
4669
|
this.context = canvas.getContext('2d');
|
|
4637
4670
|
}
|
|
4638
4671
|
this.canvas = canvas;
|
|
@@ -5060,26 +5093,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5060
5093
|
if(this.___isAutoRefreshing) return;
|
|
5061
5094
|
const self = this;
|
|
5062
5095
|
this.___isAutoRefreshing = true;
|
|
5063
|
-
|
|
5064
|
-
if(typeof requestAnimationFrame === 'undefined') {
|
|
5065
|
-
requestAnimationFrameFun = (fun) => {
|
|
5066
|
-
if(this.__requestAnimationFrameFunHandler) clearTimeout(this.__requestAnimationFrameFunHandler);
|
|
5067
|
-
this.__requestAnimationFrameFunHandler = setTimeout(fun, 20);
|
|
5068
|
-
};
|
|
5069
|
-
}
|
|
5070
|
-
else {
|
|
5071
|
-
requestAnimationFrameFun = requestAnimationFrame;
|
|
5072
|
-
}
|
|
5096
|
+
|
|
5073
5097
|
function update() {
|
|
5074
5098
|
if(self.destoryed) {
|
|
5075
5099
|
self.___isAutoRefreshing = false;
|
|
5076
5100
|
return;// 已销毁
|
|
5077
5101
|
}
|
|
5078
5102
|
if(self.needUpdate) self.redraw();
|
|
5079
|
-
|
|
5103
|
+
self.__requestAnimationFrameFunHandler && jmUtils.cancelAnimationFrame(self.__requestAnimationFrameFunHandler);
|
|
5104
|
+
self.__requestAnimationFrameFunHandler = jmUtils.requestAnimationFrame(update);
|
|
5080
5105
|
if(callback) callback();
|
|
5081
5106
|
}
|
|
5082
|
-
|
|
5107
|
+
self.__requestAnimationFrameFunHandler && jmUtils.cancelAnimationFrame(self.__requestAnimationFrameFunHandler);
|
|
5108
|
+
self.__requestAnimationFrameFunHandler = jmUtils.requestAnimationFrame(update);
|
|
5083
5109
|
return this;
|
|
5084
5110
|
}
|
|
5085
5111
|
|
|
@@ -5132,12 +5158,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5132
5158
|
}
|
|
5133
5159
|
}
|
|
5134
5160
|
|
|
5135
|
-
/**
|
|
5136
|
-
* 基础样式
|
|
5137
|
-
*
|
|
5138
|
-
* @class jmChartStyle
|
|
5139
|
-
* @module jmChart
|
|
5140
|
-
* @static
|
|
5161
|
+
/**
|
|
5162
|
+
* 基础样式
|
|
5163
|
+
*
|
|
5164
|
+
* @class jmChartStyle
|
|
5165
|
+
* @module jmChart
|
|
5166
|
+
* @static
|
|
5141
5167
|
*/
|
|
5142
5168
|
var defaultStyle = {
|
|
5143
5169
|
layout: 'normal',
|
|
@@ -5273,13 +5299,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5273
5299
|
// 图形样式集
|
|
5274
5300
|
chartColors: ['#249FDA', '#EA3B7C', '#8EBC00', '#309B46', '#4B507E', '#D8E404', '#EB792A', '#A00DA0'],
|
|
5275
5301
|
|
|
5276
|
-
/*tooltip: {
|
|
5277
|
-
'background-color': 'rgb(255,255,255)',
|
|
5278
|
-
'padding':'4px',
|
|
5279
|
-
'opacity':'0.8',
|
|
5280
|
-
'border':'1px solid #000',
|
|
5281
|
-
'box-shadow': '0 0 3px #000',
|
|
5282
|
-
'border-radius': '6px'
|
|
5302
|
+
/*tooltip: {
|
|
5303
|
+
'background-color': 'rgb(255,255,255)',
|
|
5304
|
+
'padding':'4px',
|
|
5305
|
+
'opacity':'0.8',
|
|
5306
|
+
'border':'1px solid #000',
|
|
5307
|
+
'box-shadow': '0 0 3px #000',
|
|
5308
|
+
'border-radius': '6px'
|
|
5283
5309
|
},*/
|
|
5284
5310
|
line: {
|
|
5285
5311
|
normal: {
|
|
@@ -5386,18 +5412,35 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5386
5412
|
blur: 2,
|
|
5387
5413
|
color: '#ccc'
|
|
5388
5414
|
}
|
|
5415
|
+
},
|
|
5416
|
+
candlestick: {
|
|
5417
|
+
normal: {
|
|
5418
|
+
lineWidth: 1,
|
|
5419
|
+
zIndex: 18,
|
|
5420
|
+
cursor: 'default'
|
|
5421
|
+
},
|
|
5422
|
+
hover: {
|
|
5423
|
+
//zIndex: 100,
|
|
5424
|
+
cursor: 'pointer'
|
|
5425
|
+
},
|
|
5426
|
+
perWidth: 0.5,
|
|
5427
|
+
// 阴线颜色
|
|
5428
|
+
negativeColor: 'green',
|
|
5429
|
+
// 阳线颜色
|
|
5430
|
+
masculineColor: 'red',
|
|
5431
|
+
lineWidth: 1
|
|
5389
5432
|
}
|
|
5390
5433
|
};
|
|
5391
5434
|
|
|
5392
|
-
/**
|
|
5393
|
-
* 轴
|
|
5394
|
-
*
|
|
5395
|
-
* @class jmAxis
|
|
5396
|
-
* @module jmChart
|
|
5397
|
-
* @param {jmChart} chart 当前图表
|
|
5398
|
-
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
5399
|
-
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
5400
|
-
* @param {object} [style] 样式
|
|
5435
|
+
/**
|
|
5436
|
+
* 轴
|
|
5437
|
+
*
|
|
5438
|
+
* @class jmAxis
|
|
5439
|
+
* @module jmChart
|
|
5440
|
+
* @param {jmChart} chart 当前图表
|
|
5441
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
5442
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
5443
|
+
* @param {object} [style] 样式
|
|
5401
5444
|
*/
|
|
5402
5445
|
|
|
5403
5446
|
class jmAxis extends jmArrowLine {
|
|
@@ -5444,21 +5487,21 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5444
5487
|
|
|
5445
5488
|
if (typeof options.minXValue !== 'undefined') this.minValue = options.minXValue; // 最小值,如果指定了,则轴的最小值为它或更小的值
|
|
5446
5489
|
} else {
|
|
5447
|
-
if (typeof options.maxYValue !== 'undefined') this.maxValue = options.maxYValue; // 最大的值,如果指定了,则如果有数值比它大才会修改上限,否则以它为上限
|
|
5490
|
+
if (typeof options.maxYValue !== 'undefined' && (options.maxYValue > this.maxValue || typeof this.maxValue === 'undefined')) this.maxValue = options.maxYValue; // 最大的值,如果指定了,则如果有数值比它大才会修改上限,否则以它为上限
|
|
5448
5491
|
|
|
5449
|
-
if (typeof options.minYValue !== 'undefined') this.minValue = options.minYValue; // 最小值,如果指定了,则轴的最小值为它或更小的值
|
|
5492
|
+
if (typeof options.minYValue !== 'undefined' && (options.minYValue < this.minValue || typeof this.minValue === 'undefined')) this.minValue = options.minYValue; // 最小值,如果指定了,则轴的最小值为它或更小的值
|
|
5450
5493
|
}
|
|
5451
5494
|
}
|
|
5452
|
-
/**
|
|
5453
|
-
* 轴类型(x/y/radar),默认为x
|
|
5454
|
-
*
|
|
5455
|
-
* @property type
|
|
5456
|
-
* @type string
|
|
5495
|
+
/**
|
|
5496
|
+
* 轴类型(x/y/radar),默认为x
|
|
5497
|
+
*
|
|
5498
|
+
* @property type
|
|
5499
|
+
* @type string
|
|
5457
5500
|
*/
|
|
5458
5501
|
|
|
5459
5502
|
|
|
5460
|
-
/**
|
|
5461
|
-
* 关联访问的是chart的数据源
|
|
5503
|
+
/**
|
|
5504
|
+
* 关联访问的是chart的数据源
|
|
5462
5505
|
*/
|
|
5463
5506
|
get data() {
|
|
5464
5507
|
return this.graph.data;
|
|
@@ -5467,10 +5510,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5467
5510
|
set data(d) {
|
|
5468
5511
|
this.graph.data = d;
|
|
5469
5512
|
}
|
|
5470
|
-
/**
|
|
5471
|
-
* 计算当前轴的位置
|
|
5472
|
-
*
|
|
5473
|
-
* @method reset
|
|
5513
|
+
/**
|
|
5514
|
+
* 计算当前轴的位置
|
|
5515
|
+
*
|
|
5516
|
+
* @method reset
|
|
5474
5517
|
*/
|
|
5475
5518
|
|
|
5476
5519
|
|
|
@@ -5528,10 +5571,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5528
5571
|
|
|
5529
5572
|
super.draw();
|
|
5530
5573
|
}
|
|
5531
|
-
/**
|
|
5532
|
-
* 生成轴标签
|
|
5533
|
-
*
|
|
5534
|
-
* @method createLabel
|
|
5574
|
+
/**
|
|
5575
|
+
* 生成轴标签
|
|
5576
|
+
*
|
|
5577
|
+
* @method createLabel
|
|
5535
5578
|
*/
|
|
5536
5579
|
|
|
5537
5580
|
|
|
@@ -5548,11 +5591,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5548
5591
|
this.createYLabel();
|
|
5549
5592
|
}
|
|
5550
5593
|
}
|
|
5551
|
-
/**
|
|
5552
|
-
* 生成X轴标签
|
|
5553
|
-
*
|
|
5554
|
-
* @method createXLabel
|
|
5555
|
-
* @private
|
|
5594
|
+
/**
|
|
5595
|
+
* 生成X轴标签
|
|
5596
|
+
*
|
|
5597
|
+
* @method createXLabel
|
|
5598
|
+
* @private
|
|
5556
5599
|
*/
|
|
5557
5600
|
|
|
5558
5601
|
|
|
@@ -5643,11 +5686,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5643
5686
|
}
|
|
5644
5687
|
}
|
|
5645
5688
|
}
|
|
5646
|
-
/**
|
|
5647
|
-
* 生成Y轴标签
|
|
5648
|
-
*
|
|
5649
|
-
* @method createYLabel
|
|
5650
|
-
* @private
|
|
5689
|
+
/**
|
|
5690
|
+
* 生成Y轴标签
|
|
5691
|
+
*
|
|
5692
|
+
* @method createYLabel
|
|
5693
|
+
* @private
|
|
5651
5694
|
*/
|
|
5652
5695
|
|
|
5653
5696
|
|
|
@@ -5660,8 +5703,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5660
5703
|
|
|
5661
5704
|
let count = this.labelCount;
|
|
5662
5705
|
const mm = max - min;
|
|
5663
|
-
/*if(mm <= 10) {
|
|
5664
|
-
count = mm;
|
|
5706
|
+
/*if(mm <= 10) {
|
|
5707
|
+
count = mm;
|
|
5665
5708
|
}*/
|
|
5666
5709
|
// mm 放大10000倍,这里结果也需要除于10000
|
|
5667
5710
|
|
|
@@ -5773,10 +5816,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5773
5816
|
}
|
|
5774
5817
|
}
|
|
5775
5818
|
}
|
|
5776
|
-
/**
|
|
5777
|
-
* 获取当前轴所占宽
|
|
5778
|
-
*
|
|
5779
|
-
* @method width
|
|
5819
|
+
/**
|
|
5820
|
+
* 获取当前轴所占宽
|
|
5821
|
+
*
|
|
5822
|
+
* @method width
|
|
5780
5823
|
*/
|
|
5781
5824
|
|
|
5782
5825
|
|
|
@@ -5791,10 +5834,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5791
5834
|
set width(w) {
|
|
5792
5835
|
this._width = w;
|
|
5793
5836
|
}
|
|
5794
|
-
/**
|
|
5795
|
-
* 获取当前轴所占高
|
|
5796
|
-
*
|
|
5797
|
-
* @method height
|
|
5837
|
+
/**
|
|
5838
|
+
* 获取当前轴所占高
|
|
5839
|
+
*
|
|
5840
|
+
* @method height
|
|
5798
5841
|
*/
|
|
5799
5842
|
|
|
5800
5843
|
|
|
@@ -5804,12 +5847,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5804
5847
|
|
|
5805
5848
|
|
|
5806
5849
|
set height(h) {}
|
|
5807
|
-
/**
|
|
5808
|
-
* 获取或设置当前轴最大值
|
|
5809
|
-
*
|
|
5810
|
-
* @method max
|
|
5811
|
-
* @param {number/date/string} 当前轴的最大值
|
|
5812
|
-
* @return 当前轴的最大值
|
|
5850
|
+
/**
|
|
5851
|
+
* 获取或设置当前轴最大值
|
|
5852
|
+
*
|
|
5853
|
+
* @method max
|
|
5854
|
+
* @param {number/date/string} 当前轴的最大值
|
|
5855
|
+
* @return 当前轴的最大值
|
|
5813
5856
|
*/
|
|
5814
5857
|
|
|
5815
5858
|
|
|
@@ -5858,12 +5901,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5858
5901
|
|
|
5859
5902
|
return this._max;
|
|
5860
5903
|
}
|
|
5861
|
-
/**
|
|
5862
|
-
* 获取或设置当前轴最小值
|
|
5863
|
-
*
|
|
5864
|
-
* @method max
|
|
5865
|
-
* @param {number/date/string} 当前轴的最小值
|
|
5866
|
-
* @return 当前轴的最小值
|
|
5904
|
+
/**
|
|
5905
|
+
* 获取或设置当前轴最小值
|
|
5906
|
+
*
|
|
5907
|
+
* @method max
|
|
5908
|
+
* @param {number/date/string} 当前轴的最小值
|
|
5909
|
+
* @return 当前轴的最小值
|
|
5867
5910
|
*/
|
|
5868
5911
|
|
|
5869
5912
|
|
|
@@ -5910,10 +5953,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5910
5953
|
|
|
5911
5954
|
return this.dataType == 'string' ? 0 : this._min;
|
|
5912
5955
|
}
|
|
5913
|
-
/**
|
|
5914
|
-
* 清除一些属性
|
|
5915
|
-
*
|
|
5916
|
-
* @method clear
|
|
5956
|
+
/**
|
|
5957
|
+
* 清除一些属性
|
|
5958
|
+
*
|
|
5959
|
+
* @method clear
|
|
5917
5960
|
*/
|
|
5918
5961
|
|
|
5919
5962
|
|
|
@@ -5921,11 +5964,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5921
5964
|
this._min = null;
|
|
5922
5965
|
this._max = null;
|
|
5923
5966
|
}
|
|
5924
|
-
/**
|
|
5925
|
-
* 计算当前轴的单位偏移量
|
|
5926
|
-
*
|
|
5927
|
-
* @method step
|
|
5928
|
-
* @return {number} 单位偏移量
|
|
5967
|
+
/**
|
|
5968
|
+
* 计算当前轴的单位偏移量
|
|
5969
|
+
*
|
|
5970
|
+
* @method step
|
|
5971
|
+
* @return {number} 单位偏移量
|
|
5929
5972
|
*/
|
|
5930
5973
|
|
|
5931
5974
|
|
|
@@ -5974,12 +6017,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5974
6017
|
|
|
5975
6018
|
}
|
|
5976
6019
|
|
|
5977
|
-
/**
|
|
5978
|
-
* 图例的容器
|
|
5979
|
-
*
|
|
5980
|
-
* @class jmLegend
|
|
5981
|
-
* @module jmChart
|
|
5982
|
-
* @param {jmChart} chart 当前图表
|
|
6020
|
+
/**
|
|
6021
|
+
* 图例的容器
|
|
6022
|
+
*
|
|
6023
|
+
* @class jmLegend
|
|
6024
|
+
* @module jmChart
|
|
6025
|
+
* @param {jmChart} chart 当前图表
|
|
5983
6026
|
*/
|
|
5984
6027
|
|
|
5985
6028
|
class jmLegend extends jmRect {
|
|
@@ -5991,20 +6034,20 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5991
6034
|
};
|
|
5992
6035
|
super(options);
|
|
5993
6036
|
|
|
5994
|
-
_defineProperty(this, "legendPosition", '
|
|
6037
|
+
_defineProperty(this, "legendPosition", '');
|
|
5995
6038
|
}
|
|
5996
|
-
/**
|
|
5997
|
-
* 图例放置位置
|
|
6039
|
+
/**
|
|
6040
|
+
* 图例放置位置
|
|
5998
6041
|
*/
|
|
5999
6042
|
|
|
6000
6043
|
|
|
6001
6044
|
}
|
|
6002
|
-
/**
|
|
6003
|
-
* 添加图例
|
|
6004
|
-
*
|
|
6005
|
-
* @method append
|
|
6006
|
-
* @param {jmSeries} series 当前图序列
|
|
6007
|
-
* @param {jmControl} shape 当前图例的图形对象
|
|
6045
|
+
/**
|
|
6046
|
+
* 添加图例
|
|
6047
|
+
*
|
|
6048
|
+
* @method append
|
|
6049
|
+
* @param {jmSeries} series 当前图序列
|
|
6050
|
+
* @param {jmControl} shape 当前图例的图形对象
|
|
6008
6051
|
*/
|
|
6009
6052
|
|
|
6010
6053
|
jmLegend.prototype.append = function (series, shape, options = {}) {
|
|
@@ -6044,24 +6087,27 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6044
6087
|
panel.height = shape.height; //执行进入事件
|
|
6045
6088
|
//触动图例后加粗显示图
|
|
6046
6089
|
|
|
6047
|
-
/*const hover = options.hover || function() {
|
|
6048
|
-
//应用图的动态样式
|
|
6049
|
-
//Object.assign(series.style, series.style.hover);
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
//
|
|
6060
|
-
|
|
6061
|
-
|
|
6090
|
+
/*const hover = options.hover || function() {
|
|
6091
|
+
//应用图的动态样式
|
|
6092
|
+
//Object.assign(series.style, series.style.hover);
|
|
6093
|
+
|
|
6094
|
+
//Object.assign(this.style, this.style.hover || {});
|
|
6095
|
+
|
|
6096
|
+
//series.graph.refresh();
|
|
6097
|
+
};
|
|
6098
|
+
panel.bind('mouseover', hover);
|
|
6099
|
+
//执行离开
|
|
6100
|
+
const leave = options.leave || function() {
|
|
6101
|
+
//应用图的普通样式
|
|
6102
|
+
//Object.assign(series.style, series.style.normal);
|
|
6103
|
+
|
|
6104
|
+
//Object.assign(this.style, this.style.normal || {});
|
|
6105
|
+
//jmUtils.apply(this.series.style.normal,this.series.style);
|
|
6106
|
+
//series.graph.refresh();
|
|
6107
|
+
};
|
|
6062
6108
|
panel.bind('mouseleave', leave);*/
|
|
6063
6109
|
|
|
6064
|
-
const legendPosition = this.legendPosition || this.style.legendPosition;
|
|
6110
|
+
const legendPosition = this.legendPosition || this.style.legendPosition || 'right';
|
|
6065
6111
|
|
|
6066
6112
|
if (legendPosition == 'top' || legendPosition == 'bottom') {
|
|
6067
6113
|
//顶部和底部图例横排,每次右移位一个单位图例
|
|
@@ -6078,10 +6124,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6078
6124
|
|
|
6079
6125
|
this.needUpdate = true;
|
|
6080
6126
|
};
|
|
6081
|
-
/**
|
|
6082
|
-
* 初始化图例
|
|
6083
|
-
*
|
|
6084
|
-
* @method init
|
|
6127
|
+
/**
|
|
6128
|
+
* 初始化图例
|
|
6129
|
+
*
|
|
6130
|
+
* @method init
|
|
6085
6131
|
*/
|
|
6086
6132
|
|
|
6087
6133
|
|
|
@@ -6093,10 +6139,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6093
6139
|
this.style.lineWidth = 0;
|
|
6094
6140
|
this.children.clear();
|
|
6095
6141
|
};
|
|
6096
|
-
/**
|
|
6097
|
-
* 重置图例属性,根据图例内容计算期大小并更新画图区域大小
|
|
6098
|
-
*
|
|
6099
|
-
* @method reset
|
|
6142
|
+
/**
|
|
6143
|
+
* 重置图例属性,根据图例内容计算期大小并更新画图区域大小
|
|
6144
|
+
*
|
|
6145
|
+
* @method reset
|
|
6100
6146
|
*/
|
|
6101
6147
|
|
|
6102
6148
|
|
|
@@ -6141,11 +6187,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6141
6187
|
};
|
|
6142
6188
|
|
|
6143
6189
|
var utils = {
|
|
6144
|
-
/**
|
|
6145
|
-
* 对比二个数组数据是否改变
|
|
6146
|
-
* @param {Array} source 被对比的数、组
|
|
6147
|
-
* @param {Array} target 对比数组
|
|
6148
|
-
* @param {Function} compare 比较函数
|
|
6190
|
+
/**
|
|
6191
|
+
* 对比二个数组数据是否改变
|
|
6192
|
+
* @param {Array} source 被对比的数、组
|
|
6193
|
+
* @param {Array} target 对比数组
|
|
6194
|
+
* @param {Function} compare 比较函数
|
|
6149
6195
|
*/
|
|
6150
6196
|
arrayIsChange(source, target, compare) {
|
|
6151
6197
|
if (!source || !target) return true;
|
|
@@ -6162,14 +6208,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6162
6208
|
|
|
6163
6209
|
};
|
|
6164
6210
|
|
|
6165
|
-
/**
|
|
6166
|
-
* 图形基类
|
|
6167
|
-
*
|
|
6168
|
-
* @class jmSeries
|
|
6169
|
-
* @module jmChart
|
|
6170
|
-
* @param {jmChart} chart 当前图表
|
|
6171
|
-
* @param {array} mappings 图形字段映射
|
|
6172
|
-
* @param {style} style 样式
|
|
6211
|
+
/**
|
|
6212
|
+
* 图形基类
|
|
6213
|
+
*
|
|
6214
|
+
* @class jmSeries
|
|
6215
|
+
* @module jmChart
|
|
6216
|
+
* @param {jmChart} chart 当前图表
|
|
6217
|
+
* @param {array} mappings 图形字段映射
|
|
6218
|
+
* @param {style} style 样式
|
|
6173
6219
|
*/
|
|
6174
6220
|
//构造线图
|
|
6175
6221
|
|
|
@@ -6213,8 +6259,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6213
6259
|
maxYValue: options.maxYValue
|
|
6214
6260
|
});
|
|
6215
6261
|
}
|
|
6216
|
-
/**
|
|
6217
|
-
* 关联访问的是chart的数据源
|
|
6262
|
+
/**
|
|
6263
|
+
* 关联访问的是chart的数据源
|
|
6218
6264
|
*/
|
|
6219
6265
|
|
|
6220
6266
|
|
|
@@ -6236,11 +6282,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6236
6282
|
set enableAnimate(v) {
|
|
6237
6283
|
this.option.enableAnimate = v;
|
|
6238
6284
|
}
|
|
6239
|
-
/**
|
|
6240
|
-
* 图例名称
|
|
6241
|
-
*
|
|
6242
|
-
* @property legendLabel
|
|
6243
|
-
* @type string
|
|
6285
|
+
/**
|
|
6286
|
+
* 图例名称
|
|
6287
|
+
*
|
|
6288
|
+
* @property legendLabel
|
|
6289
|
+
* @type string
|
|
6244
6290
|
*/
|
|
6245
6291
|
|
|
6246
6292
|
|
|
@@ -6270,10 +6316,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6270
6316
|
points: this.dataPoints
|
|
6271
6317
|
};
|
|
6272
6318
|
}
|
|
6273
|
-
/**
|
|
6274
|
-
* 根据X轴坐标,获取它最近的数据描点
|
|
6275
|
-
* 离点最近的一个描点
|
|
6276
|
-
* @param {number} x X轴坐标
|
|
6319
|
+
/**
|
|
6320
|
+
* 根据X轴坐标,获取它最近的数据描点
|
|
6321
|
+
* 离点最近的一个描点
|
|
6322
|
+
* @param {number} x X轴坐标
|
|
6277
6323
|
*/
|
|
6278
6324
|
|
|
6279
6325
|
|
|
@@ -6301,9 +6347,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6301
6347
|
|
|
6302
6348
|
return null;
|
|
6303
6349
|
}
|
|
6304
|
-
/**
|
|
6305
|
-
* 根据X轴值获取数据点
|
|
6306
|
-
* @param {number} xValue X轴值
|
|
6350
|
+
/**
|
|
6351
|
+
* 根据X轴值获取数据点
|
|
6352
|
+
* @param {number} xValue X轴值
|
|
6307
6353
|
*/
|
|
6308
6354
|
|
|
6309
6355
|
|
|
@@ -6317,11 +6363,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6317
6363
|
|
|
6318
6364
|
return null;
|
|
6319
6365
|
}
|
|
6320
|
-
/**
|
|
6321
|
-
* 重置属性
|
|
6322
|
-
* 根据数据源计算轴的属性
|
|
6323
|
-
*
|
|
6324
|
-
* @method reset
|
|
6366
|
+
/**
|
|
6367
|
+
* 重置属性
|
|
6368
|
+
* 根据数据源计算轴的属性
|
|
6369
|
+
*
|
|
6370
|
+
* @method reset
|
|
6325
6371
|
*/
|
|
6326
6372
|
|
|
6327
6373
|
|
|
@@ -6365,10 +6411,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6365
6411
|
this.xAxis.min(xv);
|
|
6366
6412
|
}
|
|
6367
6413
|
}
|
|
6368
|
-
/**
|
|
6369
|
-
* 生成序列图描点
|
|
6370
|
-
*
|
|
6371
|
-
* @method createPoints
|
|
6414
|
+
/**
|
|
6415
|
+
* 生成序列图描点
|
|
6416
|
+
*
|
|
6417
|
+
* @method createPoints
|
|
6372
6418
|
*/
|
|
6373
6419
|
|
|
6374
6420
|
|
|
@@ -6410,7 +6456,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6410
6456
|
x: p.x,
|
|
6411
6457
|
// 高度
|
|
6412
6458
|
height: p.height,
|
|
6413
|
-
yValue: yv
|
|
6459
|
+
yValue: yv,
|
|
6460
|
+
field: f
|
|
6414
6461
|
}; //如果Y值不存在。则此点无效,不画图
|
|
6415
6462
|
|
|
6416
6463
|
if (yv == null || typeof yv == 'undefined') {
|
|
@@ -6445,10 +6492,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6445
6492
|
return this.style.color;
|
|
6446
6493
|
}
|
|
6447
6494
|
}
|
|
6448
|
-
/**
|
|
6449
|
-
* 生成图例
|
|
6450
|
-
*
|
|
6451
|
-
* @method createLegend
|
|
6495
|
+
/**
|
|
6496
|
+
* 生成图例
|
|
6497
|
+
*
|
|
6498
|
+
* @method createLegend
|
|
6452
6499
|
*/
|
|
6453
6500
|
|
|
6454
6501
|
|
|
@@ -6500,9 +6547,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6500
6547
|
});
|
|
6501
6548
|
this.addShape(label);
|
|
6502
6549
|
}
|
|
6503
|
-
/**
|
|
6504
|
-
* 在图上加下定制图形
|
|
6505
|
-
* @param {jmShape} shape 图形
|
|
6550
|
+
/**
|
|
6551
|
+
* 在图上加下定制图形
|
|
6552
|
+
* @param {jmShape} shape 图形
|
|
6506
6553
|
*/
|
|
6507
6554
|
|
|
6508
6555
|
|
|
@@ -6511,13 +6558,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6511
6558
|
this.shapes.add(shape);
|
|
6512
6559
|
return shape;
|
|
6513
6560
|
}
|
|
6514
|
-
/**
|
|
6515
|
-
* 获取指定事件的集合
|
|
6516
|
-
* 比如mousedown,mouseup等
|
|
6517
|
-
*
|
|
6518
|
-
* @method getEvent
|
|
6519
|
-
* @param {string} name 事件名称
|
|
6520
|
-
* @return {list} 事件委托的集合
|
|
6561
|
+
/**
|
|
6562
|
+
* 获取指定事件的集合
|
|
6563
|
+
* 比如mousedown,mouseup等
|
|
6564
|
+
*
|
|
6565
|
+
* @method getEvent
|
|
6566
|
+
* @param {string} name 事件名称
|
|
6567
|
+
* @return {list} 事件委托的集合
|
|
6521
6568
|
*/
|
|
6522
6569
|
|
|
6523
6570
|
|
|
@@ -6541,14 +6588,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6541
6588
|
|
|
6542
6589
|
}
|
|
6543
6590
|
|
|
6544
|
-
/**
|
|
6545
|
-
* 柱图
|
|
6546
|
-
*
|
|
6547
|
-
* @class jmBarSeries
|
|
6548
|
-
* @module jmChart
|
|
6549
|
-
* @param {jmChart} chart 当前图表
|
|
6550
|
-
* @param {array} mappings 图形字段映射
|
|
6551
|
-
* @param {style} style 样式
|
|
6591
|
+
/**
|
|
6592
|
+
* 柱图
|
|
6593
|
+
*
|
|
6594
|
+
* @class jmBarSeries
|
|
6595
|
+
* @module jmChart
|
|
6596
|
+
* @param {jmChart} chart 当前图表
|
|
6597
|
+
* @param {array} mappings 图形字段映射
|
|
6598
|
+
* @param {style} style 样式
|
|
6552
6599
|
*/
|
|
6553
6600
|
//构造函数
|
|
6554
6601
|
|
|
@@ -6556,11 +6603,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6556
6603
|
constructor(options) {
|
|
6557
6604
|
super(options);
|
|
6558
6605
|
}
|
|
6559
|
-
/**
|
|
6560
|
-
* 绘制当前图形
|
|
6561
|
-
*
|
|
6562
|
-
* @method beginDraw
|
|
6563
|
-
* @for jmBarSeries
|
|
6606
|
+
/**
|
|
6607
|
+
* 绘制当前图形
|
|
6608
|
+
*
|
|
6609
|
+
* @method beginDraw
|
|
6610
|
+
* @for jmBarSeries
|
|
6564
6611
|
*/
|
|
6565
6612
|
|
|
6566
6613
|
|
|
@@ -6667,9 +6714,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6667
6714
|
this.barTotalWidth = maxWidth * this.graph.barSeriesCount;
|
|
6668
6715
|
}
|
|
6669
6716
|
}
|
|
6670
|
-
/**
|
|
6671
|
-
* 在图上加下定制图形
|
|
6672
|
-
* @param {jmShape} shape 图形
|
|
6717
|
+
/**
|
|
6718
|
+
* 在图上加下定制图形
|
|
6719
|
+
* @param {jmShape} shape 图形
|
|
6673
6720
|
*/
|
|
6674
6721
|
|
|
6675
6722
|
|
|
@@ -6681,14 +6728,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6681
6728
|
|
|
6682
6729
|
}
|
|
6683
6730
|
|
|
6684
|
-
/**
|
|
6685
|
-
* 柱图
|
|
6686
|
-
*
|
|
6687
|
-
* @class jmBarSeries
|
|
6688
|
-
* @module jmChart
|
|
6689
|
-
* @param {jmChart} chart 当前图表
|
|
6690
|
-
* @param {array} mappings 图形字段映射
|
|
6691
|
-
* @param {style} style 样式
|
|
6731
|
+
/**
|
|
6732
|
+
* 柱图
|
|
6733
|
+
*
|
|
6734
|
+
* @class jmBarSeries
|
|
6735
|
+
* @module jmChart
|
|
6736
|
+
* @param {jmChart} chart 当前图表
|
|
6737
|
+
* @param {array} mappings 图形字段映射
|
|
6738
|
+
* @param {style} style 样式
|
|
6692
6739
|
*/
|
|
6693
6740
|
//构造函数
|
|
6694
6741
|
|
|
@@ -6696,11 +6743,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6696
6743
|
constructor(options) {
|
|
6697
6744
|
super(options);
|
|
6698
6745
|
}
|
|
6699
|
-
/**
|
|
6700
|
-
* 绘制当前图形
|
|
6701
|
-
*
|
|
6702
|
-
* @method beginDraw
|
|
6703
|
-
* @for jmBarSeries
|
|
6746
|
+
/**
|
|
6747
|
+
* 绘制当前图形
|
|
6748
|
+
*
|
|
6749
|
+
* @method beginDraw
|
|
6750
|
+
* @for jmBarSeries
|
|
6704
6751
|
*/
|
|
6705
6752
|
|
|
6706
6753
|
|
|
@@ -6830,14 +6877,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6830
6877
|
|
|
6831
6878
|
}
|
|
6832
6879
|
|
|
6833
|
-
/**
|
|
6834
|
-
* 饼图
|
|
6835
|
-
*
|
|
6836
|
-
* @class jmPieSeries
|
|
6837
|
-
* @module jmChart
|
|
6838
|
-
* @param {jmChart} chart 当前图表
|
|
6839
|
-
* @param {array} mappings 图形字段映射
|
|
6840
|
-
* @param {style} style 样式
|
|
6880
|
+
/**
|
|
6881
|
+
* 饼图
|
|
6882
|
+
*
|
|
6883
|
+
* @class jmPieSeries
|
|
6884
|
+
* @module jmChart
|
|
6885
|
+
* @param {jmChart} chart 当前图表
|
|
6886
|
+
* @param {array} mappings 图形字段映射
|
|
6887
|
+
* @param {style} style 样式
|
|
6841
6888
|
*/
|
|
6842
6889
|
//构造函数
|
|
6843
6890
|
|
|
@@ -6921,10 +6968,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6921
6968
|
set startAngle(v) {
|
|
6922
6969
|
this.option.startAngle = v;
|
|
6923
6970
|
}
|
|
6924
|
-
/**
|
|
6925
|
-
* 生成序列图描点
|
|
6926
|
-
*
|
|
6927
|
-
* @method createPoints
|
|
6971
|
+
/**
|
|
6972
|
+
* 生成序列图描点
|
|
6973
|
+
*
|
|
6974
|
+
* @method createPoints
|
|
6928
6975
|
*/
|
|
6929
6976
|
|
|
6930
6977
|
|
|
@@ -7014,8 +7061,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7014
7061
|
maxRadius: p.maxRadius,
|
|
7015
7062
|
minRadius: p.minRadius
|
|
7016
7063
|
});
|
|
7017
|
-
/**
|
|
7018
|
-
* 因为jmgraph是按图形形状来计算所占区域和大小的, 这里我们把扇形占区域改为整个图圆。这样计算大小和渐变时才好闭合。
|
|
7064
|
+
/**
|
|
7065
|
+
* 因为jmgraph是按图形形状来计算所占区域和大小的, 这里我们把扇形占区域改为整个图圆。这样计算大小和渐变时才好闭合。
|
|
7019
7066
|
*/
|
|
7020
7067
|
|
|
7021
7068
|
p.shape.getLocation = function () {
|
|
@@ -7124,10 +7171,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7124
7171
|
}
|
|
7125
7172
|
|
|
7126
7173
|
}
|
|
7127
|
-
/**
|
|
7128
|
-
* 生成图例
|
|
7129
|
-
*
|
|
7130
|
-
* @method createLegend
|
|
7174
|
+
/**
|
|
7175
|
+
* 生成图例
|
|
7176
|
+
*
|
|
7177
|
+
* @method createLegend
|
|
7131
7178
|
*/
|
|
7132
7179
|
|
|
7133
7180
|
jmPieSeries.prototype.createLegend = function () {
|
|
@@ -7169,14 +7216,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7169
7216
|
}
|
|
7170
7217
|
};
|
|
7171
7218
|
|
|
7172
|
-
/**
|
|
7173
|
-
* 图形基类
|
|
7174
|
-
*
|
|
7175
|
-
* @class jmLineSeries
|
|
7176
|
-
* @module jmChart
|
|
7177
|
-
* @param {jmChart} chart 当前图表
|
|
7178
|
-
* @param {array} mappings 图形字段映射
|
|
7179
|
-
* @param {style} style 样式
|
|
7219
|
+
/**
|
|
7220
|
+
* 图形基类
|
|
7221
|
+
*
|
|
7222
|
+
* @class jmLineSeries
|
|
7223
|
+
* @module jmChart
|
|
7224
|
+
* @param {jmChart} chart 当前图表
|
|
7225
|
+
* @param {array} mappings 图形字段映射
|
|
7226
|
+
* @param {style} style 样式
|
|
7180
7227
|
*/
|
|
7181
7228
|
//构造函数
|
|
7182
7229
|
|
|
@@ -7185,11 +7232,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7185
7232
|
options.style = options.style || options.graph.style.line;
|
|
7186
7233
|
super(options); //this.on('beginDraw', this[PreDrawKey]);
|
|
7187
7234
|
}
|
|
7188
|
-
/**
|
|
7189
|
-
* 绘制图形前 初始化线条
|
|
7190
|
-
*
|
|
7191
|
-
* @method preDraw
|
|
7192
|
-
* @for jmLineSeries
|
|
7235
|
+
/**
|
|
7236
|
+
* 绘制图形前 初始化线条
|
|
7237
|
+
*
|
|
7238
|
+
* @method preDraw
|
|
7239
|
+
* @for jmLineSeries
|
|
7193
7240
|
*/
|
|
7194
7241
|
|
|
7195
7242
|
|
|
@@ -7324,10 +7371,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7324
7371
|
|
|
7325
7372
|
return shapePoints;
|
|
7326
7373
|
}
|
|
7327
|
-
/**
|
|
7328
|
-
* 生成图例
|
|
7329
|
-
*
|
|
7330
|
-
* @method createLegend
|
|
7374
|
+
/**
|
|
7375
|
+
* 生成图例
|
|
7376
|
+
*
|
|
7377
|
+
* @method createLegend
|
|
7331
7378
|
*/
|
|
7332
7379
|
|
|
7333
7380
|
|
|
@@ -7416,14 +7463,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7416
7463
|
|
|
7417
7464
|
}
|
|
7418
7465
|
|
|
7419
|
-
/**
|
|
7420
|
-
* 二条线组成的区域图表
|
|
7421
|
-
*
|
|
7422
|
-
* @class jmStackLineSeries
|
|
7423
|
-
* @module jmChart
|
|
7424
|
-
* @param {jmChart} chart 当前图表
|
|
7425
|
-
* @param {array} mappings 图形字段映射
|
|
7426
|
-
* @param {style} style 样式
|
|
7466
|
+
/**
|
|
7467
|
+
* 二条线组成的区域图表
|
|
7468
|
+
*
|
|
7469
|
+
* @class jmStackLineSeries
|
|
7470
|
+
* @module jmChart
|
|
7471
|
+
* @param {jmChart} chart 当前图表
|
|
7472
|
+
* @param {array} mappings 图形字段映射
|
|
7473
|
+
* @param {style} style 样式
|
|
7427
7474
|
*/
|
|
7428
7475
|
//构造函数
|
|
7429
7476
|
|
|
@@ -7432,11 +7479,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7432
7479
|
options.style = options.style || options.graph.style.stackLine;
|
|
7433
7480
|
super(options);
|
|
7434
7481
|
}
|
|
7435
|
-
/**
|
|
7436
|
-
* 绘制图形前 初始化线条
|
|
7437
|
-
*
|
|
7438
|
-
* @method preDraw
|
|
7439
|
-
* @for jmLineSeries
|
|
7482
|
+
/**
|
|
7483
|
+
* 绘制图形前 初始化线条
|
|
7484
|
+
*
|
|
7485
|
+
* @method preDraw
|
|
7486
|
+
* @for jmLineSeries
|
|
7440
7487
|
*/
|
|
7441
7488
|
|
|
7442
7489
|
|
|
@@ -7516,10 +7563,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7516
7563
|
areaEnd.m = false;
|
|
7517
7564
|
this.createArea(areaPoints, false);
|
|
7518
7565
|
}
|
|
7519
|
-
/**
|
|
7520
|
-
* 生成图例
|
|
7521
|
-
*
|
|
7522
|
-
* @method createLegend
|
|
7566
|
+
/**
|
|
7567
|
+
* 生成图例
|
|
7568
|
+
*
|
|
7569
|
+
* @method createLegend
|
|
7523
7570
|
*/
|
|
7524
7571
|
|
|
7525
7572
|
|
|
@@ -7567,15 +7614,114 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7567
7614
|
|
|
7568
7615
|
}
|
|
7569
7616
|
|
|
7570
|
-
/**
|
|
7571
|
-
*
|
|
7572
|
-
*
|
|
7573
|
-
* @class
|
|
7574
|
-
* @module jmChart
|
|
7575
|
-
* @param {jmChart} chart 当前图表
|
|
7576
|
-
* @param {
|
|
7577
|
-
* @param {
|
|
7578
|
-
|
|
7617
|
+
/**
|
|
7618
|
+
* K线图
|
|
7619
|
+
*
|
|
7620
|
+
* @class jmCandlestickSeries
|
|
7621
|
+
* @module jmChart
|
|
7622
|
+
* @param {jmChart} chart 当前图表
|
|
7623
|
+
* @param {array} mappings 图形字段映射
|
|
7624
|
+
* @param {style} style 样式
|
|
7625
|
+
*/
|
|
7626
|
+
//构造函数
|
|
7627
|
+
|
|
7628
|
+
class jmCandlestickSeries extends jmSeries {
|
|
7629
|
+
constructor(options) {
|
|
7630
|
+
options.style = options.style || options.graph.style.line;
|
|
7631
|
+
super(options); //this.on('beginDraw', this[PreDrawKey]);
|
|
7632
|
+
}
|
|
7633
|
+
/**
|
|
7634
|
+
* 绘制图形前 初始化线条
|
|
7635
|
+
*
|
|
7636
|
+
* @method preDraw
|
|
7637
|
+
* @for jmLineSeries
|
|
7638
|
+
*/
|
|
7639
|
+
|
|
7640
|
+
|
|
7641
|
+
init() {
|
|
7642
|
+
//生成描点位
|
|
7643
|
+
const {
|
|
7644
|
+
points
|
|
7645
|
+
} = this.initDataPoint(); //去除多余的线条
|
|
7646
|
+
//当数据源线条数比现有的少时,删除多余的线条
|
|
7647
|
+
|
|
7648
|
+
const len = points.length;
|
|
7649
|
+
this.initWidth(len);
|
|
7650
|
+
const w = this.barWidth / 2; //实心处宽度的一半
|
|
7651
|
+
|
|
7652
|
+
for (let i = 0; i < len; i++) {
|
|
7653
|
+
const p = points[i]; //如果当前点无效,则跳致下一点
|
|
7654
|
+
|
|
7655
|
+
if (typeof p.y === 'undefined' || p.y === null) {
|
|
7656
|
+
//prePoint = null;
|
|
7657
|
+
continue;
|
|
7658
|
+
}
|
|
7659
|
+
|
|
7660
|
+
const sp = this.addShape(this.graph.createPath([], p.style));
|
|
7661
|
+
const bl = {
|
|
7662
|
+
x: p.x - w,
|
|
7663
|
+
y: p.points[0].y
|
|
7664
|
+
};
|
|
7665
|
+
const br = {
|
|
7666
|
+
x: p.x + w,
|
|
7667
|
+
y: p.points[0].y
|
|
7668
|
+
};
|
|
7669
|
+
const tl = {
|
|
7670
|
+
x: p.x - w,
|
|
7671
|
+
y: p.points[1].y
|
|
7672
|
+
};
|
|
7673
|
+
const tr = {
|
|
7674
|
+
x: p.x + w,
|
|
7675
|
+
y: p.points[1].y
|
|
7676
|
+
}; // 默认认为是阳线
|
|
7677
|
+
|
|
7678
|
+
let tm = p.points[1];
|
|
7679
|
+
let bm = p.points[0];
|
|
7680
|
+
p.style.stroke = p.style.fill = p.style.masculineColor || 'red'; // 开盘大于收盘,则阴线
|
|
7681
|
+
|
|
7682
|
+
if (p.points[0].yValue > p.points[1].yValue) {
|
|
7683
|
+
p.style.stroke = p.style.fill = p.style.negativeColor || 'green';
|
|
7684
|
+
bl.y = br.y = p.points[1].y;
|
|
7685
|
+
tl.y = tr.y = p.points[0].y;
|
|
7686
|
+
tm = p.points[0];
|
|
7687
|
+
bm = p.points[1];
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7690
|
+
sp.points.push(p.points[2], tm, tl, bl, bm, p.points[3], bm, br, tr, tm, p.points[2]); // 生成关健值标注
|
|
7691
|
+
|
|
7692
|
+
this.emit('onPointCreated', p);
|
|
7693
|
+
}
|
|
7694
|
+
} // 计算实心体宽度
|
|
7695
|
+
|
|
7696
|
+
|
|
7697
|
+
initWidth(count) {
|
|
7698
|
+
//计算每个柱子占宽
|
|
7699
|
+
//每项柱子占宽除以柱子个数,默认最大宽度为30
|
|
7700
|
+
const maxWidth = this.xAxis.width / count;
|
|
7701
|
+
|
|
7702
|
+
if (this.style.barWidth > 0) {
|
|
7703
|
+
this.barWidth = Number(this.style.barWidth);
|
|
7704
|
+
} else {
|
|
7705
|
+
this.barWidth = maxWidth * (this.style.perWidth || 0.4);
|
|
7706
|
+
}
|
|
7707
|
+
|
|
7708
|
+
if (this.barWidth > maxWidth) {
|
|
7709
|
+
this.barWidth = maxWidth;
|
|
7710
|
+
this.barTotalWidth = maxWidth * count;
|
|
7711
|
+
}
|
|
7712
|
+
}
|
|
7713
|
+
|
|
7714
|
+
}
|
|
7715
|
+
|
|
7716
|
+
/**
|
|
7717
|
+
* 轴
|
|
7718
|
+
*
|
|
7719
|
+
* @class jmAxis
|
|
7720
|
+
* @module jmChart
|
|
7721
|
+
* @param {jmChart} chart 当前图表
|
|
7722
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
7723
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
7724
|
+
* @param {object} [style] 样式
|
|
7579
7725
|
*/
|
|
7580
7726
|
|
|
7581
7727
|
class jmMarkLine extends jmLine {
|
|
@@ -7584,8 +7730,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7584
7730
|
this.visible = false;
|
|
7585
7731
|
this.markLineType = options.type || 'x'; // 为横轴x或纵轴y
|
|
7586
7732
|
|
|
7587
|
-
/**
|
|
7588
|
-
* 当前图形下的所有子图
|
|
7733
|
+
/**
|
|
7734
|
+
* 当前图形下的所有子图
|
|
7589
7735
|
*/
|
|
7590
7736
|
|
|
7591
7737
|
this.shapes = new jmList();
|
|
@@ -7648,8 +7794,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7648
7794
|
serie.lastMarkPoint = point; // 记下最后一次改变的点
|
|
7649
7795
|
// 同时改变下X轴标线的位置,它的Y坐标跟随最后一个命中的线点
|
|
7650
7796
|
|
|
7651
|
-
if (graph && graph.xMarkLine) {
|
|
7652
|
-
graph.xMarkLine.start.y = graph.xMarkLine.end.y = isTocuhGraph ? point.y + graph.chartArea.position.y : point.y;
|
|
7797
|
+
if (graph && graph.markLine && graph.markLine.xMarkLine) {
|
|
7798
|
+
graph.markLine.xMarkLine.start.y = graph.markLine.xMarkLine.end.y = isTocuhGraph ? point.y + graph.chartArea.position.y : point.y;
|
|
7653
7799
|
}
|
|
7654
7800
|
}
|
|
7655
7801
|
} catch (e) {
|
|
@@ -7664,9 +7810,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7664
7810
|
}, 10);
|
|
7665
7811
|
}
|
|
7666
7812
|
}
|
|
7667
|
-
/**
|
|
7668
|
-
* 移动标线
|
|
7669
|
-
* @param { object } args 移动事件参数
|
|
7813
|
+
/**
|
|
7814
|
+
* 移动标线
|
|
7815
|
+
* @param { object } args 移动事件参数
|
|
7670
7816
|
*/
|
|
7671
7817
|
|
|
7672
7818
|
|
|
@@ -7730,8 +7876,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7730
7876
|
this.needUpdate = true;
|
|
7731
7877
|
}
|
|
7732
7878
|
}
|
|
7733
|
-
/**
|
|
7734
|
-
* 中止
|
|
7879
|
+
/**
|
|
7880
|
+
* 中止
|
|
7735
7881
|
*/
|
|
7736
7882
|
|
|
7737
7883
|
|
|
@@ -7742,13 +7888,169 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7742
7888
|
|
|
7743
7889
|
}
|
|
7744
7890
|
|
|
7745
|
-
/**
|
|
7746
|
-
*
|
|
7747
|
-
*
|
|
7748
|
-
*
|
|
7749
|
-
* @
|
|
7750
|
-
* @
|
|
7751
|
-
* @param {
|
|
7891
|
+
/**
|
|
7892
|
+
* 轴
|
|
7893
|
+
*
|
|
7894
|
+
* @class jmMarkLineManager
|
|
7895
|
+
* @module jmChart
|
|
7896
|
+
* @param {jmChart} chart 当前图表
|
|
7897
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
7898
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
7899
|
+
* @param {object} [style] 样式
|
|
7900
|
+
*/
|
|
7901
|
+
|
|
7902
|
+
class jmMarkLineManager {
|
|
7903
|
+
constructor(chart) {
|
|
7904
|
+
this.chart = chart;
|
|
7905
|
+
this.init(chart);
|
|
7906
|
+
} // 初始化
|
|
7907
|
+
|
|
7908
|
+
|
|
7909
|
+
init(chart) {
|
|
7910
|
+
const graph = chart.touchGraph || chart;
|
|
7911
|
+
graph.on('beginDraw', () => {
|
|
7912
|
+
// 重置标线,会处理小圆圈问题
|
|
7913
|
+
this.xMarkLine && this.xMarkLine.init();
|
|
7914
|
+
this.yMarkLine && this.yMarkLine.init();
|
|
7915
|
+
});
|
|
7916
|
+
|
|
7917
|
+
if (chart.style.markLine) {
|
|
7918
|
+
// 生成标线,可以跟随鼠标或手指滑动
|
|
7919
|
+
if (chart.style.markLine && chart.style.markLine.x) {
|
|
7920
|
+
this.xMarkLine = graph.createShape(jmMarkLine, {
|
|
7921
|
+
type: 'x',
|
|
7922
|
+
style: chart.style.markLine
|
|
7923
|
+
});
|
|
7924
|
+
const area = graph.chartArea || graph;
|
|
7925
|
+
area.children.add(this.xMarkLine);
|
|
7926
|
+
}
|
|
7927
|
+
|
|
7928
|
+
if (chart.style.markLine && chart.style.markLine.y) {
|
|
7929
|
+
this.yMarkLine = graph.createShape(jmMarkLine, {
|
|
7930
|
+
type: 'y',
|
|
7931
|
+
style: chart.style.markLine
|
|
7932
|
+
});
|
|
7933
|
+
const area = graph.chartArea || graph;
|
|
7934
|
+
area.children.add(this.yMarkLine);
|
|
7935
|
+
}
|
|
7936
|
+
|
|
7937
|
+
let longtap = 0; // 是否有长按, 0 未开始,1已按下,2识别为长按
|
|
7938
|
+
|
|
7939
|
+
let longtapHandler = 0;
|
|
7940
|
+
let touchStartPos = {
|
|
7941
|
+
x: 0,
|
|
7942
|
+
y: 0
|
|
7943
|
+
};
|
|
7944
|
+
graph.on('mousedown touchstart', args => {
|
|
7945
|
+
// 如果长按才启用
|
|
7946
|
+
if (chart.style.markLine.longtap) {
|
|
7947
|
+
longtap = 1;
|
|
7948
|
+
longtapHandler && graph.utils.cancelAnimationFrame(longtapHandler);
|
|
7949
|
+
let tapStartTime = Date.now();
|
|
7950
|
+
|
|
7951
|
+
const reqFun = () => {
|
|
7952
|
+
const elapsed = Date.now() - tapStartTime;
|
|
7953
|
+
|
|
7954
|
+
if (longtap === 1 || longtap === 2) {
|
|
7955
|
+
// 如果还未过一定时间,则继续等待
|
|
7956
|
+
if (elapsed < 500) {
|
|
7957
|
+
longtapHandler = graph.utils.requestAnimationFrame(reqFun);
|
|
7958
|
+
return;
|
|
7959
|
+
}
|
|
7960
|
+
|
|
7961
|
+
longtap = 2;
|
|
7962
|
+
this.startMove(args);
|
|
7963
|
+
chart.emit('marklinelongtapstart', args);
|
|
7964
|
+
}
|
|
7965
|
+
}; // 如果一定时间后还没有取消,则表示长按了
|
|
7966
|
+
|
|
7967
|
+
|
|
7968
|
+
longtapHandler = graph.utils.requestAnimationFrame(reqFun); //args.event.stopPropagation();
|
|
7969
|
+
//args.event.preventDefault();// 阻止默认行为
|
|
7970
|
+
} else {
|
|
7971
|
+
this.startMove(args);
|
|
7972
|
+
}
|
|
7973
|
+
|
|
7974
|
+
args.longtap = longtap;
|
|
7975
|
+
touchStartPos = args.position;
|
|
7976
|
+
}); // 移动标线
|
|
7977
|
+
|
|
7978
|
+
graph.on('mousemove touchmove', args => {
|
|
7979
|
+
const ox = args.position.x - touchStartPos.x;
|
|
7980
|
+
const oy = args.position.y - touchStartPos.y;
|
|
7981
|
+
const offpos = Math.sqrt(ox * ox + oy * oy);
|
|
7982
|
+
if (longtap === 1 && offpos > 15) longtap = 0; // 如果移动了,则取消长按
|
|
7983
|
+
|
|
7984
|
+
args.longtap = longtap;
|
|
7985
|
+
this.move(args);
|
|
7986
|
+
}); // 取消移动
|
|
7987
|
+
|
|
7988
|
+
graph.on('mouseup touchend touchcancel touchleave', args => {
|
|
7989
|
+
longtap = 0;
|
|
7990
|
+
this.endMove(args);
|
|
7991
|
+
});
|
|
7992
|
+
}
|
|
7993
|
+
} // 开始移动标线
|
|
7994
|
+
|
|
7995
|
+
|
|
7996
|
+
startMove(args, markLineType = 'xy') {
|
|
7997
|
+
if (this.xMarkLine && markLineType.includes('x')) {
|
|
7998
|
+
this.xMarkLine.visible = true;
|
|
7999
|
+
this.xMarkLine.move(args);
|
|
8000
|
+
}
|
|
8001
|
+
|
|
8002
|
+
if (this.yMarkLine && markLineType.includes('y')) {
|
|
8003
|
+
this.yMarkLine.visible = true;
|
|
8004
|
+
this.yMarkLine.move(args);
|
|
8005
|
+
}
|
|
8006
|
+
|
|
8007
|
+
if (!args.cancel) this.chart.emit('marklinestartmove', args);
|
|
8008
|
+
} // 移动标线
|
|
8009
|
+
|
|
8010
|
+
|
|
8011
|
+
move(args) {
|
|
8012
|
+
let moved = false;
|
|
8013
|
+
|
|
8014
|
+
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
8015
|
+
this.xMarkLine.move(args);
|
|
8016
|
+
moved = true;
|
|
8017
|
+
}
|
|
8018
|
+
|
|
8019
|
+
if (this.yMarkLine && this.yMarkLine.visible) {
|
|
8020
|
+
this.yMarkLine.move(args);
|
|
8021
|
+
moved = true;
|
|
8022
|
+
}
|
|
8023
|
+
|
|
8024
|
+
if (moved) {
|
|
8025
|
+
args.event.stopPropagation();
|
|
8026
|
+
args.event.preventDefault(); // 阻止默认行为
|
|
8027
|
+
|
|
8028
|
+
if (!args.cancel) this.chart.emit('marklinemove', args);
|
|
8029
|
+
}
|
|
8030
|
+
} // 终止动移
|
|
8031
|
+
|
|
8032
|
+
|
|
8033
|
+
endMove(args) {
|
|
8034
|
+
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
8035
|
+
this.xMarkLine.cancel(args);
|
|
8036
|
+
}
|
|
8037
|
+
|
|
8038
|
+
if (this.yMarkLine && this.yMarkLine.visible) {
|
|
8039
|
+
this.yMarkLine.cancel(args);
|
|
8040
|
+
}
|
|
8041
|
+
|
|
8042
|
+
if (!args.cancel) this.chart.emit('marklineendmove', args);
|
|
8043
|
+
}
|
|
8044
|
+
|
|
8045
|
+
}
|
|
8046
|
+
|
|
8047
|
+
/**
|
|
8048
|
+
* jm图表组件
|
|
8049
|
+
* option参数:graph=jmgraph
|
|
8050
|
+
*
|
|
8051
|
+
* @class jmChart
|
|
8052
|
+
* @module jmChart
|
|
8053
|
+
* @param {element} container 图表容器
|
|
7752
8054
|
*/
|
|
7753
8055
|
|
|
7754
8056
|
class jmChart extends jmGraph {
|
|
@@ -7777,13 +8079,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7777
8079
|
|
|
7778
8080
|
this.createTouchGraph(this.container, options);
|
|
7779
8081
|
}
|
|
7780
|
-
/**
|
|
7781
|
-
* 绑定的数据源
|
|
8082
|
+
/**
|
|
8083
|
+
* 绑定的数据源
|
|
7782
8084
|
*/
|
|
7783
8085
|
|
|
7784
8086
|
|
|
7785
|
-
/**
|
|
7786
|
-
* 是否启用动画
|
|
8087
|
+
/**
|
|
8088
|
+
* 是否启用动画
|
|
7787
8089
|
*/
|
|
7788
8090
|
get enableAnimate() {
|
|
7789
8091
|
if (typeof this.option.enableAnimate !== 'undefined') return !!this.option.enableAnimate;else {
|
|
@@ -7794,8 +8096,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7794
8096
|
set enableAnimate(v) {
|
|
7795
8097
|
this.option.enableAnimate = v;
|
|
7796
8098
|
}
|
|
7797
|
-
/**
|
|
7798
|
-
* Y轴的基线 默认是0
|
|
8099
|
+
/**
|
|
8100
|
+
* Y轴的基线 默认是0
|
|
7799
8101
|
*/
|
|
7800
8102
|
|
|
7801
8103
|
|
|
@@ -7809,11 +8111,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7809
8111
|
|
|
7810
8112
|
|
|
7811
8113
|
init(options) {
|
|
7812
|
-
/**
|
|
7813
|
-
* 绘图区域
|
|
7814
|
-
*
|
|
7815
|
-
* @property chartArea
|
|
7816
|
-
* @type jmControl
|
|
8114
|
+
/**
|
|
8115
|
+
* 绘图区域
|
|
8116
|
+
*
|
|
8117
|
+
* @property chartArea
|
|
8118
|
+
* @type jmControl
|
|
7817
8119
|
*/
|
|
7818
8120
|
if (!this.chartArea) {
|
|
7819
8121
|
this.chartArea = this.createShape('rect', {
|
|
@@ -7825,11 +8127,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7825
8127
|
});
|
|
7826
8128
|
this.children.add(this.chartArea);
|
|
7827
8129
|
}
|
|
7828
|
-
/**
|
|
7829
|
-
* 图例
|
|
7830
|
-
*
|
|
7831
|
-
* @property legend
|
|
7832
|
-
* @type jmLegend
|
|
8130
|
+
/**
|
|
8131
|
+
* 图例
|
|
8132
|
+
*
|
|
8133
|
+
* @property legend
|
|
8134
|
+
* @type jmLegend
|
|
7833
8135
|
*/
|
|
7834
8136
|
|
|
7835
8137
|
|
|
@@ -7841,11 +8143,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7841
8143
|
if (options.legendVisible === false) {
|
|
7842
8144
|
this.legend.visible = false;
|
|
7843
8145
|
}
|
|
7844
|
-
/**
|
|
7845
|
-
* 图表提示控件
|
|
7846
|
-
*
|
|
7847
|
-
* @property tooltip
|
|
7848
|
-
* @type jmTooltip
|
|
8146
|
+
/**
|
|
8147
|
+
* 图表提示控件
|
|
8148
|
+
*
|
|
8149
|
+
* @property tooltip
|
|
8150
|
+
* @type jmTooltip
|
|
7849
8151
|
*/
|
|
7850
8152
|
//this.tooltip = this.graph.createShape('tooltip',{style:this.style.tooltip});
|
|
7851
8153
|
//this.chartArea.children.add(this.tooltip);
|
|
@@ -7863,84 +8165,36 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7863
8165
|
container && (container.style.position = 'relative');
|
|
7864
8166
|
options = this.utils.clone(options, {
|
|
7865
8167
|
autoRefresh: true
|
|
7866
|
-
}, true);
|
|
7867
|
-
let graph = this.touchGraph = this; // 生成图层, 当图刷新慢时,需要用一个操作图层来进行滑动等操作重绘
|
|
8168
|
+
}, true); // 生成图层, 当图刷新慢时,需要用一个操作图层来进行滑动等操作重绘
|
|
7868
8169
|
// isWXMiniApp 非微信小程序下才能创建
|
|
7869
8170
|
|
|
7870
|
-
if (!
|
|
8171
|
+
if (!this.isWXMiniApp && container && options.touchGraph) {
|
|
7871
8172
|
let cn = document.createElement('canvas');
|
|
7872
8173
|
cn.width = container.offsetWidth || container.clientWidth;
|
|
7873
8174
|
cn.height = container.offsetHeight || container.clientHeight;
|
|
7874
8175
|
cn.style.position = 'absolute';
|
|
7875
8176
|
cn.style.top = 0;
|
|
7876
8177
|
cn.style.left = 0;
|
|
7877
|
-
this.touchGraph =
|
|
8178
|
+
this.touchGraph = new jmGraph(cn, options);
|
|
7878
8179
|
container.appendChild(cn);
|
|
7879
8180
|
this.touchGraph.chartGraph = this;
|
|
7880
8181
|
this.on('propertyChange', (name, args) => {
|
|
7881
8182
|
if (['width', 'height'].includes(name)) {
|
|
7882
8183
|
this.touchGraph[name] = args.newValue / this.devicePixelRatio;
|
|
7883
8184
|
}
|
|
7884
|
-
});
|
|
7885
|
-
}
|
|
7886
|
-
|
|
7887
|
-
if (this.style.markLine) {
|
|
7888
|
-
graph.on('beginDraw', () => {
|
|
7889
|
-
// 重置标线,会处理小圆圈问题
|
|
7890
|
-
this.xMarkLine && this.xMarkLine.init();
|
|
7891
|
-
this.yMarkLine && this.yMarkLine.init();
|
|
7892
|
-
}); // 生成标线,可以跟随鼠标或手指滑动
|
|
7893
|
-
|
|
7894
|
-
if (this.style.markLine && this.style.markLine.x) {
|
|
7895
|
-
this.xMarkLine = graph.createShape(jmMarkLine, {
|
|
7896
|
-
type: 'x',
|
|
7897
|
-
style: this.style.markLine
|
|
7898
|
-
});
|
|
7899
|
-
const area = graph.chartArea || graph;
|
|
7900
|
-
area.children.add(this.xMarkLine);
|
|
7901
|
-
}
|
|
7902
|
-
|
|
7903
|
-
if (this.style.markLine && this.style.markLine.y) {
|
|
7904
|
-
this.yMarkLine = graph.createShape(jmMarkLine, {
|
|
7905
|
-
type: 'y',
|
|
7906
|
-
style: this.style.markLine
|
|
7907
|
-
});
|
|
7908
|
-
const area = graph.chartArea || graph;
|
|
7909
|
-
area.children.add(this.yMarkLine);
|
|
7910
|
-
}
|
|
7911
|
-
|
|
7912
|
-
graph.on('mousedown touchstart', args => {
|
|
7913
|
-
if (this.xMarkLine) {
|
|
7914
|
-
this.xMarkLine.visible = true;
|
|
7915
|
-
this.xMarkLine.move(args);
|
|
7916
|
-
}
|
|
8185
|
+
}); // 把上层canvse事件传递给绘图层对象
|
|
7917
8186
|
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
this.yMarkLine.move(args);
|
|
7921
|
-
}
|
|
7922
|
-
}); // 移动标线
|
|
7923
|
-
|
|
7924
|
-
graph.on('mousemove touchmove', args => {
|
|
7925
|
-
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
7926
|
-
this.xMarkLine.move(args);
|
|
7927
|
-
}
|
|
8187
|
+
this.touchGraph.on('mousedown touchstart mousemove touchmove mouseup touchend touchcancel touchleave', args => {
|
|
8188
|
+
const eventName = args.event.eventName || args.event.type;
|
|
7928
8189
|
|
|
7929
|
-
if (
|
|
7930
|
-
this.
|
|
8190
|
+
if (eventName) {
|
|
8191
|
+
this.emit(eventName, args);
|
|
7931
8192
|
}
|
|
7932
|
-
});
|
|
8193
|
+
});
|
|
8194
|
+
} // 初始化标线
|
|
7933
8195
|
|
|
7934
|
-
graph.on('mouseup touchend touchcancel touchleave', args => {
|
|
7935
|
-
if (this.xMarkLine && this.xMarkLine.visible) {
|
|
7936
|
-
this.xMarkLine.cancel(args);
|
|
7937
|
-
}
|
|
7938
8196
|
|
|
7939
|
-
|
|
7940
|
-
this.yMarkLine.cancel(args);
|
|
7941
|
-
}
|
|
7942
|
-
});
|
|
7943
|
-
}
|
|
8197
|
+
this.markLine = new jmMarkLineManager(this);
|
|
7944
8198
|
} // 重置整个图表
|
|
7945
8199
|
|
|
7946
8200
|
|
|
@@ -7973,11 +8227,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7973
8227
|
delete this.yAxises;
|
|
7974
8228
|
}
|
|
7975
8229
|
}
|
|
7976
|
-
/**
|
|
7977
|
-
* 获取颜色
|
|
7978
|
-
*
|
|
7979
|
-
* @method getColor
|
|
7980
|
-
* @param {int} index 颜色索引
|
|
8230
|
+
/**
|
|
8231
|
+
* 获取颜色
|
|
8232
|
+
*
|
|
8233
|
+
* @method getColor
|
|
8234
|
+
* @param {int} index 颜色索引
|
|
7981
8235
|
*/
|
|
7982
8236
|
|
|
7983
8237
|
|
|
@@ -7989,11 +8243,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7989
8243
|
|
|
7990
8244
|
return this.style.chartColors[index];
|
|
7991
8245
|
}
|
|
7992
|
-
/**
|
|
7993
|
-
* 绘制当前图表
|
|
7994
|
-
* 先绘制轴等基础信息
|
|
7995
|
-
*
|
|
7996
|
-
* @method beginDraw
|
|
8246
|
+
/**
|
|
8247
|
+
* 绘制当前图表
|
|
8248
|
+
* 先绘制轴等基础信息
|
|
8249
|
+
*
|
|
8250
|
+
* @method beginDraw
|
|
7997
8251
|
*/
|
|
7998
8252
|
|
|
7999
8253
|
|
|
@@ -8058,10 +8312,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8058
8312
|
serie.init && serie.init();
|
|
8059
8313
|
}); //console.log('beginDraw4', Date.now() - startTime);
|
|
8060
8314
|
}
|
|
8061
|
-
/**
|
|
8062
|
-
* 重新定位区域的位置
|
|
8063
|
-
*
|
|
8064
|
-
* @method resetAreaPosition
|
|
8315
|
+
/**
|
|
8316
|
+
* 重新定位区域的位置
|
|
8317
|
+
*
|
|
8318
|
+
* @method resetAreaPosition
|
|
8065
8319
|
*/
|
|
8066
8320
|
|
|
8067
8321
|
|
|
@@ -8073,15 +8327,15 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8073
8327
|
this.chartArea.width = w;
|
|
8074
8328
|
this.chartArea.height = h;
|
|
8075
8329
|
}
|
|
8076
|
-
/**
|
|
8077
|
-
* 创建轴
|
|
8078
|
-
*
|
|
8079
|
-
* @method createAxis
|
|
8080
|
-
* @for jmChart
|
|
8081
|
-
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
8082
|
-
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
8083
|
-
* @param {object} [style] 样式
|
|
8084
|
-
* @return {axis} 轴
|
|
8330
|
+
/**
|
|
8331
|
+
* 创建轴
|
|
8332
|
+
*
|
|
8333
|
+
* @method createAxis
|
|
8334
|
+
* @for jmChart
|
|
8335
|
+
* @param {string} [type] 轴类型(x/y/radar),默认为x
|
|
8336
|
+
* @param {string} [dataType] 当前轴的数据类型(number/date/string),默认为 number
|
|
8337
|
+
* @param {object} [style] 样式
|
|
8338
|
+
* @return {axis} 轴
|
|
8085
8339
|
*/
|
|
8086
8340
|
|
|
8087
8341
|
|
|
@@ -8093,12 +8347,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8093
8347
|
this.children.add(axis);
|
|
8094
8348
|
return axis;
|
|
8095
8349
|
}
|
|
8096
|
-
/**
|
|
8097
|
-
* 生成X轴
|
|
8098
|
-
*
|
|
8099
|
-
* @method createXAxis
|
|
8100
|
-
* @param {string} x轴的数据类型(string/number/date)
|
|
8101
|
-
* @param {bool} 是否从0开始
|
|
8350
|
+
/**
|
|
8351
|
+
* 生成X轴
|
|
8352
|
+
*
|
|
8353
|
+
* @method createXAxis
|
|
8354
|
+
* @param {string} x轴的数据类型(string/number/date)
|
|
8355
|
+
* @param {bool} 是否从0开始
|
|
8102
8356
|
*/
|
|
8103
8357
|
|
|
8104
8358
|
|
|
@@ -8125,13 +8379,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8125
8379
|
|
|
8126
8380
|
return this.xAxis;
|
|
8127
8381
|
}
|
|
8128
|
-
/**
|
|
8129
|
-
* 生成Y轴
|
|
8130
|
-
*
|
|
8131
|
-
* @method createYAxis
|
|
8132
|
-
* @param {int} Y轴索引,可以创建多个Y轴
|
|
8133
|
-
* @param {string} y轴的数据类型(string/number/date)
|
|
8134
|
-
* @param {bool} 是否从0开始
|
|
8382
|
+
/**
|
|
8383
|
+
* 生成Y轴
|
|
8384
|
+
*
|
|
8385
|
+
* @method createYAxis
|
|
8386
|
+
* @param {int} Y轴索引,可以创建多个Y轴
|
|
8387
|
+
* @param {string} y轴的数据类型(string/number/date)
|
|
8388
|
+
* @param {bool} 是否从0开始
|
|
8135
8389
|
*/
|
|
8136
8390
|
|
|
8137
8391
|
|
|
@@ -8160,14 +8414,14 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8160
8414
|
var yaxis = this.yAxises[options.index] || (this.yAxises[options.index] = this.createAxis(options));
|
|
8161
8415
|
return yaxis;
|
|
8162
8416
|
}
|
|
8163
|
-
/**
|
|
8164
|
-
* 创建图形
|
|
8165
|
-
*
|
|
8166
|
-
* @method createSeries
|
|
8167
|
-
* @for jmChart
|
|
8168
|
-
* @param {string} [type] 图类型,(line/bar/pie/radar)
|
|
8169
|
-
* @param {object} [options] 生成图表选项 {xField, yField, index}
|
|
8170
|
-
* @return {series} 图形
|
|
8417
|
+
/**
|
|
8418
|
+
* 创建图形
|
|
8419
|
+
*
|
|
8420
|
+
* @method createSeries
|
|
8421
|
+
* @for jmChart
|
|
8422
|
+
* @param {string} [type] 图类型,(line/bar/pie/radar)
|
|
8423
|
+
* @param {object} [options] 生成图表选项 {xField, yField, index}
|
|
8424
|
+
* @return {series} 图形
|
|
8171
8425
|
*/
|
|
8172
8426
|
|
|
8173
8427
|
|
|
@@ -8178,7 +8432,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8178
8432
|
'bar': jmBarSeries,
|
|
8179
8433
|
'stackBar': jmStackBarSeries,
|
|
8180
8434
|
'pie': jmPieSeries,
|
|
8181
|
-
'stackLine': jmStackLineSeries
|
|
8435
|
+
'stackLine': jmStackLineSeries,
|
|
8436
|
+
'candlestick': jmCandlestickSeries
|
|
8182
8437
|
};
|
|
8183
8438
|
} //默认样式为类型对应的样式
|
|
8184
8439
|
|
|
@@ -8321,10 +8576,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8321
8576
|
template: `<div ref="jmChartContainer" :style="{width: width, height: height}"></div>`
|
|
8322
8577
|
};
|
|
8323
8578
|
|
|
8324
|
-
exports[
|
|
8579
|
+
exports['default'] = jmChart;
|
|
8325
8580
|
exports.jmChart = jmChart;
|
|
8326
8581
|
exports.vChart = vchart;
|
|
8327
8582
|
|
|
8328
8583
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8329
8584
|
|
|
8330
|
-
})
|
|
8585
|
+
});
|