@10yun/cv-mobile-ui 0.4.2 → 0.4.4
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/package.json +1 -1
- package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
- package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
- package/ui-uni/amap-wx/js/util.js +166 -158
- package/ui-uni/page-foot/page-foot.vue +38 -0
- package/ui-uni/page-head/page-head.vue +16 -0
- package/ui-uni/product.vue +52 -52
- package/ui-uni/u-charts/u-charts.js +743 -1092
- package/ui-uni/u-link/u-link.vue +59 -0
- package/ui-uni/uni-badge/uni-badge.vue +250 -0
- package/ui-uni/uni-calendar/calendar.js +546 -0
- package/ui-uni/uni-calendar/uni-calendar-item.vue +171 -0
- package/ui-uni/uni-calendar/uni-calendar.vue +504 -0
- package/{ui-cv/cv-calendar → ui-uni/uni-calendar}/util.js +0 -0
- package/ui-uni/uni-card/uni-card.vue +420 -0
- package/ui-uni/uni-col/uni-col.vue +2968 -0
- package/ui-uni/uni-collapse/uni-collapse.vue +146 -0
- package/ui-uni/uni-collapse-item/uni-collapse-item.vue +378 -0
- package/ui-uni/uni-combox/uni-combox.vue +237 -0
- package/ui-uni/uni-countdown/uni-countdown.vue +234 -0
- package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +792 -0
- package/{ui-cv/cv-data-indexed-list → ui-uni/uni-data-indexed-list}/clientdb.js +0 -0
- package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +142 -0
- package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +364 -0
- package/{ui-cv/cv-data-picker → ui-uni/uni-data-picker}/keypress.js +0 -0
- package/ui-uni/uni-data-picker/uni-data-picker.vue +468 -0
- package/{ui-cv/cv-data-pickerview/cv-data-picker.js → ui-uni/uni-data-pickerview/uni-data-picker.js} +0 -0
- package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +298 -0
- package/{ui-cv/cv-dateformat → ui-uni/uni-dateformat}/date-format.js +0 -0
- package/ui-uni/uni-dateformat/uni-dateformat.vue +88 -0
- package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar-item.vue +0 -0
- package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar.js +0 -0
- package/ui-uni/uni-datetime-picker/calendar.vue +747 -0
- package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/keypress.js +0 -0
- package/ui-uni/uni-datetime-picker/time-picker.vue +899 -0
- package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +874 -0
- package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/util.js +0 -0
- package/ui-uni/uni-drawer/keypress.js +45 -0
- package/ui-uni/uni-drawer/uni-drawer.vue +178 -0
- package/{ui-cv/cv-easyinput → ui-uni/uni-easyinput}/common.js +0 -0
- package/ui-uni/uni-easyinput/uni-easyinput.vue +438 -0
- package/ui-uni/uni-fab/uni-fab.vue +443 -0
- package/{ui-cv/cv-fab/cv-fab.vue.bak → ui-uni/uni-fab/uni-fab.vue.bak} +2 -2
- package/ui-uni/uni-fav/uni-fav.vue +136 -0
- package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/choose-and-upload-file.js +0 -0
- package/ui-uni/uni-file-picker/uni-file-picker.vue +614 -0
- package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-file.vue +0 -0
- package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-image.vue +0 -0
- package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/utils.js +0 -0
- package/ui-uni/uni-forms/uni-forms.vue +467 -0
- package/ui-uni/uni-forms/validate.js +486 -0
- package/ui-uni/uni-forms-item/uni-forms-item.vue +500 -0
- package/{ui-cv/cv-goods-nav/cv-goods-nav.vue → ui-uni/uni-goods-nav/uni-goods-nav.vue} +1 -1
- package/ui-uni/uni-grid/uni-grid.vue +141 -0
- package/ui-uni/uni-grid-item/uni-grid-item.vue +123 -0
- package/ui-uni/uni-group/uni-group.vue +123 -0
- package/ui-uni/uni-icons/icons.js +132 -0
- package/ui-uni/uni-icons/uni-icons.vue +72 -0
- package/{ui-cv/cv-icon2 → ui-uni/uni-icons}/uni.ttf +0 -0
- package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +142 -0
- package/ui-uni/uni-indexed-list/uni-indexed-list.vue +357 -0
- package/ui-uni/uni-link/uni-link.vue +117 -0
- package/ui-uni/uni-list/uni-list.vue +107 -0
- package/ui-uni/uni-list/uni-refresh.vue +65 -0
- package/{ui-cv/cv-list → ui-uni/uni-list}/uni-refresh.wxs +0 -0
- package/ui-uni/uni-list-ad/uni-list-ad.vue +106 -0
- package/{ui-cv/cv-list-chat/cv-list-chat.scss → ui-uni/uni-list-chat/uni-list-chat.scss} +0 -0
- package/{ui-cv/cv-list-chat/cv-list-chat.vue → ui-uni/uni-list-chat/uni-list-chat.vue} +0 -0
- package/ui-uni/uni-list-item/uni-list-item.vue +428 -0
- package/ui-uni/uni-load-more/uni-load-more.vue +366 -0
- package/ui-uni/uni-nav-bar/uni-nav-bar.vue +244 -0
- package/{ui-cv/cv-nav-bar/cv-status-bar.vue → ui-uni/uni-nav-bar/uni-status-bar.vue} +0 -0
- package/ui-uni/uni-notice-bar/uni-notice-bar.vue +394 -0
- package/ui-uni/uni-number-box/uni-number-box.vue +224 -0
- package/ui-uni/uni-pagination/uni-pagination.vue +376 -0
- package/{ui-cv/cv-popup → ui-uni/uni-popup}/keypress.js +0 -0
- package/{ui-cv/cv-popup → ui-uni/uni-popup}/popup.js +0 -0
- package/ui-uni/uni-popup/uni-popup.vue +412 -0
- package/{ui-cv/cv-popup-dialog → ui-uni/uni-popup-dialog}/keypress.js +0 -0
- package/{ui-cv/cv-popup-dialog/cv-popup-dialog.vue → ui-uni/uni-popup-dialog/uni-popup-dialog.vue} +0 -0
- package/ui-uni/uni-popup-message/uni-popup-message.vue +143 -0
- package/{ui-cv/cv-popup-share/cv-popup-share.vue → ui-uni/uni-popup-share/uni-popup-share.vue} +0 -0
- package/ui-uni/uni-rate/uni-rate.vue +357 -0
- package/ui-uni/uni-row/uni-row.vue +155 -0
- package/ui-uni/uni-search-bar/uni-search-bar.vue +262 -0
- package/{ui-cv/cv-section/cv-section.vue → ui-uni/uni-section/uni-section.vue} +0 -0
- package/{ui-cv/cv-segmented-control/cv-segmented-control.vue → ui-uni/uni-segmented-control/uni-segmented-control.vue} +0 -0
- package/{ui-cv/cv-status-bar/cv-status-bar.vue → ui-uni/uni-status-bar/uni-status-bar.vue} +0 -0
- package/ui-uni/uni-steps/uni-steps.vue +250 -0
- package/{ui-cv/cv-swipe-action/cv-swipe-action.vue → ui-uni/uni-swipe-action/uni-swipe-action.vue} +0 -0
- package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/bindingx.js +0 -0
- package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/index.wxs +0 -0
- package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/isPC.js +0 -0
- package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpalipay.js +0 -0
- package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpother.js +0 -0
- package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpwxs.js +0 -0
- package/{ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue → ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue} +0 -0
- package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +205 -0
- package/ui-uni/uni-table/uni-table.vue +455 -0
- package/ui-uni/uni-tag/uni-tag.vue +283 -0
- package/ui-uni/uni-tbody/uni-tbody.vue +30 -0
- package/ui-uni/uni-td/uni-td.vue +88 -0
- package/{ui-cv/cv-test/cv-test.vue → ui-uni/uni-test/uni-test.vue} +0 -0
- package/{ui-cv/cv-th → ui-uni/uni-th}/filter-dropdown.vue +0 -0
- package/ui-uni/uni-th/uni-th.vue +259 -0
- package/ui-uni/uni-thead/uni-thead.vue +114 -0
- package/ui-uni/uni-title/uni-title.vue +171 -0
- package/{ui-cv/cv-tr → ui-uni/uni-tr}/table-checkbox.vue +0 -0
- package/ui-uni/uni-tr/uni-tr.vue +156 -0
- package/{ui-cv/cv-transition → ui-uni/uni-transition}/createAnimation.js +0 -0
- package/ui-uni/uni-transition/uni-transition.vue +287 -0
- package/ui-cv/cv-badge/cv-badge.vue +0 -249
- package/ui-cv/cv-calendar/calendar.js +0 -963
- package/ui-cv/cv-calendar/cv-calendar-item.vue +0 -198
- package/ui-cv/cv-calendar/cv-calendar.vue +0 -508
- package/ui-cv/cv-card/cv-card.vue +0 -427
- package/ui-cv/cv-col/cv-col.vue +0 -2965
- package/ui-cv/cv-collapse/cv-collapse.vue +0 -146
- package/ui-cv/cv-collapse-item/cv-collapse-item.vue +0 -395
- package/ui-cv/cv-combox/cv-combox.vue +0 -250
- package/ui-cv/cv-countdown/cv-countdown.vue +0 -245
- package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +0 -841
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +0 -154
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +0 -376
- package/ui-cv/cv-data-picker/cv-data-picker.vue +0 -486
- package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +0 -304
- package/ui-cv/cv-dateformat/cv-dateformat.vue +0 -86
- package/ui-cv/cv-datetime-picker/calendar.vue +0 -761
- package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +0 -958
- package/ui-cv/cv-datetime-picker/time-picker.vue +0 -907
- package/ui-cv/cv-drawer/cv-drawer.vue +0 -185
- package/ui-cv/cv-drawer/keypress.js +0 -45
- package/ui-cv/cv-easyinput/cv-easyinput.vue +0 -514
- package/ui-cv/cv-fab/cv-fab.vue +0 -465
- package/ui-cv/cv-fav/cv-fav.vue +0 -150
- package/ui-cv/cv-file-picker/cv-file-picker.vue +0 -619
- package/ui-cv/cv-form-base/cv-form-base.vue +0 -470
- package/ui-cv/cv-form-base/validate.js +0 -477
- package/ui-cv/cv-grid-group/cv-grid-group.vue +0 -148
- package/ui-cv/cv-grid-item/cv-grid-item.vue +0 -132
- package/ui-cv/cv-icon2/cv-icon2.vue +0 -78
- package/ui-cv/cv-icon2/icons.js +0 -132
- package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +0 -154
- package/ui-cv/cv-indexed-list/cv-indexed-list.vue +0 -371
- package/ui-cv/cv-link2/cv-link2.vue +0 -130
- package/ui-cv/cv-list/cv-list.vue +0 -107
- package/ui-cv/cv-list/cv-refresh.vue +0 -65
- package/ui-cv/cv-list-ad/cv-list-ad.vue +0 -113
- package/ui-cv/cv-list-item/cv-list-item.vue +0 -449
- package/ui-cv/cv-nav-bar/cv-nav-bar.vue +0 -256
- package/ui-cv/cv-notice-bar/cv-notice-bar.vue +0 -453
- package/ui-cv/cv-number-box/cv-number-box.vue +0 -223
- package/ui-cv/cv-pagination/cv-pagination.vue +0 -397
- package/ui-cv/cv-popup/cv-popup.vue +0 -429
- package/ui-cv/cv-popup-message/cv-popup-message.vue +0 -143
- package/ui-cv/cv-row/cv-row.vue +0 -157
- package/ui-cv/cv-search-bar/cv-search-bar.vue +0 -280
- package/ui-cv/cv-steps/cv-steps.vue +0 -293
- package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +0 -255
- package/ui-cv/cv-table/cv-table.vue +0 -460
- package/ui-cv/cv-tag/cv-tag.vue +0 -276
- package/ui-cv/cv-tbody/cv-tbody.vue +0 -28
- package/ui-cv/cv-td/cv-td.vue +0 -93
- package/ui-cv/cv-th/cv-th.vue +0 -270
- package/ui-cv/cv-thead/cv-thead.vue +0 -114
- package/ui-cv/cv-title/cv-title.vue +0 -168
- package/ui-cv/cv-tr/cv-tr.vue +0 -166
- package/ui-cv/cv-transition/cv-transition.vue +0 -279
|
@@ -53,7 +53,7 @@ if (Object.assign) {
|
|
|
53
53
|
assign = Object.assign;
|
|
54
54
|
} else {
|
|
55
55
|
// 使用polyfill
|
|
56
|
-
assign = function
|
|
56
|
+
assign = function(target, varArgs) {
|
|
57
57
|
if (target == null) {
|
|
58
58
|
throw new TypeError('Cannot convert undefined or null to object');
|
|
59
59
|
}
|
|
@@ -69,7 +69,7 @@ if (Object.assign) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return to;
|
|
72
|
-
}
|
|
72
|
+
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
var util = {
|
|
@@ -87,7 +87,7 @@ var util = {
|
|
|
87
87
|
return Math.abs(num1 - num2) < 1e-10;
|
|
88
88
|
},
|
|
89
89
|
isSameSign: function isSameSign(num1, num2) {
|
|
90
|
-
return
|
|
90
|
+
return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
|
|
91
91
|
},
|
|
92
92
|
isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
|
|
93
93
|
return this.isSameSign(p1.x, p2.x);
|
|
@@ -119,7 +119,7 @@ function getH5Offset(e) {
|
|
|
119
119
|
// hex 转 rgba
|
|
120
120
|
function hexToRgb(hexValue, opc) {
|
|
121
121
|
var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
122
|
-
var hex = hexValue.replace(rgx, function
|
|
122
|
+
var hex = hexValue.replace(rgx, function(m, r, g, b) {
|
|
123
123
|
return r + r + g + g + b + b;
|
|
124
124
|
});
|
|
125
125
|
var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
@@ -181,7 +181,7 @@ function calCandleMA(dayArr, nameArr, colorArr, kdata) {
|
|
|
181
181
|
|
|
182
182
|
function calValidDistance(distance, chartData, config, opts) {
|
|
183
183
|
var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
|
|
184
|
-
var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length
|
|
184
|
+
var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length-1);
|
|
185
185
|
var validDistance = distance;
|
|
186
186
|
if (distance >= 0) {
|
|
187
187
|
validDistance = 0;
|
|
@@ -226,11 +226,12 @@ function calRotateTranslate(x, y, h) {
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
function createCurveControlPoints(points, i) {
|
|
229
|
+
|
|
229
230
|
function isNotMiddlePoint(points, i) {
|
|
230
231
|
if (points[i - 1] && points[i + 1]) {
|
|
231
|
-
return (
|
|
232
|
-
points[
|
|
233
|
-
|
|
232
|
+
return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y,
|
|
233
|
+
points[
|
|
234
|
+
i + 1].y);
|
|
234
235
|
} else {
|
|
235
236
|
return false;
|
|
236
237
|
}
|
|
@@ -304,7 +305,7 @@ function avoidCollision(obj, target) {
|
|
|
304
305
|
|
|
305
306
|
function fillSeries(series, opts, config) {
|
|
306
307
|
var index = 0;
|
|
307
|
-
return series.map(function
|
|
308
|
+
return series.map(function(item) {
|
|
308
309
|
if (!item.color) {
|
|
309
310
|
item.color = config.colors[index];
|
|
310
311
|
index = (index + 1) % config.colors.length;
|
|
@@ -312,28 +313,28 @@ function fillSeries(series, opts, config) {
|
|
|
312
313
|
if (!item.type) {
|
|
313
314
|
item.type = opts.type;
|
|
314
315
|
}
|
|
315
|
-
if (typeof item.show ==
|
|
316
|
+
if (typeof item.show == "undefined") {
|
|
316
317
|
item.show = true;
|
|
317
318
|
}
|
|
318
319
|
if (!item.type) {
|
|
319
320
|
item.type = opts.type;
|
|
320
321
|
}
|
|
321
322
|
if (!item.pointShape) {
|
|
322
|
-
item.pointShape =
|
|
323
|
+
item.pointShape = "circle";
|
|
323
324
|
}
|
|
324
325
|
if (!item.legendShape) {
|
|
325
326
|
switch (item.type) {
|
|
326
327
|
case 'line':
|
|
327
|
-
item.legendShape =
|
|
328
|
+
item.legendShape = "line";
|
|
328
329
|
break;
|
|
329
330
|
case 'column':
|
|
330
|
-
item.legendShape =
|
|
331
|
+
item.legendShape = "rect";
|
|
331
332
|
break;
|
|
332
333
|
case 'area':
|
|
333
|
-
item.legendShape =
|
|
334
|
+
item.legendShape = "triangle";
|
|
334
335
|
break;
|
|
335
336
|
default:
|
|
336
|
-
item.legendShape =
|
|
337
|
+
item.legendShape = "circle";
|
|
337
338
|
}
|
|
338
339
|
}
|
|
339
340
|
return item;
|
|
@@ -399,11 +400,11 @@ function measureText(text) {
|
|
|
399
400
|
width += 10;
|
|
400
401
|
}
|
|
401
402
|
}
|
|
402
|
-
return
|
|
403
|
+
return width * fontSize / 10;
|
|
403
404
|
}
|
|
404
405
|
|
|
405
406
|
function dataCombine(series) {
|
|
406
|
-
return series.reduce(function
|
|
407
|
+
return series.reduce(function(a, b) {
|
|
407
408
|
return (a.data ? a.data : a).concat(b.data);
|
|
408
409
|
}, []);
|
|
409
410
|
}
|
|
@@ -418,7 +419,7 @@ function dataCombineStack(series, len) {
|
|
|
418
419
|
sum[j] += series[i].data[j];
|
|
419
420
|
}
|
|
420
421
|
}
|
|
421
|
-
return series.reduce(function
|
|
422
|
+
return series.reduce(function(a, b) {
|
|
422
423
|
return (a.data ? a.data : a).concat(b.data).concat(sum);
|
|
423
424
|
}, []);
|
|
424
425
|
}
|
|
@@ -428,13 +429,11 @@ function getTouches(touches, opts, e) {
|
|
|
428
429
|
if (touches.clientX) {
|
|
429
430
|
if (opts.rotate) {
|
|
430
431
|
y = opts.height - touches.clientX * opts.pixelRatio;
|
|
431
|
-
x =
|
|
432
|
-
(touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pixelRatio / 2) * (opts.pixelRatio - 1)) *
|
|
432
|
+
x = (touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pixelRatio / 2) * (opts.pixelRatio - 1)) *
|
|
433
433
|
opts.pixelRatio;
|
|
434
434
|
} else {
|
|
435
435
|
x = touches.clientX * opts.pixelRatio;
|
|
436
|
-
y =
|
|
437
|
-
(touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pixelRatio / 2) * (opts.pixelRatio - 1)) *
|
|
436
|
+
y = (touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pixelRatio / 2) * (opts.pixelRatio - 1)) *
|
|
438
437
|
opts.pixelRatio;
|
|
439
438
|
}
|
|
440
439
|
} else {
|
|
@@ -449,7 +448,7 @@ function getTouches(touches, opts, e) {
|
|
|
449
448
|
return {
|
|
450
449
|
x: x,
|
|
451
450
|
y: y
|
|
452
|
-
}
|
|
451
|
+
}
|
|
453
452
|
}
|
|
454
453
|
|
|
455
454
|
function getSeriesDataItem(series, index) {
|
|
@@ -473,20 +472,20 @@ function getSeriesDataItem(series, index) {
|
|
|
473
472
|
}
|
|
474
473
|
|
|
475
474
|
function getMaxTextListLength(list) {
|
|
476
|
-
var lengthList = list.map(function
|
|
475
|
+
var lengthList = list.map(function(item) {
|
|
477
476
|
return measureText(item);
|
|
478
477
|
});
|
|
479
478
|
return Math.max.apply(null, lengthList);
|
|
480
479
|
}
|
|
481
480
|
|
|
482
481
|
function getRadarCoordinateSeries(length) {
|
|
483
|
-
var eachAngle =
|
|
482
|
+
var eachAngle = 2 * Math.PI / length;
|
|
484
483
|
var CoordinateSeries = [];
|
|
485
484
|
for (var i = 0; i < length; i++) {
|
|
486
485
|
CoordinateSeries.push(eachAngle * i);
|
|
487
486
|
}
|
|
488
487
|
|
|
489
|
-
return CoordinateSeries.map(function
|
|
488
|
+
return CoordinateSeries.map(function(item) {
|
|
490
489
|
return -1 * item + Math.PI / 2;
|
|
491
490
|
});
|
|
492
491
|
}
|
|
@@ -494,7 +493,7 @@ function getRadarCoordinateSeries(length) {
|
|
|
494
493
|
function getToolTipData(seriesData, calPoints, index, categories) {
|
|
495
494
|
var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
496
495
|
|
|
497
|
-
var textList = seriesData.map(function
|
|
496
|
+
var textList = seriesData.map(function(item) {
|
|
498
497
|
return {
|
|
499
498
|
text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data,
|
|
500
499
|
color: item.color
|
|
@@ -525,14 +524,14 @@ function getToolTipData(seriesData, calPoints, index, categories) {
|
|
|
525
524
|
|
|
526
525
|
function getMixToolTipData(seriesData, calPoints, index, categories) {
|
|
527
526
|
var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
528
|
-
var textList = seriesData.map(function
|
|
527
|
+
var textList = seriesData.map(function(item) {
|
|
529
528
|
return {
|
|
530
529
|
text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data,
|
|
531
530
|
color: item.color,
|
|
532
531
|
disableLegend: item.disableLegend ? true : false
|
|
533
532
|
};
|
|
534
533
|
});
|
|
535
|
-
textList = textList.filter(function
|
|
534
|
+
textList = textList.filter(function(item) {
|
|
536
535
|
if (item.disableLegend !== true) {
|
|
537
536
|
return item;
|
|
538
537
|
}
|
|
@@ -572,7 +571,7 @@ function getCandleToolTipData(series, seriesData, calPoints, index, categories,
|
|
|
572
571
|
color: null
|
|
573
572
|
};
|
|
574
573
|
textList.push(text0);
|
|
575
|
-
seriesData.map(function
|
|
574
|
+
seriesData.map(function(item) {
|
|
576
575
|
if (index == 0 && item.data[1] - item.data[0] < 0) {
|
|
577
576
|
color[1] = downColor;
|
|
578
577
|
} else {
|
|
@@ -629,7 +628,7 @@ function filterSeries(series) {
|
|
|
629
628
|
let tempSeries = [];
|
|
630
629
|
for (let i = 0; i < series.length; i++) {
|
|
631
630
|
if (series[i].show == true) {
|
|
632
|
-
tempSeries.push(series[i])
|
|
631
|
+
tempSeries.push(series[i])
|
|
633
632
|
}
|
|
634
633
|
}
|
|
635
634
|
return tempSeries;
|
|
@@ -639,11 +638,11 @@ function findCurrentIndex(currentPoints, xAxisPoints, opts, config) {
|
|
|
639
638
|
var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
640
639
|
var currentIndex = -1;
|
|
641
640
|
var spacing = 0;
|
|
642
|
-
if
|
|
643
|
-
spacing = opts.chartData.eachSpacing
|
|
641
|
+
if((opts.type=='line' || opts.type=='area') && opts.xAxis.boundaryGap=='justify'){
|
|
642
|
+
spacing = opts.chartData.eachSpacing/2;
|
|
644
643
|
}
|
|
645
644
|
if (isInExactChartArea(currentPoints, opts, config)) {
|
|
646
|
-
xAxisPoints.forEach(function
|
|
645
|
+
xAxisPoints.forEach(function(item, index) {
|
|
647
646
|
if (currentPoints.x + offset + spacing > item) {
|
|
648
647
|
currentIndex = index;
|
|
649
648
|
}
|
|
@@ -674,25 +673,16 @@ function findLegendIndex(currentPoints, legendData, opts) {
|
|
|
674
673
|
}
|
|
675
674
|
|
|
676
675
|
function isInExactLegendArea(currentPoints, area) {
|
|
677
|
-
return
|
|
678
|
-
currentPoints.
|
|
679
|
-
currentPoints.x < area.end.x &&
|
|
680
|
-
currentPoints.y > area.start.y &&
|
|
681
|
-
currentPoints.y < area.end.y
|
|
682
|
-
);
|
|
676
|
+
return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y &&
|
|
677
|
+
currentPoints.y < area.end.y;
|
|
683
678
|
}
|
|
684
679
|
|
|
685
680
|
function isInExactChartArea(currentPoints, opts, config) {
|
|
686
|
-
return
|
|
687
|
-
currentPoints.x < opts.width - opts.area[1] + 10 &&
|
|
688
|
-
currentPoints.x > opts.area[3] - 10 &&
|
|
689
|
-
currentPoints.y > opts.area[0] &&
|
|
690
|
-
currentPoints.y < opts.height - opts.area[2]
|
|
691
|
-
);
|
|
681
|
+
return currentPoints.x < opts.width - opts.area[1] + 10 && currentPoints.x > opts.area[3] -10 && currentPoints.y > opts.area[0] && currentPoints.y < opts.height - opts.area[2];
|
|
692
682
|
}
|
|
693
683
|
|
|
694
684
|
function findRadarChartCurrentIndex(currentPoints, radarData, count) {
|
|
695
|
-
var eachAngleArea =
|
|
685
|
+
var eachAngleArea = 2 * Math.PI / count;
|
|
696
686
|
var currentIndex = -1;
|
|
697
687
|
if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
|
|
698
688
|
var fixAngle = function fixAngle(angle) {
|
|
@@ -711,19 +701,20 @@ function findRadarChartCurrentIndex(currentPoints, radarData, count) {
|
|
|
711
701
|
angle += 2 * Math.PI;
|
|
712
702
|
}
|
|
713
703
|
|
|
714
|
-
var angleList = radarData.angleList.map(function
|
|
704
|
+
var angleList = radarData.angleList.map(function(item) {
|
|
715
705
|
item = fixAngle(-1 * item);
|
|
716
706
|
|
|
717
707
|
return item;
|
|
718
708
|
});
|
|
719
709
|
|
|
720
|
-
angleList.forEach(function
|
|
710
|
+
angleList.forEach(function(item, index) {
|
|
721
711
|
var rangeStart = fixAngle(item - eachAngleArea / 2);
|
|
722
712
|
var rangeEnd = fixAngle(item + eachAngleArea / 2);
|
|
723
713
|
if (rangeEnd < rangeStart) {
|
|
724
714
|
rangeEnd += 2 * Math.PI;
|
|
725
715
|
}
|
|
726
|
-
if (
|
|
716
|
+
if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <=
|
|
717
|
+
rangeEnd) {
|
|
727
718
|
currentIndex = index;
|
|
728
719
|
}
|
|
729
720
|
});
|
|
@@ -736,12 +727,7 @@ function findFunnelChartCurrentIndex(currentPoints, funnelData) {
|
|
|
736
727
|
var currentIndex = -1;
|
|
737
728
|
for (var i = 0, len = funnelData.series.length; i < len; i++) {
|
|
738
729
|
var item = funnelData.series[i];
|
|
739
|
-
if (
|
|
740
|
-
currentPoints.x > item.funnelArea[0] &&
|
|
741
|
-
currentPoints.x < item.funnelArea[2] &&
|
|
742
|
-
currentPoints.y > item.funnelArea[1] &&
|
|
743
|
-
currentPoints.y < item.funnelArea[3]
|
|
744
|
-
) {
|
|
730
|
+
if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
|
|
745
731
|
currentIndex = i;
|
|
746
732
|
break;
|
|
747
733
|
}
|
|
@@ -753,12 +739,7 @@ function findWordChartCurrentIndex(currentPoints, wordData) {
|
|
|
753
739
|
var currentIndex = -1;
|
|
754
740
|
for (var i = 0, len = wordData.length; i < len; i++) {
|
|
755
741
|
var item = wordData[i];
|
|
756
|
-
if (
|
|
757
|
-
currentPoints.x > item.area[0] &&
|
|
758
|
-
currentPoints.x < item.area[2] &&
|
|
759
|
-
currentPoints.y > item.area[1] &&
|
|
760
|
-
currentPoints.y < item.area[3]
|
|
761
|
-
) {
|
|
742
|
+
if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
|
|
762
743
|
currentIndex = i;
|
|
763
744
|
break;
|
|
764
745
|
}
|
|
@@ -768,13 +749,13 @@ function findWordChartCurrentIndex(currentPoints, wordData) {
|
|
|
768
749
|
|
|
769
750
|
function findMapChartCurrentIndex(currentPoints, opts) {
|
|
770
751
|
var currentIndex = -1;
|
|
771
|
-
var cData
|
|
772
|
-
var data
|
|
773
|
-
var tmp
|
|
774
|
-
var poi
|
|
752
|
+
var cData=opts.chartData.mapData;
|
|
753
|
+
var data=opts.series;
|
|
754
|
+
var tmp=pointToCoordinate(currentPoints.y, currentPoints.x,cData.bounds,cData.scale,cData.xoffset,cData.yoffset);
|
|
755
|
+
var poi=[tmp.x, tmp.y];
|
|
775
756
|
for (var i = 0, len = data.length; i < len; i++) {
|
|
776
757
|
var item = data[i].geometry.coordinates;
|
|
777
|
-
if
|
|
758
|
+
if(isPoiWithinPoly(poi,item)){
|
|
778
759
|
currentIndex = i;
|
|
779
760
|
break;
|
|
780
761
|
}
|
|
@@ -806,7 +787,7 @@ function isInExactPieChartArea(currentPoints, center, radius) {
|
|
|
806
787
|
function splitPoints(points) {
|
|
807
788
|
var newPoints = [];
|
|
808
789
|
var items = [];
|
|
809
|
-
points.forEach(function
|
|
790
|
+
points.forEach(function(item, index) {
|
|
810
791
|
if (item !== null) {
|
|
811
792
|
items.push(item);
|
|
812
793
|
} else {
|
|
@@ -915,7 +896,7 @@ function calLegendData(series, opts, config, chartData) {
|
|
|
915
896
|
legendData.area.start.y = (opts.height - legendData.area.height) / 2;
|
|
916
897
|
legendData.area.end.y = (opts.height + legendData.area.height) / 2;
|
|
917
898
|
}
|
|
918
|
-
let lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
|
|
899
|
+
let lineNum = len % maxLength === 0 ? len / maxLength : Math.floor((len / maxLength) + 1);
|
|
919
900
|
let currentRow = [];
|
|
920
901
|
for (let i = 0; i < lineNum; i++) {
|
|
921
902
|
let temp = series.slice(i * maxLength, i * maxLength + maxLength);
|
|
@@ -937,7 +918,7 @@ function calLegendData(series, opts, config, chartData) {
|
|
|
937
918
|
legendData.widthArr.push(maxWidth);
|
|
938
919
|
legendData.heightArr.push(item.length * lineHeight + padding * 2);
|
|
939
920
|
}
|
|
940
|
-
let legendWidth = 0
|
|
921
|
+
let legendWidth = 0
|
|
941
922
|
for (let i = 0; i < legendData.widthArr.length; i++) {
|
|
942
923
|
legendWidth += legendData.widthArr[i];
|
|
943
924
|
}
|
|
@@ -973,13 +954,13 @@ function calCategoriesData(categories, opts, config, eachSpacing) {
|
|
|
973
954
|
angle: 0,
|
|
974
955
|
xAxisHeight: config.xAxisHeight
|
|
975
956
|
};
|
|
976
|
-
var categoriesTextLenth = categories.map(function
|
|
957
|
+
var categoriesTextLenth = categories.map(function(item) {
|
|
977
958
|
return measureText(item);
|
|
978
959
|
});
|
|
979
960
|
var maxTextLength = Math.max.apply(this, categoriesTextLenth);
|
|
980
961
|
|
|
981
962
|
if (opts.xAxis.rotateLabel == true && maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) {
|
|
982
|
-
result.angle =
|
|
963
|
+
result.angle = 45 * Math.PI / 180;
|
|
983
964
|
result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle);
|
|
984
965
|
}
|
|
985
966
|
return result;
|
|
@@ -998,16 +979,13 @@ function getRadarDataPoints(angleList, center, radius, series, opts) {
|
|
|
998
979
|
let listItem = {};
|
|
999
980
|
listItem.color = each.color;
|
|
1000
981
|
listItem.data = [];
|
|
1001
|
-
each.data.forEach(function
|
|
982
|
+
each.data.forEach(function(item, index) {
|
|
1002
983
|
let tmp = {};
|
|
1003
984
|
tmp.angle = angleList[index];
|
|
1004
985
|
|
|
1005
986
|
tmp.proportion = item / maxData;
|
|
1006
|
-
tmp.position = convertCoordinateOrigin(
|
|
1007
|
-
|
|
1008
|
-
radius * tmp.proportion * process * Math.sin(tmp.angle),
|
|
1009
|
-
center
|
|
1010
|
-
);
|
|
987
|
+
tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion *
|
|
988
|
+
process * Math.sin(tmp.angle), center);
|
|
1011
989
|
listItem.data.push(tmp);
|
|
1012
990
|
});
|
|
1013
991
|
|
|
@@ -1031,9 +1009,9 @@ function getPieDataPoints(series, radius) {
|
|
|
1031
1009
|
let item = series[i];
|
|
1032
1010
|
item.data = item.data === null ? 0 : item.data;
|
|
1033
1011
|
if (count === 0) {
|
|
1034
|
-
item._proportion_ =
|
|
1012
|
+
item._proportion_ = 1 / series.length * process;
|
|
1035
1013
|
} else {
|
|
1036
|
-
item._proportion_ =
|
|
1014
|
+
item._proportion_ = item.data / count * process;
|
|
1037
1015
|
}
|
|
1038
1016
|
item._radius_ = radius;
|
|
1039
1017
|
}
|
|
@@ -1048,12 +1026,10 @@ function getPieDataPoints(series, radius) {
|
|
|
1048
1026
|
|
|
1049
1027
|
function getFunnelDataPoints(series, radius) {
|
|
1050
1028
|
var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1051
|
-
series = series.sort(function
|
|
1052
|
-
return parseInt(b.data) - parseInt(a.data);
|
|
1053
|
-
});
|
|
1029
|
+
series = series.sort(function(a,b){return parseInt(b.data)-parseInt(a.data);});
|
|
1054
1030
|
for (let i = 0; i < series.length; i++) {
|
|
1055
|
-
series[i].radius =
|
|
1056
|
-
series[i]._proportion_ = series[i].data
|
|
1031
|
+
series[i].radius = series[i].data/series[0].data*radius*process;
|
|
1032
|
+
series[i]._proportion_ = series[i].data/series[0].data;
|
|
1057
1033
|
}
|
|
1058
1034
|
return series.reverse();
|
|
1059
1035
|
}
|
|
@@ -1079,11 +1055,11 @@ function getRoseDataPoints(series, type, minRadius, radius) {
|
|
|
1079
1055
|
let item = series[i];
|
|
1080
1056
|
item.data = item.data === null ? 0 : item.data;
|
|
1081
1057
|
if (count === 0 || type == 'area') {
|
|
1082
|
-
item._proportion_ =
|
|
1083
|
-
item._rose_proportion_ =
|
|
1058
|
+
item._proportion_ = item.data / count * process;
|
|
1059
|
+
item._rose_proportion_ = 1 / series.length * process;
|
|
1084
1060
|
} else {
|
|
1085
|
-
item._proportion_ =
|
|
1086
|
-
item._rose_proportion_ =
|
|
1061
|
+
item._proportion_ = item.data / count * process;
|
|
1062
|
+
item._rose_proportion_ = item.data / count * process;
|
|
1087
1063
|
}
|
|
1088
1064
|
item._radius_ = minRadius + radiusLength * ((item.data - minData) / (maxData - minData));
|
|
1089
1065
|
}
|
|
@@ -1108,7 +1084,7 @@ function getArcbarDataPoints(series, arcbarOption) {
|
|
|
1108
1084
|
if (arcbarOption.type == 'default') {
|
|
1109
1085
|
if (arcbarOption.endAngle < arcbarOption.startAngle) {
|
|
1110
1086
|
totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
|
|
1111
|
-
} else
|
|
1087
|
+
} else{
|
|
1112
1088
|
totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
|
|
1113
1089
|
}
|
|
1114
1090
|
} else {
|
|
@@ -1183,7 +1159,7 @@ function getPieTextMaxLength(series) {
|
|
|
1183
1159
|
}
|
|
1184
1160
|
|
|
1185
1161
|
function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
|
|
1186
|
-
return points.map(function
|
|
1162
|
+
return points.map(function(item) {
|
|
1187
1163
|
if (item === null) {
|
|
1188
1164
|
return null;
|
|
1189
1165
|
}
|
|
@@ -1201,7 +1177,7 @@ function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
|
|
|
1201
1177
|
}
|
|
1202
1178
|
|
|
1203
1179
|
function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
|
|
1204
|
-
return points.map(function
|
|
1180
|
+
return points.map(function(item) {
|
|
1205
1181
|
if (item === null) {
|
|
1206
1182
|
return null;
|
|
1207
1183
|
}
|
|
@@ -1219,7 +1195,9 @@ function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts,
|
|
|
1219
1195
|
}
|
|
1220
1196
|
|
|
1221
1197
|
function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
|
|
1222
|
-
|
|
1198
|
+
|
|
1199
|
+
return points.map(function(item, indexn) {
|
|
1200
|
+
|
|
1223
1201
|
if (item === null) {
|
|
1224
1202
|
return null;
|
|
1225
1203
|
}
|
|
@@ -1236,18 +1214,18 @@ function getXAxisPoints(categories, opts, config) {
|
|
|
1236
1214
|
var yAxisTotalWidth = config.yAxisWidth + config.yAxisTitleWidth;
|
|
1237
1215
|
var spacingValid = opts.width - opts.area[1] - opts.area[3];
|
|
1238
1216
|
var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
|
|
1239
|
-
if
|
|
1240
|
-
dataCount -=
|
|
1217
|
+
if((opts.type=='line' || opts.type=='area') && dataCount>1 && opts.xAxis.boundaryGap=='justify'){
|
|
1218
|
+
dataCount -=1;
|
|
1241
1219
|
}
|
|
1242
1220
|
var eachSpacing = spacingValid / dataCount;
|
|
1243
1221
|
|
|
1244
1222
|
var xAxisPoints = [];
|
|
1245
1223
|
var startX = opts.area[3];
|
|
1246
1224
|
var endX = opts.width - opts.area[1];
|
|
1247
|
-
categories.forEach(function
|
|
1225
|
+
categories.forEach(function(item, index) {
|
|
1248
1226
|
xAxisPoints.push(startX + index * eachSpacing);
|
|
1249
1227
|
});
|
|
1250
|
-
if
|
|
1228
|
+
if(opts.xAxis.boundaryGap !=='justify'){
|
|
1251
1229
|
if (opts.enableScroll === true) {
|
|
1252
1230
|
xAxisPoints.push(startX + categories.length * eachSpacing);
|
|
1253
1231
|
} else {
|
|
@@ -1266,16 +1244,16 @@ function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing,
|
|
|
1266
1244
|
var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
|
|
1267
1245
|
var points = [];
|
|
1268
1246
|
var validHeight = opts.height - opts.area[0] - opts.area[2];
|
|
1269
|
-
data.forEach(function
|
|
1247
|
+
data.forEach(function(item, index) {
|
|
1270
1248
|
if (item === null) {
|
|
1271
1249
|
points.push(null);
|
|
1272
1250
|
} else {
|
|
1273
1251
|
var cPoints = [];
|
|
1274
|
-
item.forEach(function
|
|
1252
|
+
item.forEach(function(items, indexs) {
|
|
1275
1253
|
var point = {};
|
|
1276
1254
|
point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
|
|
1277
1255
|
var value = items.value || items;
|
|
1278
|
-
var height =
|
|
1256
|
+
var height = validHeight * (value - minRange) / (maxRange - minRange);
|
|
1279
1257
|
height *= process;
|
|
1280
1258
|
point.y = opts.height - Math.round(height) - opts.area[2];
|
|
1281
1259
|
cPoints.push(point);
|
|
@@ -1289,27 +1267,27 @@ function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing,
|
|
|
1289
1267
|
|
|
1290
1268
|
function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
|
|
1291
1269
|
var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
|
|
1292
|
-
var boundaryGap
|
|
1293
|
-
if (opts.type == 'line'
|
|
1294
|
-
boundaryGap
|
|
1270
|
+
var boundaryGap='center';
|
|
1271
|
+
if (opts.type == 'line'||opts.type == 'area'){
|
|
1272
|
+
boundaryGap=opts.xAxis.boundaryGap;
|
|
1295
1273
|
}
|
|
1296
1274
|
var points = [];
|
|
1297
1275
|
var validHeight = opts.height - opts.area[0] - opts.area[2];
|
|
1298
|
-
data.forEach(function
|
|
1276
|
+
data.forEach(function(item, index) {
|
|
1299
1277
|
if (item === null) {
|
|
1300
1278
|
points.push(null);
|
|
1301
1279
|
} else {
|
|
1302
1280
|
var point = {};
|
|
1303
1281
|
point.color = item.color;
|
|
1304
1282
|
point.x = xAxisPoints[index];
|
|
1305
|
-
if
|
|
1283
|
+
if(boundaryGap=='center'){
|
|
1306
1284
|
point.x += Math.round(eachSpacing / 2);
|
|
1307
1285
|
}
|
|
1308
1286
|
var value = item;
|
|
1309
1287
|
if (typeof item === 'object' && item !== null) {
|
|
1310
|
-
value = item.value
|
|
1288
|
+
value = item.value
|
|
1311
1289
|
}
|
|
1312
|
-
var height =
|
|
1290
|
+
var height = validHeight * (value - minRange) / (maxRange - minRange);
|
|
1313
1291
|
height *= process;
|
|
1314
1292
|
point.y = opts.height - Math.round(height) - opts.area[2];
|
|
1315
1293
|
points.push(point);
|
|
@@ -1324,7 +1302,7 @@ function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing,
|
|
|
1324
1302
|
var points = [];
|
|
1325
1303
|
var validHeight = opts.height - opts.area[0] - opts.area[2];
|
|
1326
1304
|
|
|
1327
|
-
data.forEach(function
|
|
1305
|
+
data.forEach(function(item, index) {
|
|
1328
1306
|
if (item === null) {
|
|
1329
1307
|
points.push(null);
|
|
1330
1308
|
} else {
|
|
@@ -1338,11 +1316,11 @@ function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing,
|
|
|
1338
1316
|
value += stackSeries[i].data[index];
|
|
1339
1317
|
}
|
|
1340
1318
|
var value0 = value - item;
|
|
1341
|
-
var height =
|
|
1342
|
-
var height0 =
|
|
1319
|
+
var height = validHeight * (value - minRange) / (maxRange - minRange);
|
|
1320
|
+
var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
|
|
1343
1321
|
} else {
|
|
1344
1322
|
var value = item;
|
|
1345
|
-
var height =
|
|
1323
|
+
var height = validHeight * (value - minRange) / (maxRange - minRange);
|
|
1346
1324
|
var height0 = 0;
|
|
1347
1325
|
}
|
|
1348
1326
|
var heightc = height0;
|
|
@@ -1366,7 +1344,7 @@ function getYAxisTextList(series, opts, config, stack) {
|
|
|
1366
1344
|
}
|
|
1367
1345
|
var sorted = [];
|
|
1368
1346
|
// remove null from data
|
|
1369
|
-
data = data.filter(function
|
|
1347
|
+
data = data.filter(function(item) {
|
|
1370
1348
|
//return item !== null;
|
|
1371
1349
|
if (typeof item === 'object' && item !== null) {
|
|
1372
1350
|
if (Array.isArray(item)) {
|
|
@@ -1378,19 +1356,19 @@ function getYAxisTextList(series, opts, config, stack) {
|
|
|
1378
1356
|
return item !== null;
|
|
1379
1357
|
}
|
|
1380
1358
|
});
|
|
1381
|
-
data.map(function
|
|
1359
|
+
data.map(function(item) {
|
|
1382
1360
|
if (typeof item === 'object') {
|
|
1383
1361
|
if (Array.isArray(item)) {
|
|
1384
|
-
item.map(function
|
|
1362
|
+
item.map(function(subitem) {
|
|
1385
1363
|
sorted.push(subitem);
|
|
1386
|
-
})
|
|
1364
|
+
})
|
|
1387
1365
|
} else {
|
|
1388
1366
|
sorted.push(item.value);
|
|
1389
1367
|
}
|
|
1390
1368
|
} else {
|
|
1391
1369
|
sorted.push(item);
|
|
1392
1370
|
}
|
|
1393
|
-
})
|
|
1371
|
+
})
|
|
1394
1372
|
var minData = 0;
|
|
1395
1373
|
var maxData = 0;
|
|
1396
1374
|
if (sorted.length > 0) {
|
|
@@ -1424,17 +1402,13 @@ function getYAxisTextList(series, opts, config, stack) {
|
|
|
1424
1402
|
|
|
1425
1403
|
function calYAxisData(series, opts, config) {
|
|
1426
1404
|
//堆叠图重算Y轴
|
|
1427
|
-
var columnstyle = assign(
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
type: ''
|
|
1431
|
-
},
|
|
1432
|
-
opts.extra.column
|
|
1433
|
-
);
|
|
1405
|
+
var columnstyle = assign({}, {
|
|
1406
|
+
type: ""
|
|
1407
|
+
}, opts.extra.column);
|
|
1434
1408
|
var ranges = getYAxisTextList(series, opts, config, columnstyle.type);
|
|
1435
1409
|
var yAxisWidth = config.yAxisWidth;
|
|
1436
1410
|
var yAxisFontSize = opts.yAxis.fontSize || config.fontSize;
|
|
1437
|
-
var rangesFormat = ranges.map(function
|
|
1411
|
+
var rangesFormat = ranges.map(function(item) {
|
|
1438
1412
|
item = util.toFixed(item, 6);
|
|
1439
1413
|
item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item;
|
|
1440
1414
|
yAxisWidth = Math.max(yAxisWidth, measureText(item, yAxisFontSize) + 5);
|
|
@@ -1458,7 +1432,7 @@ function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
|
|
|
1458
1432
|
let minVal = ranges[ranges.length - 1];
|
|
1459
1433
|
let minAxis = opts.padding[3];
|
|
1460
1434
|
let maxAxis = opts.padding[1] + spacingValid;
|
|
1461
|
-
let item = maxVal - (
|
|
1435
|
+
let item = maxVal - (maxVal - minVal) * (point - minAxis) / (maxAxis - minAxis);
|
|
1462
1436
|
item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item;
|
|
1463
1437
|
return item;
|
|
1464
1438
|
}
|
|
@@ -1466,7 +1440,7 @@ function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
|
|
|
1466
1440
|
function calMarkLineData(minRange, maxRange, points, opts) {
|
|
1467
1441
|
let spacingValid = opts.height - opts.area[0] - opts.area[2];
|
|
1468
1442
|
for (let i = 0; i < points.length; i++) {
|
|
1469
|
-
let height =
|
|
1443
|
+
let height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
|
|
1470
1444
|
points[i].y = opts.height - Math.round(height) - opts.area[2];
|
|
1471
1445
|
}
|
|
1472
1446
|
return points;
|
|
@@ -1475,21 +1449,21 @@ function calMarkLineData(minRange, maxRange, points, opts) {
|
|
|
1475
1449
|
function contextRotate(context, opts) {
|
|
1476
1450
|
if (opts.rotateLock !== true) {
|
|
1477
1451
|
context.translate(opts.height, 0);
|
|
1478
|
-
context.rotate(
|
|
1452
|
+
context.rotate(90 * Math.PI / 180);
|
|
1479
1453
|
} else if (opts._rotate_ !== true) {
|
|
1480
1454
|
context.translate(opts.height, 0);
|
|
1481
|
-
context.rotate(
|
|
1455
|
+
context.rotate(90 * Math.PI / 180);
|
|
1482
1456
|
opts._rotate_ = true;
|
|
1483
1457
|
}
|
|
1484
1458
|
}
|
|
1485
1459
|
|
|
1486
1460
|
function drawPointShape(points, color, shape, context, opts) {
|
|
1487
1461
|
context.beginPath();
|
|
1488
|
-
context.setStrokeStyle(
|
|
1462
|
+
context.setStrokeStyle("#ffffff");
|
|
1489
1463
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
1490
1464
|
context.setFillStyle(color);
|
|
1491
1465
|
if (shape === 'diamond') {
|
|
1492
|
-
points.forEach(function
|
|
1466
|
+
points.forEach(function(item, index) {
|
|
1493
1467
|
if (item !== null) {
|
|
1494
1468
|
context.moveTo(item.x, item.y - 4.5);
|
|
1495
1469
|
context.lineTo(item.x - 4.5, item.y);
|
|
@@ -1499,21 +1473,21 @@ function drawPointShape(points, color, shape, context, opts) {
|
|
|
1499
1473
|
}
|
|
1500
1474
|
});
|
|
1501
1475
|
} else if (shape === 'circle') {
|
|
1502
|
-
points.forEach(function
|
|
1476
|
+
points.forEach(function(item, index) {
|
|
1503
1477
|
if (item !== null) {
|
|
1504
1478
|
context.moveTo(item.x + 3.5 * opts.pixelRatio, item.y);
|
|
1505
1479
|
context.arc(item.x, item.y, 4 * opts.pixelRatio, 0, 2 * Math.PI, false);
|
|
1506
1480
|
}
|
|
1507
1481
|
});
|
|
1508
1482
|
} else if (shape === 'rect') {
|
|
1509
|
-
points.forEach(function
|
|
1483
|
+
points.forEach(function(item, index) {
|
|
1510
1484
|
if (item !== null) {
|
|
1511
1485
|
context.moveTo(item.x - 3.5, item.y - 3.5);
|
|
1512
1486
|
context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
|
|
1513
1487
|
}
|
|
1514
1488
|
});
|
|
1515
1489
|
} else if (shape === 'triangle') {
|
|
1516
|
-
points.forEach(function
|
|
1490
|
+
points.forEach(function(item, index) {
|
|
1517
1491
|
if (item !== null) {
|
|
1518
1492
|
context.moveTo(item.x, item.y - 4.5);
|
|
1519
1493
|
context.lineTo(item.x - 4.5, item.y + 4.5);
|
|
@@ -1571,22 +1545,24 @@ function drawRingTitle(opts, config, context, center) {
|
|
|
1571
1545
|
function drawPointText(points, series, config, context) {
|
|
1572
1546
|
// 绘制数据文案
|
|
1573
1547
|
var data = series.data;
|
|
1574
|
-
points.forEach(function
|
|
1548
|
+
points.forEach(function(item, index) {
|
|
1575
1549
|
if (item !== null) {
|
|
1576
1550
|
//var formatVal = series.format ? series.format(data[index]) : data[index];
|
|
1577
1551
|
context.beginPath();
|
|
1578
1552
|
context.setFontSize(series.textSize || config.fontSize);
|
|
1579
1553
|
context.setFillStyle(series.textColor || '#666666');
|
|
1580
|
-
var value = data[index]
|
|
1554
|
+
var value = data[index]
|
|
1581
1555
|
if (typeof data[index] === 'object' && data[index] !== null) {
|
|
1582
|
-
value = data[index].value
|
|
1556
|
+
value = data[index].value
|
|
1583
1557
|
}
|
|
1584
1558
|
var formatVal = series.format ? series.format(value) : value;
|
|
1585
|
-
context.fillText(String(formatVal), item.x - measureText(formatVal, series.textSize || config.fontSize) / 2, item.y -
|
|
1559
|
+
context.fillText(String(formatVal), item.x - measureText(formatVal, series.textSize || config.fontSize) / 2, item.y -
|
|
1560
|
+
2);
|
|
1586
1561
|
context.closePath();
|
|
1587
1562
|
context.stroke();
|
|
1588
1563
|
}
|
|
1589
1564
|
});
|
|
1565
|
+
|
|
1590
1566
|
}
|
|
1591
1567
|
|
|
1592
1568
|
function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
|
|
@@ -1621,13 +1597,14 @@ function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, conte
|
|
|
1621
1597
|
}
|
|
1622
1598
|
nowNumber += splitNumber;
|
|
1623
1599
|
}
|
|
1600
|
+
|
|
1624
1601
|
}
|
|
1625
1602
|
|
|
1626
1603
|
function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
|
|
1627
1604
|
var radarOption = opts.extra.radar || {};
|
|
1628
1605
|
radius += config.radarLabelTextMargin;
|
|
1629
1606
|
|
|
1630
|
-
angleList.forEach(function
|
|
1607
|
+
angleList.forEach(function(angle, index) {
|
|
1631
1608
|
var pos = {
|
|
1632
1609
|
x: radius * Math.cos(angle),
|
|
1633
1610
|
y: radius * Math.sin(angle)
|
|
@@ -1647,6 +1624,7 @@ function drawRadarLabel(angleList, radius, centerPosition, opts, config, context
|
|
|
1647
1624
|
context.closePath();
|
|
1648
1625
|
context.stroke();
|
|
1649
1626
|
});
|
|
1627
|
+
|
|
1650
1628
|
}
|
|
1651
1629
|
|
|
1652
1630
|
function drawPieText(series, opts, config, context, radius, center) {
|
|
@@ -1654,10 +1632,10 @@ function drawPieText(series, opts, config, context, radius, center) {
|
|
|
1654
1632
|
var textObjectCollection = [];
|
|
1655
1633
|
var lastTextObject = null;
|
|
1656
1634
|
|
|
1657
|
-
var seriesConvert = series.map(function
|
|
1658
|
-
var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_.toFixed(4) * 100) +
|
|
1659
|
-
if
|
|
1660
|
-
var arc = 2 * Math.PI - (item._start_ +
|
|
1635
|
+
var seriesConvert = series.map(function(item) {
|
|
1636
|
+
var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_.toFixed(4) * 100) +'%';
|
|
1637
|
+
if(item._rose_proportion_) item._proportion_=item._rose_proportion_;
|
|
1638
|
+
var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
|
|
1661
1639
|
var color = item.color;
|
|
1662
1640
|
var radius = item._radius_;
|
|
1663
1641
|
return {
|
|
@@ -1666,7 +1644,7 @@ function drawPieText(series, opts, config, context, radius, center) {
|
|
|
1666
1644
|
color: color,
|
|
1667
1645
|
radius: radius,
|
|
1668
1646
|
textColor: item.textColor,
|
|
1669
|
-
textSize: item.textSize
|
|
1647
|
+
textSize: item.textSize,
|
|
1670
1648
|
};
|
|
1671
1649
|
});
|
|
1672
1650
|
for (let i = 0; i < seriesConvert.length; i++) {
|
|
@@ -1685,12 +1663,9 @@ function drawPieText(series, opts, config, context, radius, center) {
|
|
|
1685
1663
|
let textWidth = measureText(item.text);
|
|
1686
1664
|
let startY = orginY3;
|
|
1687
1665
|
|
|
1688
|
-
if (
|
|
1689
|
-
lastTextObject &&
|
|
1690
|
-
util.isSameXCoordinateArea(lastTextObject.start, {
|
|
1666
|
+
if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
|
|
1691
1667
|
x: orginX3
|
|
1692
|
-
})
|
|
1693
|
-
) {
|
|
1668
|
+
})) {
|
|
1694
1669
|
if (orginX3 > 0) {
|
|
1695
1670
|
startY = Math.min(orginY3, lastTextObject.start.y);
|
|
1696
1671
|
} else if (orginX1 < 0) {
|
|
@@ -1789,17 +1764,10 @@ function drawToolTipSplitLine(offsetX, opts, config, context) {
|
|
|
1789
1764
|
let textX = offsetX - 0.5 * textWidth;
|
|
1790
1765
|
let textY = endY;
|
|
1791
1766
|
context.beginPath();
|
|
1792
|
-
context.setFillStyle(
|
|
1793
|
-
hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity)
|
|
1794
|
-
);
|
|
1767
|
+
context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
|
|
1795
1768
|
context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
|
|
1796
1769
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
1797
|
-
context.rect(
|
|
1798
|
-
textX - config.toolTipPadding,
|
|
1799
|
-
textY,
|
|
1800
|
-
textWidth + 2 * config.toolTipPadding,
|
|
1801
|
-
config.fontSize + 2 * config.toolTipPadding
|
|
1802
|
-
);
|
|
1770
|
+
context.rect(textX - config.toolTipPadding, textY, textWidth + 2 * config.toolTipPadding, config.fontSize + 2 * config.toolTipPadding);
|
|
1803
1771
|
context.closePath();
|
|
1804
1772
|
context.stroke();
|
|
1805
1773
|
context.fill();
|
|
@@ -1814,32 +1782,24 @@ function drawToolTipSplitLine(offsetX, opts, config, context) {
|
|
|
1814
1782
|
}
|
|
1815
1783
|
|
|
1816
1784
|
function drawMarkLine(minRange, maxRange, opts, config, context) {
|
|
1817
|
-
let markLineOption = assign(
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
data: []
|
|
1823
|
-
},
|
|
1824
|
-
opts.extra.markLine
|
|
1825
|
-
);
|
|
1785
|
+
let markLineOption = assign({}, {
|
|
1786
|
+
type: 'solid',
|
|
1787
|
+
dashLength: 4,
|
|
1788
|
+
data: []
|
|
1789
|
+
}, opts.extra.markLine);
|
|
1826
1790
|
let startX = opts.area[3];
|
|
1827
1791
|
let endX = opts.width - opts.padding[1];
|
|
1828
1792
|
let points = calMarkLineData(minRange, maxRange, markLineOption.data, opts);
|
|
1829
1793
|
|
|
1830
1794
|
for (let i = 0; i < points.length; i++) {
|
|
1831
|
-
let item = assign(
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
yAxisIndex: 0
|
|
1840
|
-
},
|
|
1841
|
-
points[i]
|
|
1842
|
-
);
|
|
1795
|
+
let item = assign({}, {
|
|
1796
|
+
lineColor: '#DE4A42',
|
|
1797
|
+
showLabel: false,
|
|
1798
|
+
labelFontColor: '#666666',
|
|
1799
|
+
labelBgColor: '#DFE8FF',
|
|
1800
|
+
labelBgOpacity: 0.8,
|
|
1801
|
+
yAxisIndex: 0
|
|
1802
|
+
}, points[i]);
|
|
1843
1803
|
|
|
1844
1804
|
if (markLineOption.type == 'dash') {
|
|
1845
1805
|
context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
|
|
@@ -1865,12 +1825,7 @@ function drawMarkLine(minRange, maxRange, opts, config, context) {
|
|
|
1865
1825
|
context.setStrokeStyle(item.labelBgColor);
|
|
1866
1826
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
1867
1827
|
context.beginPath();
|
|
1868
|
-
context.rect(
|
|
1869
|
-
bgStartX,
|
|
1870
|
-
textY - 0.5 * config.fontSize - config.toolTipPadding,
|
|
1871
|
-
bgWidth,
|
|
1872
|
-
config.fontSize + 2 * config.toolTipPadding
|
|
1873
|
-
);
|
|
1828
|
+
context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
|
|
1874
1829
|
context.closePath();
|
|
1875
1830
|
context.stroke();
|
|
1876
1831
|
context.fill();
|
|
@@ -1885,14 +1840,10 @@ function drawMarkLine(minRange, maxRange, opts, config, context) {
|
|
|
1885
1840
|
}
|
|
1886
1841
|
|
|
1887
1842
|
function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
|
|
1888
|
-
var toolTipOption = assign(
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
dashLength: 4
|
|
1893
|
-
},
|
|
1894
|
-
opts.extra.tooltip
|
|
1895
|
-
);
|
|
1843
|
+
var toolTipOption = assign({}, {
|
|
1844
|
+
gridType: 'solid',
|
|
1845
|
+
dashLength: 4
|
|
1846
|
+
}, opts.extra.tooltip);
|
|
1896
1847
|
|
|
1897
1848
|
var startX = opts.area[3];
|
|
1898
1849
|
var endX = opts.width - opts.padding[1];
|
|
@@ -1919,17 +1870,10 @@ function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoin
|
|
|
1919
1870
|
let textX = bgStartX + (bgWidth - textWidth) / 2;
|
|
1920
1871
|
let textY = opts.tooltip.offset.y;
|
|
1921
1872
|
context.beginPath();
|
|
1922
|
-
context.setFillStyle(
|
|
1923
|
-
hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity)
|
|
1924
|
-
);
|
|
1873
|
+
context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
|
|
1925
1874
|
context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
|
|
1926
1875
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
1927
|
-
context.rect(
|
|
1928
|
-
bgStartX,
|
|
1929
|
-
textY - 0.5 * config.fontSize - config.toolTipPadding,
|
|
1930
|
-
bgWidth,
|
|
1931
|
-
config.fontSize + 2 * config.toolTipPadding
|
|
1932
|
-
);
|
|
1876
|
+
context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
|
|
1933
1877
|
context.closePath();
|
|
1934
1878
|
context.stroke();
|
|
1935
1879
|
context.fill();
|
|
@@ -1944,14 +1888,10 @@ function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoin
|
|
|
1944
1888
|
}
|
|
1945
1889
|
|
|
1946
1890
|
function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
|
|
1947
|
-
var toolTipOption = assign(
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
activeBgOpacity: 0.08
|
|
1952
|
-
},
|
|
1953
|
-
opts.extra.tooltip
|
|
1954
|
-
);
|
|
1891
|
+
var toolTipOption = assign({}, {
|
|
1892
|
+
activeBgColor: '#000000',
|
|
1893
|
+
activeBgOpacity: 0.08
|
|
1894
|
+
}, opts.extra.tooltip);
|
|
1955
1895
|
var startY = opts.area[0];
|
|
1956
1896
|
var endY = opts.height - opts.area[2];
|
|
1957
1897
|
context.beginPath();
|
|
@@ -1962,15 +1902,11 @@ function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
|
|
|
1962
1902
|
}
|
|
1963
1903
|
|
|
1964
1904
|
function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
|
|
1965
|
-
var toolTipOption = assign(
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
fontColor: '#FFFFFF'
|
|
1971
|
-
},
|
|
1972
|
-
opts.extra.tooltip
|
|
1973
|
-
);
|
|
1905
|
+
var toolTipOption = assign({}, {
|
|
1906
|
+
bgColor: '#000000',
|
|
1907
|
+
bgOpacity: 0.7,
|
|
1908
|
+
fontColor: '#FFFFFF'
|
|
1909
|
+
}, opts.extra.tooltip);
|
|
1974
1910
|
var legendWidth = 4 * opts.pixelRatio;
|
|
1975
1911
|
var legendMarginRight = 5 * opts.pixelRatio;
|
|
1976
1912
|
var arrowWidth = 8 * opts.pixelRatio;
|
|
@@ -1979,15 +1915,12 @@ function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxis
|
|
|
1979
1915
|
drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
|
|
1980
1916
|
}
|
|
1981
1917
|
|
|
1982
|
-
offset = assign(
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
},
|
|
1987
|
-
offset
|
|
1988
|
-
);
|
|
1918
|
+
offset = assign({
|
|
1919
|
+
x: 0,
|
|
1920
|
+
y: 0
|
|
1921
|
+
}, offset);
|
|
1989
1922
|
offset.y -= 8 * opts.pixelRatio;
|
|
1990
|
-
var textWidth = textList.map(function
|
|
1923
|
+
var textWidth = textList.map(function(item) {
|
|
1991
1924
|
return measureText(item.text, config.fontSize);
|
|
1992
1925
|
});
|
|
1993
1926
|
var toolTipWidth = legendWidth + legendMarginRight + 4 * config.toolTipPadding + Math.max.apply(null, textWidth);
|
|
@@ -2002,9 +1935,7 @@ function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxis
|
|
|
2002
1935
|
}
|
|
2003
1936
|
// draw background rect
|
|
2004
1937
|
context.beginPath();
|
|
2005
|
-
context.setFillStyle(
|
|
2006
|
-
hexToRgb(toolTipOption.bgColor || config.toolTipBackground, toolTipOption.bgOpacity || config.toolTipOpacity)
|
|
2007
|
-
);
|
|
1938
|
+
context.setFillStyle(hexToRgb(toolTipOption.bgColor || config.toolTipBackground, toolTipOption.bgOpacity || config.toolTipOpacity));
|
|
2008
1939
|
if (isOverRightBorder) {
|
|
2009
1940
|
context.moveTo(offset.x, offset.y + 10 * opts.pixelRatio);
|
|
2010
1941
|
context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pixelRatio - 5 * opts.pixelRatio);
|
|
@@ -2029,17 +1960,13 @@ function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxis
|
|
|
2029
1960
|
context.fill();
|
|
2030
1961
|
|
|
2031
1962
|
// draw legend
|
|
2032
|
-
textList.forEach(function
|
|
1963
|
+
textList.forEach(function(item, index) {
|
|
2033
1964
|
if (item.color !== null) {
|
|
2034
1965
|
context.beginPath();
|
|
2035
1966
|
context.setFillStyle(item.color);
|
|
2036
1967
|
var startX = offset.x + arrowWidth + 2 * config.toolTipPadding;
|
|
2037
|
-
var startY =
|
|
2038
|
-
|
|
2039
|
-
(config.toolTipLineHeight - config.fontSize) / 2 +
|
|
2040
|
-
config.toolTipLineHeight * index +
|
|
2041
|
-
config.toolTipPadding +
|
|
2042
|
-
1;
|
|
1968
|
+
var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
|
|
1969
|
+
config.toolTipPadding + 1;
|
|
2043
1970
|
if (isOverRightBorder) {
|
|
2044
1971
|
startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding;
|
|
2045
1972
|
}
|
|
@@ -2050,13 +1977,13 @@ function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxis
|
|
|
2050
1977
|
|
|
2051
1978
|
// draw text list
|
|
2052
1979
|
|
|
2053
|
-
textList.forEach(function
|
|
1980
|
+
textList.forEach(function(item, index) {
|
|
2054
1981
|
var startX = offset.x + arrowWidth + 2 * config.toolTipPadding + legendWidth + legendMarginRight;
|
|
2055
1982
|
if (isOverRightBorder) {
|
|
2056
1983
|
startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding + +legendWidth + legendMarginRight;
|
|
2057
1984
|
}
|
|
2058
|
-
var startY =
|
|
2059
|
-
|
|
1985
|
+
var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
|
|
1986
|
+
config.toolTipPadding;
|
|
2060
1987
|
context.beginPath();
|
|
2061
1988
|
context.setFontSize(config.fontSize);
|
|
2062
1989
|
context.setFillStyle(toolTipOption.fontColor);
|
|
@@ -2073,7 +2000,7 @@ function drawYAxisTitle(title, opts, config, context) {
|
|
|
2073
2000
|
context.setFontSize(config.fontSize);
|
|
2074
2001
|
context.setFillStyle(opts.yAxis.titleFontColor || '#333333');
|
|
2075
2002
|
context.translate(0, opts.height);
|
|
2076
|
-
context.rotate(
|
|
2003
|
+
context.rotate(-90 * Math.PI / 180);
|
|
2077
2004
|
context.fillText(title, startX, opts.padding[3] + 0.5 * config.fontSize);
|
|
2078
2005
|
context.closePath();
|
|
2079
2006
|
context.stroke();
|
|
@@ -2086,18 +2013,14 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2086
2013
|
let xAxisData = opts.chartData.xAxisData,
|
|
2087
2014
|
xAxisPoints = xAxisData.xAxisPoints,
|
|
2088
2015
|
eachSpacing = xAxisData.eachSpacing;
|
|
2089
|
-
let columnOption = assign(
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
}
|
|
2098
|
-
},
|
|
2099
|
-
opts.extra.column
|
|
2100
|
-
);
|
|
2016
|
+
let columnOption = assign({}, {
|
|
2017
|
+
type: 'group',
|
|
2018
|
+
width: eachSpacing / 2,
|
|
2019
|
+
meter: {
|
|
2020
|
+
border: 4,
|
|
2021
|
+
fillColor: '#FFFFFF'
|
|
2022
|
+
}
|
|
2023
|
+
}, opts.extra.column);
|
|
2101
2024
|
let minRange = ranges.pop();
|
|
2102
2025
|
let maxRange = ranges.shift();
|
|
2103
2026
|
let calPoints = [];
|
|
@@ -2110,38 +2033,27 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2110
2033
|
drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
|
|
2111
2034
|
}
|
|
2112
2035
|
|
|
2113
|
-
series.forEach(function
|
|
2036
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2114
2037
|
var data = eachSeries.data;
|
|
2115
2038
|
switch (columnOption.type) {
|
|
2116
2039
|
case 'group':
|
|
2117
2040
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2118
|
-
var tooltipPoints = getStackDataPoints(
|
|
2119
|
-
data,
|
|
2120
|
-
minRange,
|
|
2121
|
-
maxRange,
|
|
2122
|
-
xAxisPoints,
|
|
2123
|
-
eachSpacing,
|
|
2124
|
-
opts,
|
|
2125
|
-
config,
|
|
2126
|
-
seriesIndex,
|
|
2127
|
-
series,
|
|
2128
|
-
process
|
|
2129
|
-
);
|
|
2041
|
+
var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
|
|
2130
2042
|
calPoints.push(tooltipPoints);
|
|
2131
2043
|
points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
|
|
2132
|
-
points.forEach(function
|
|
2044
|
+
points.forEach(function(item, index) {
|
|
2133
2045
|
if (item !== null) {
|
|
2134
2046
|
context.beginPath();
|
|
2135
2047
|
context.setStrokeStyle(item.color || eachSeries.color);
|
|
2136
|
-
context.setLineWidth(1)
|
|
2048
|
+
context.setLineWidth(1)
|
|
2137
2049
|
context.setFillStyle(item.color || eachSeries.color);
|
|
2138
2050
|
var startX = item.x - item.width / 2;
|
|
2139
2051
|
var height = opts.height - item.y - opts.area[2];
|
|
2140
|
-
context.moveTo(startX
|
|
2141
|
-
context.lineTo(startX
|
|
2142
|
-
context.lineTo(startX
|
|
2143
|
-
context.lineTo(startX,
|
|
2144
|
-
context.lineTo(startX,
|
|
2052
|
+
context.moveTo(startX-1, item.y);
|
|
2053
|
+
context.lineTo(startX+item.width-2,item.y);
|
|
2054
|
+
context.lineTo(startX+item.width-2,opts.height - opts.area[2]);
|
|
2055
|
+
context.lineTo(startX,opts.height - opts.area[2]);
|
|
2056
|
+
context.lineTo(startX,item.y);
|
|
2145
2057
|
//context.rect(startX, item.y, item.width, height);
|
|
2146
2058
|
context.closePath();
|
|
2147
2059
|
context.stroke();
|
|
@@ -2151,22 +2063,13 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2151
2063
|
break;
|
|
2152
2064
|
case 'stack':
|
|
2153
2065
|
// 绘制堆叠数据图
|
|
2154
|
-
var points = getStackDataPoints(
|
|
2155
|
-
data,
|
|
2156
|
-
minRange,
|
|
2157
|
-
maxRange,
|
|
2158
|
-
xAxisPoints,
|
|
2159
|
-
eachSpacing,
|
|
2160
|
-
opts,
|
|
2161
|
-
config,
|
|
2066
|
+
var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config,
|
|
2162
2067
|
seriesIndex,
|
|
2163
|
-
series,
|
|
2164
|
-
process
|
|
2165
|
-
);
|
|
2068
|
+
series, process);
|
|
2166
2069
|
calPoints.push(points);
|
|
2167
2070
|
points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
|
|
2168
2071
|
|
|
2169
|
-
points.forEach(function
|
|
2072
|
+
points.forEach(function(item, index) {
|
|
2170
2073
|
if (item !== null) {
|
|
2171
2074
|
context.beginPath();
|
|
2172
2075
|
context.setFillStyle(item.color || eachSeries.color);
|
|
@@ -2187,9 +2090,10 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2187
2090
|
// 绘制温度计数据图
|
|
2188
2091
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2189
2092
|
calPoints.push(points);
|
|
2190
|
-
points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meter
|
|
2093
|
+
points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meter
|
|
2094
|
+
.border);
|
|
2191
2095
|
if (seriesIndex == 0) {
|
|
2192
|
-
points.forEach(function
|
|
2096
|
+
points.forEach(function(item, index) {
|
|
2193
2097
|
if (item !== null) {
|
|
2194
2098
|
//画背景颜色
|
|
2195
2099
|
context.beginPath();
|
|
@@ -2214,7 +2118,7 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2214
2118
|
}
|
|
2215
2119
|
});
|
|
2216
2120
|
} else {
|
|
2217
|
-
points.forEach(function
|
|
2121
|
+
points.forEach(function(item, index) {
|
|
2218
2122
|
if (item !== null) {
|
|
2219
2123
|
context.beginPath();
|
|
2220
2124
|
context.setFillStyle(item.color || eachSeries.color);
|
|
@@ -2232,7 +2136,7 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2232
2136
|
});
|
|
2233
2137
|
|
|
2234
2138
|
if (opts.dataLabel !== false && process === 1) {
|
|
2235
|
-
series.forEach(function
|
|
2139
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2236
2140
|
var data = eachSeries.data;
|
|
2237
2141
|
switch (columnOption.type) {
|
|
2238
2142
|
case 'group':
|
|
@@ -2242,18 +2146,9 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2242
2146
|
drawPointText(points, eachSeries, config, context);
|
|
2243
2147
|
break;
|
|
2244
2148
|
case 'stack':
|
|
2245
|
-
var points = getStackDataPoints(
|
|
2246
|
-
data,
|
|
2247
|
-
minRange,
|
|
2248
|
-
maxRange,
|
|
2249
|
-
xAxisPoints,
|
|
2250
|
-
eachSpacing,
|
|
2251
|
-
opts,
|
|
2252
|
-
config,
|
|
2149
|
+
var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config,
|
|
2253
2150
|
seriesIndex,
|
|
2254
|
-
series,
|
|
2255
|
-
process
|
|
2256
|
-
);
|
|
2151
|
+
series, process);
|
|
2257
2152
|
drawPointText(points, eachSeries, config, context);
|
|
2258
2153
|
break;
|
|
2259
2154
|
case 'meter':
|
|
@@ -2277,34 +2172,22 @@ function drawColumnDataPoints(series, opts, config, context) {
|
|
|
2277
2172
|
|
|
2278
2173
|
function drawCandleDataPoints(series, seriesMA, opts, config, context) {
|
|
2279
2174
|
var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
2280
|
-
var candleOption = assign(
|
|
2281
|
-
{},
|
|
2282
|
-
{
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
candleOption.color
|
|
2297
|
-
);
|
|
2298
|
-
candleOption.average = assign(
|
|
2299
|
-
{},
|
|
2300
|
-
{
|
|
2301
|
-
show: false,
|
|
2302
|
-
name: [],
|
|
2303
|
-
day: [],
|
|
2304
|
-
color: config.colors
|
|
2305
|
-
},
|
|
2306
|
-
candleOption.average
|
|
2307
|
-
);
|
|
2175
|
+
var candleOption = assign({}, {
|
|
2176
|
+
color: {},
|
|
2177
|
+
average: {}
|
|
2178
|
+
}, opts.extra.candle);
|
|
2179
|
+
candleOption.color = assign({}, {
|
|
2180
|
+
upLine: '#f04864',
|
|
2181
|
+
upFill: '#f04864',
|
|
2182
|
+
downLine: '#2fc25b',
|
|
2183
|
+
downFill: '#2fc25b'
|
|
2184
|
+
}, candleOption.color);
|
|
2185
|
+
candleOption.average = assign({}, {
|
|
2186
|
+
show: false,
|
|
2187
|
+
name: [],
|
|
2188
|
+
day: [],
|
|
2189
|
+
color: config.colors
|
|
2190
|
+
}, candleOption.average);
|
|
2308
2191
|
opts.extra.candle = candleOption;
|
|
2309
2192
|
|
|
2310
2193
|
let ranges = [].concat(opts.chartData.yAxisData.ranges);
|
|
@@ -2322,13 +2205,13 @@ function drawCandleDataPoints(series, seriesMA, opts, config, context) {
|
|
|
2322
2205
|
}
|
|
2323
2206
|
//画均线
|
|
2324
2207
|
if (candleOption.average.show) {
|
|
2325
|
-
seriesMA.forEach(function
|
|
2208
|
+
seriesMA.forEach(function(eachSeries, seriesIndex) {
|
|
2326
2209
|
var data = eachSeries.data;
|
|
2327
2210
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2328
2211
|
//calPoints.push(points);
|
|
2329
2212
|
var splitPointList = splitPoints(points);
|
|
2330
2213
|
|
|
2331
|
-
splitPointList.forEach(function
|
|
2214
|
+
splitPointList.forEach(function(points, index) {
|
|
2332
2215
|
context.beginPath();
|
|
2333
2216
|
context.setStrokeStyle(eachSeries.color);
|
|
2334
2217
|
context.setLineWidth(1);
|
|
@@ -2337,10 +2220,12 @@ function drawCandleDataPoints(series, seriesMA, opts, config, context) {
|
|
|
2337
2220
|
context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
|
|
2338
2221
|
} else {
|
|
2339
2222
|
context.moveTo(points[0].x, points[0].y);
|
|
2340
|
-
points.forEach(function
|
|
2223
|
+
points.forEach(function(item, index) {
|
|
2341
2224
|
if (index > 0) {
|
|
2342
2225
|
var ctrlPoint = createCurveControlPoints(points, index - 1);
|
|
2343
|
-
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2226
|
+
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2227
|
+
item.x, item
|
|
2228
|
+
.y);
|
|
2344
2229
|
}
|
|
2345
2230
|
});
|
|
2346
2231
|
context.moveTo(points[0].x, points[0].y);
|
|
@@ -2351,14 +2236,14 @@ function drawCandleDataPoints(series, seriesMA, opts, config, context) {
|
|
|
2351
2236
|
});
|
|
2352
2237
|
}
|
|
2353
2238
|
//画K线
|
|
2354
|
-
series.forEach(function
|
|
2239
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2355
2240
|
var data = eachSeries.data;
|
|
2356
2241
|
var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2357
2242
|
calPoints.push(points);
|
|
2358
2243
|
var splitPointList = splitPoints(points);
|
|
2359
2244
|
splitPointList = splitPointList[0];
|
|
2360
2245
|
|
|
2361
|
-
splitPointList.forEach(function
|
|
2246
|
+
splitPointList.forEach(function(points, index) {
|
|
2362
2247
|
context.beginPath();
|
|
2363
2248
|
//如果上涨
|
|
2364
2249
|
if (data[index][1] - data[index][0] > 0) {
|
|
@@ -2411,16 +2296,12 @@ function drawCandleDataPoints(series, seriesMA, opts, config, context) {
|
|
|
2411
2296
|
|
|
2412
2297
|
function drawAreaDataPoints(series, opts, config, context) {
|
|
2413
2298
|
var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
2414
|
-
var areaOption = assign(
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
width: 2
|
|
2421
|
-
},
|
|
2422
|
-
opts.extra.area
|
|
2423
|
-
);
|
|
2299
|
+
var areaOption = assign({},{
|
|
2300
|
+
type: 'straight',
|
|
2301
|
+
opacity: 0.2,
|
|
2302
|
+
addLine: false,
|
|
2303
|
+
width: 2
|
|
2304
|
+
},opts.extra.area);
|
|
2424
2305
|
|
|
2425
2306
|
let ranges = [].concat(opts.chartData.yAxisData.ranges);
|
|
2426
2307
|
let xAxisData = opts.chartData.xAxisData,
|
|
@@ -2437,7 +2318,7 @@ function drawAreaDataPoints(series, opts, config, context) {
|
|
|
2437
2318
|
context.translate(opts._scrollDistance_, 0);
|
|
2438
2319
|
}
|
|
2439
2320
|
|
|
2440
|
-
series.forEach(function
|
|
2321
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2441
2322
|
let data = eachSeries.data;
|
|
2442
2323
|
let points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2443
2324
|
calPoints.push(points);
|
|
@@ -2457,14 +2338,14 @@ function drawAreaDataPoints(series, opts, config, context) {
|
|
|
2457
2338
|
|
|
2458
2339
|
context.moveTo(firstPoint.x, firstPoint.y);
|
|
2459
2340
|
if (areaOption.type === 'curve') {
|
|
2460
|
-
points.forEach(function
|
|
2341
|
+
points.forEach(function(item, index) {
|
|
2461
2342
|
if (index > 0) {
|
|
2462
2343
|
let ctrlPoint = createCurveControlPoints(points, index - 1);
|
|
2463
|
-
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2344
|
+
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x, item.y);
|
|
2464
2345
|
}
|
|
2465
2346
|
});
|
|
2466
2347
|
} else {
|
|
2467
|
-
points.forEach(function
|
|
2348
|
+
points.forEach(function(item, index) {
|
|
2468
2349
|
if (index > 0) {
|
|
2469
2350
|
context.lineTo(item.x, item.y);
|
|
2470
2351
|
}
|
|
@@ -2496,14 +2377,14 @@ function drawAreaDataPoints(series, opts, config, context) {
|
|
|
2496
2377
|
} else {
|
|
2497
2378
|
context.moveTo(points[0].x, points[0].y);
|
|
2498
2379
|
if (areaOption.type === 'curve') {
|
|
2499
|
-
points.forEach(function
|
|
2380
|
+
points.forEach(function(item, index) {
|
|
2500
2381
|
if (index > 0) {
|
|
2501
2382
|
let ctrlPoint = createCurveControlPoints(points, index - 1);
|
|
2502
|
-
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2383
|
+
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x,item.y);
|
|
2503
2384
|
}
|
|
2504
2385
|
});
|
|
2505
2386
|
} else {
|
|
2506
|
-
points.forEach(function
|
|
2387
|
+
points.forEach(function(item, index) {
|
|
2507
2388
|
if (index > 0) {
|
|
2508
2389
|
context.lineTo(item.x, item.y);
|
|
2509
2390
|
}
|
|
@@ -2521,10 +2402,11 @@ function drawAreaDataPoints(series, opts, config, context) {
|
|
|
2521
2402
|
var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
|
|
2522
2403
|
drawPointShape(points, eachSeries.color, shape, context, opts);
|
|
2523
2404
|
}
|
|
2405
|
+
|
|
2524
2406
|
});
|
|
2525
2407
|
|
|
2526
2408
|
if (opts.dataLabel !== false && process === 1) {
|
|
2527
|
-
series.forEach(function
|
|
2409
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2528
2410
|
var data = eachSeries.data;
|
|
2529
2411
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2530
2412
|
drawPointText(points, eachSeries, config, context);
|
|
@@ -2565,13 +2447,13 @@ function drawLineDataPoints(series, opts, config, context) {
|
|
|
2565
2447
|
context.translate(opts._scrollDistance_, 0);
|
|
2566
2448
|
}
|
|
2567
2449
|
|
|
2568
|
-
series.forEach(function
|
|
2450
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2569
2451
|
var data = eachSeries.data;
|
|
2570
2452
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2571
2453
|
calPoints.push(points);
|
|
2572
2454
|
var splitPointList = splitPoints(points);
|
|
2573
2455
|
|
|
2574
|
-
splitPointList.forEach(function
|
|
2456
|
+
splitPointList.forEach(function(points, index) {
|
|
2575
2457
|
context.beginPath();
|
|
2576
2458
|
context.setStrokeStyle(eachSeries.color);
|
|
2577
2459
|
context.setLineWidth(lineOption.width * opts.pixelRatio);
|
|
@@ -2581,14 +2463,16 @@ function drawLineDataPoints(series, opts, config, context) {
|
|
|
2581
2463
|
} else {
|
|
2582
2464
|
context.moveTo(points[0].x, points[0].y);
|
|
2583
2465
|
if (lineOption.type === 'curve') {
|
|
2584
|
-
points.forEach(function
|
|
2466
|
+
points.forEach(function(item, index) {
|
|
2585
2467
|
if (index > 0) {
|
|
2586
2468
|
var ctrlPoint = createCurveControlPoints(points, index - 1);
|
|
2587
|
-
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2469
|
+
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2470
|
+
item.x, item
|
|
2471
|
+
.y);
|
|
2588
2472
|
}
|
|
2589
2473
|
});
|
|
2590
2474
|
} else {
|
|
2591
|
-
points.forEach(function
|
|
2475
|
+
points.forEach(function(item, index) {
|
|
2592
2476
|
if (index > 0) {
|
|
2593
2477
|
context.lineTo(item.x, item.y);
|
|
2594
2478
|
}
|
|
@@ -2607,7 +2491,7 @@ function drawLineDataPoints(series, opts, config, context) {
|
|
|
2607
2491
|
});
|
|
2608
2492
|
|
|
2609
2493
|
if (opts.dataLabel !== false && process === 1) {
|
|
2610
|
-
series.forEach(function
|
|
2494
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2611
2495
|
var data = eachSeries.data;
|
|
2612
2496
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2613
2497
|
drawPointText(points, eachSeries, config, context);
|
|
@@ -2639,7 +2523,7 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2639
2523
|
|
|
2640
2524
|
var columnIndex = 0;
|
|
2641
2525
|
var columnLength = 0;
|
|
2642
|
-
series.forEach(function
|
|
2526
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2643
2527
|
if (eachSeries.type == 'column') {
|
|
2644
2528
|
columnLength += 1;
|
|
2645
2529
|
}
|
|
@@ -2649,7 +2533,7 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2649
2533
|
context.translate(opts._scrollDistance_, 0);
|
|
2650
2534
|
}
|
|
2651
2535
|
|
|
2652
|
-
series.forEach(function
|
|
2536
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2653
2537
|
var data = eachSeries.data;
|
|
2654
2538
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2655
2539
|
calPoints.push(points);
|
|
@@ -2657,20 +2541,20 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2657
2541
|
// 绘制柱状数据图
|
|
2658
2542
|
if (eachSeries.type == 'column') {
|
|
2659
2543
|
points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
|
|
2660
|
-
points.forEach(function
|
|
2544
|
+
points.forEach(function(item, index) {
|
|
2661
2545
|
if (item !== null) {
|
|
2662
2546
|
context.beginPath();
|
|
2663
2547
|
context.setStrokeStyle(item.color || eachSeries.color);
|
|
2664
|
-
context.setLineWidth(1)
|
|
2548
|
+
context.setLineWidth(1)
|
|
2665
2549
|
context.setFillStyle(item.color || eachSeries.color);
|
|
2666
2550
|
var startX = item.x - item.width / 2;
|
|
2667
2551
|
var height = opts.height - item.y - opts.area[2];
|
|
2668
2552
|
context.moveTo(startX, item.y);
|
|
2669
|
-
context.moveTo(startX
|
|
2670
|
-
context.lineTo(startX
|
|
2671
|
-
context.lineTo(startX
|
|
2672
|
-
context.lineTo(startX,
|
|
2673
|
-
context.lineTo(startX,
|
|
2553
|
+
context.moveTo(startX-1, item.y);
|
|
2554
|
+
context.lineTo(startX+item.width-2,item.y);
|
|
2555
|
+
context.lineTo(startX+item.width-2,opts.height - opts.area[2]);
|
|
2556
|
+
context.lineTo(startX,opts.height - opts.area[2]);
|
|
2557
|
+
context.lineTo(startX,item.y);
|
|
2674
2558
|
//context.rect(startX, item.y, item.width, height);
|
|
2675
2559
|
context.closePath();
|
|
2676
2560
|
context.stroke();
|
|
@@ -2698,14 +2582,14 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2698
2582
|
let lastPoint = points[points.length - 1];
|
|
2699
2583
|
context.moveTo(firstPoint.x, firstPoint.y);
|
|
2700
2584
|
if (eachSeries.style === 'curve') {
|
|
2701
|
-
points.forEach(function
|
|
2585
|
+
points.forEach(function(item, index) {
|
|
2702
2586
|
if (index > 0) {
|
|
2703
2587
|
var ctrlPoint = createCurveControlPoints(points, index - 1);
|
|
2704
2588
|
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
|
|
2705
2589
|
}
|
|
2706
2590
|
});
|
|
2707
2591
|
} else {
|
|
2708
|
-
points.forEach(function
|
|
2592
|
+
points.forEach(function(item, index) {
|
|
2709
2593
|
if (index > 0) {
|
|
2710
2594
|
context.lineTo(item.x, item.y);
|
|
2711
2595
|
}
|
|
@@ -2730,7 +2614,7 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2730
2614
|
// 绘制折线数据图
|
|
2731
2615
|
if (eachSeries.type == 'line') {
|
|
2732
2616
|
var splitPointList = splitPoints(points);
|
|
2733
|
-
splitPointList.forEach(function
|
|
2617
|
+
splitPointList.forEach(function(points, index) {
|
|
2734
2618
|
context.beginPath();
|
|
2735
2619
|
context.setStrokeStyle(eachSeries.color);
|
|
2736
2620
|
context.setLineWidth(2 * opts.pixelRatio);
|
|
@@ -2740,14 +2624,16 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2740
2624
|
} else {
|
|
2741
2625
|
context.moveTo(points[0].x, points[0].y);
|
|
2742
2626
|
if (eachSeries.style == 'curve') {
|
|
2743
|
-
points.forEach(function
|
|
2627
|
+
points.forEach(function(item, index) {
|
|
2744
2628
|
if (index > 0) {
|
|
2745
2629
|
var ctrlPoint = createCurveControlPoints(points, index - 1);
|
|
2746
|
-
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2630
|
+
context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
|
|
2631
|
+
item.x,
|
|
2632
|
+
item.y);
|
|
2747
2633
|
}
|
|
2748
2634
|
});
|
|
2749
2635
|
} else {
|
|
2750
|
-
points.forEach(function
|
|
2636
|
+
points.forEach(function(item, index) {
|
|
2751
2637
|
if (index > 0) {
|
|
2752
2638
|
context.lineTo(item.x, item.y);
|
|
2753
2639
|
}
|
|
@@ -2762,7 +2648,7 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2762
2648
|
|
|
2763
2649
|
// 绘制点数据图
|
|
2764
2650
|
if (eachSeries.type == 'point') {
|
|
2765
|
-
points.forEach(function
|
|
2651
|
+
points.forEach(function(pointsa, index) {
|
|
2766
2652
|
if (pointsa) {
|
|
2767
2653
|
context.beginPath();
|
|
2768
2654
|
context.setFillStyle(eachSeries.color);
|
|
@@ -2784,7 +2670,7 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2784
2670
|
});
|
|
2785
2671
|
if (opts.dataLabel !== false && process === 1) {
|
|
2786
2672
|
var columnIndex = 0;
|
|
2787
|
-
series.forEach(function
|
|
2673
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
2788
2674
|
var data = eachSeries.data;
|
|
2789
2675
|
var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
|
|
2790
2676
|
if (eachSeries.type !== 'column') {
|
|
@@ -2794,6 +2680,7 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2794
2680
|
drawPointText(points, eachSeries, config, context);
|
|
2795
2681
|
columnIndex += 1;
|
|
2796
2682
|
}
|
|
2683
|
+
|
|
2797
2684
|
});
|
|
2798
2685
|
}
|
|
2799
2686
|
|
|
@@ -2810,13 +2697,8 @@ function drawMixDataPoints(series, opts, config, context) {
|
|
|
2810
2697
|
|
|
2811
2698
|
function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
|
|
2812
2699
|
var toolTipOption = opts.extra.tooltip || {};
|
|
2813
|
-
if (
|
|
2814
|
-
|
|
2815
|
-
opts.tooltip &&
|
|
2816
|
-
process === 1 &&
|
|
2817
|
-
(opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'candle' || opts.type == 'mix')
|
|
2818
|
-
) {
|
|
2819
|
-
drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
|
|
2700
|
+
if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'candle' || opts.type == 'mix')) {
|
|
2701
|
+
drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints)
|
|
2820
2702
|
}
|
|
2821
2703
|
context.save();
|
|
2822
2704
|
if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
|
|
@@ -2826,17 +2708,19 @@ function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoi
|
|
|
2826
2708
|
drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
|
|
2827
2709
|
}
|
|
2828
2710
|
context.restore();
|
|
2711
|
+
|
|
2829
2712
|
}
|
|
2830
2713
|
|
|
2831
2714
|
function drawXAxis(categories, opts, config, context) {
|
|
2715
|
+
|
|
2832
2716
|
let xAxisData = opts.chartData.xAxisData,
|
|
2833
2717
|
xAxisPoints = xAxisData.xAxisPoints,
|
|
2834
2718
|
startX = xAxisData.startX,
|
|
2835
2719
|
endX = xAxisData.endX,
|
|
2836
2720
|
eachSpacing = xAxisData.eachSpacing;
|
|
2837
|
-
var boundaryGap
|
|
2838
|
-
if (opts.type == 'line'
|
|
2839
|
-
boundaryGap
|
|
2721
|
+
var boundaryGap='center';
|
|
2722
|
+
if (opts.type == 'line'||opts.type == 'area'){
|
|
2723
|
+
boundaryGap=opts.xAxis.boundaryGap;
|
|
2840
2724
|
}
|
|
2841
2725
|
var startY = opts.height - opts.area[2];
|
|
2842
2726
|
var endY = opts.area[0];
|
|
@@ -2846,15 +2730,15 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2846
2730
|
var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
|
|
2847
2731
|
var scrollScreenWidth = endX - startX;
|
|
2848
2732
|
var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
|
|
2849
|
-
var scrollWidth =
|
|
2733
|
+
var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
|
|
2850
2734
|
var scrollLeft = 0;
|
|
2851
2735
|
if (opts._scrollDistance_) {
|
|
2852
|
-
scrollLeft =
|
|
2736
|
+
scrollLeft = -opts._scrollDistance_ * (scrollScreenWidth) / scrollTotalWidth;
|
|
2853
2737
|
}
|
|
2854
2738
|
context.beginPath();
|
|
2855
2739
|
context.setLineCap('round');
|
|
2856
2740
|
context.setLineWidth(6 * opts.pixelRatio);
|
|
2857
|
-
context.setStrokeStyle(opts.xAxis.scrollBackgroundColor ||
|
|
2741
|
+
context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
|
|
2858
2742
|
context.moveTo(startX, scrollY);
|
|
2859
2743
|
context.lineTo(endX, scrollY);
|
|
2860
2744
|
context.stroke();
|
|
@@ -2862,7 +2746,7 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2862
2746
|
context.beginPath();
|
|
2863
2747
|
context.setLineCap('round');
|
|
2864
2748
|
context.setLineWidth(6 * opts.pixelRatio);
|
|
2865
|
-
context.setStrokeStyle(opts.xAxis.scrollColor ||
|
|
2749
|
+
context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
|
|
2866
2750
|
context.moveTo(startX + scrollLeft, scrollY);
|
|
2867
2751
|
context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
|
|
2868
2752
|
context.stroke();
|
|
@@ -2876,15 +2760,16 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2876
2760
|
context.translate(opts._scrollDistance_, 0);
|
|
2877
2761
|
}
|
|
2878
2762
|
|
|
2763
|
+
|
|
2879
2764
|
if (opts.xAxis.disableGrid !== true) {
|
|
2880
|
-
context.setStrokeStyle(opts.xAxis.gridColor ||
|
|
2765
|
+
context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
|
|
2881
2766
|
context.setLineCap('butt');
|
|
2882
2767
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
2883
2768
|
if (opts.xAxis.gridType == 'dash') {
|
|
2884
2769
|
context.setLineDash([opts.xAxis.dashLength, opts.xAxis.dashLength]);
|
|
2885
2770
|
}
|
|
2886
2771
|
if (opts.xAxis.type === 'calibration') {
|
|
2887
|
-
xAxisPoints.forEach(function
|
|
2772
|
+
xAxisPoints.forEach(function(item, index) {
|
|
2888
2773
|
if (index > 0) {
|
|
2889
2774
|
context.beginPath();
|
|
2890
2775
|
context.moveTo(item - eachSpacing / 2, startY);
|
|
@@ -2895,7 +2780,7 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2895
2780
|
});
|
|
2896
2781
|
} else {
|
|
2897
2782
|
opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
|
|
2898
|
-
xAxisPoints.forEach(function
|
|
2783
|
+
xAxisPoints.forEach(function(item, index) {
|
|
2899
2784
|
if (index % opts.xAxis.gridEval == 0) {
|
|
2900
2785
|
context.beginPath();
|
|
2901
2786
|
context.moveTo(item, startY);
|
|
@@ -2907,6 +2792,7 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2907
2792
|
context.setLineDash([]);
|
|
2908
2793
|
}
|
|
2909
2794
|
|
|
2795
|
+
|
|
2910
2796
|
//不绘制X轴
|
|
2911
2797
|
if (opts.xAxis.disabled !== true) {
|
|
2912
2798
|
// 对X轴列表做抽稀处理
|
|
@@ -2917,7 +2803,7 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2917
2803
|
if (opts.xAxis.labelCount) {
|
|
2918
2804
|
//如果设置X轴密度
|
|
2919
2805
|
if (opts.xAxis.itemCount) {
|
|
2920
|
-
maxXAxisListLength = Math.ceil(
|
|
2806
|
+
maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
|
|
2921
2807
|
} else {
|
|
2922
2808
|
maxXAxisListLength = opts.xAxis.labelCount;
|
|
2923
2809
|
}
|
|
@@ -2930,7 +2816,7 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2930
2816
|
let cgLength = categories.length;
|
|
2931
2817
|
for (let i = 0; i < cgLength; i++) {
|
|
2932
2818
|
if (i % ratio !== 0) {
|
|
2933
|
-
newCategories.push(
|
|
2819
|
+
newCategories.push("");
|
|
2934
2820
|
} else {
|
|
2935
2821
|
newCategories.push(categories[i]);
|
|
2936
2822
|
}
|
|
@@ -2939,10 +2825,10 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2939
2825
|
|
|
2940
2826
|
var xAxisFontSize = opts.xAxis.fontSize || config.fontSize;
|
|
2941
2827
|
if (config._xAxisTextAngle_ === 0) {
|
|
2942
|
-
newCategories.forEach(function
|
|
2943
|
-
var offset = -measureText(item, xAxisFontSize) / 2;
|
|
2944
|
-
if
|
|
2945
|
-
offset
|
|
2828
|
+
newCategories.forEach(function(item, index) {
|
|
2829
|
+
var offset = - measureText(item, xAxisFontSize) / 2;
|
|
2830
|
+
if(boundaryGap == 'center'){
|
|
2831
|
+
offset+=eachSpacing / 2;
|
|
2946
2832
|
}
|
|
2947
2833
|
context.beginPath();
|
|
2948
2834
|
context.setFontSize(xAxisFontSize);
|
|
@@ -2951,22 +2837,19 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2951
2837
|
context.closePath();
|
|
2952
2838
|
context.stroke();
|
|
2953
2839
|
});
|
|
2840
|
+
|
|
2954
2841
|
} else {
|
|
2955
|
-
newCategories.forEach(function
|
|
2842
|
+
newCategories.forEach(function(item, index) {
|
|
2956
2843
|
context.save();
|
|
2957
2844
|
context.beginPath();
|
|
2958
2845
|
context.setFontSize(xAxisFontSize);
|
|
2959
2846
|
context.setFillStyle(opts.xAxis.fontColor || '#666666');
|
|
2960
2847
|
var textWidth = measureText(item);
|
|
2961
|
-
var offset = -textWidth;
|
|
2962
|
-
if
|
|
2963
|
-
offset
|
|
2848
|
+
var offset = - textWidth;
|
|
2849
|
+
if(boundaryGap == 'center'){
|
|
2850
|
+
offset+=eachSpacing / 2;
|
|
2964
2851
|
}
|
|
2965
|
-
var _calRotateTranslate = calRotateTranslate(
|
|
2966
|
-
xAxisPoints[index] + eachSpacing / 2,
|
|
2967
|
-
startY + xAxisFontSize / 2 + 5,
|
|
2968
|
-
opts.height
|
|
2969
|
-
),
|
|
2852
|
+
var _calRotateTranslate = calRotateTranslate(xAxisPoints[index] + eachSpacing / 2, startY + xAxisFontSize / 2 + 5, opts.height),
|
|
2970
2853
|
transX = _calRotateTranslate.transX,
|
|
2971
2854
|
transY = _calRotateTranslate.transY;
|
|
2972
2855
|
|
|
@@ -2980,6 +2863,7 @@ function drawXAxis(categories, opts, config, context) {
|
|
|
2980
2863
|
}
|
|
2981
2864
|
}
|
|
2982
2865
|
context.restore();
|
|
2866
|
+
|
|
2983
2867
|
}
|
|
2984
2868
|
|
|
2985
2869
|
function drawYAxisGrid(categories, opts, config, context) {
|
|
@@ -3007,9 +2891,9 @@ function drawYAxisGrid(categories, opts, config, context) {
|
|
|
3007
2891
|
if (opts.yAxis.gridType == 'dash') {
|
|
3008
2892
|
context.setLineDash([opts.yAxis.dashLength, opts.yAxis.dashLength]);
|
|
3009
2893
|
}
|
|
3010
|
-
context.setStrokeStyle(opts.yAxis.gridColor ||
|
|
2894
|
+
context.setStrokeStyle(opts.yAxis.gridColor || "#cccccc");
|
|
3011
2895
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
3012
|
-
points.forEach(function
|
|
2896
|
+
points.forEach(function(item, index) {
|
|
3013
2897
|
context.beginPath();
|
|
3014
2898
|
context.moveTo(startX, item);
|
|
3015
2899
|
context.lineTo(endX, item);
|
|
@@ -3040,7 +2924,7 @@ function drawYAxis(series, opts, config, context) {
|
|
|
3040
2924
|
if (opts._scrollDistance_ < 0) {
|
|
3041
2925
|
context.fillRect(0, 0, startX, fillEndY);
|
|
3042
2926
|
}
|
|
3043
|
-
if
|
|
2927
|
+
if(opts.enableScroll == true){
|
|
3044
2928
|
context.fillRect(endX, 0, opts.width, fillEndY);
|
|
3045
2929
|
}
|
|
3046
2930
|
context.closePath();
|
|
@@ -3052,7 +2936,7 @@ function drawYAxis(series, opts, config, context) {
|
|
|
3052
2936
|
}
|
|
3053
2937
|
|
|
3054
2938
|
var yAxisFontSize = opts.yAxis.fontSize || config.fontSize;
|
|
3055
|
-
rangesFormat.forEach(function
|
|
2939
|
+
rangesFormat.forEach(function(item, index) {
|
|
3056
2940
|
var pos = points[index] ? points[index] : endY;
|
|
3057
2941
|
context.beginPath();
|
|
3058
2942
|
context.setFontSize(yAxisFontSize);
|
|
@@ -3092,7 +2976,7 @@ function drawLegend(series, opts, config, context, chartData) {
|
|
|
3092
2976
|
context.fill();
|
|
3093
2977
|
context.stroke();
|
|
3094
2978
|
|
|
3095
|
-
legendList.forEach(function
|
|
2979
|
+
legendList.forEach(function(itemList, listIndex) {
|
|
3096
2980
|
let width = 0;
|
|
3097
2981
|
let height = 0;
|
|
3098
2982
|
width = legendData.widthArr[listIndex];
|
|
@@ -3169,7 +3053,7 @@ function drawLegend(series, opts, config, context, chartData) {
|
|
|
3169
3053
|
startX += measureText(item.name, fontSize) + itemGap;
|
|
3170
3054
|
item.area[2] = startX;
|
|
3171
3055
|
} else {
|
|
3172
|
-
item.area[2] = startX + measureText(item.name, fontSize) + itemGap
|
|
3056
|
+
item.area[2] = startX + measureText(item.name, fontSize) + itemGap;;
|
|
3173
3057
|
startX -= shapeWidth + shapeRight;
|
|
3174
3058
|
startY += lineHeight;
|
|
3175
3059
|
}
|
|
@@ -3179,20 +3063,16 @@ function drawLegend(series, opts, config, context, chartData) {
|
|
|
3179
3063
|
|
|
3180
3064
|
function drawPieDataPoints(series, opts, config, context) {
|
|
3181
3065
|
var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
3182
|
-
var pieOption = assign(
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
borderColor: '#FFFFFF'
|
|
3193
|
-
},
|
|
3194
|
-
opts.extra.pie
|
|
3195
|
-
);
|
|
3066
|
+
var pieOption = assign({}, {
|
|
3067
|
+
activeOpacity: 0.5,
|
|
3068
|
+
activeRadius: 10 * opts.pixelRatio,
|
|
3069
|
+
offsetAngle: 0,
|
|
3070
|
+
labelWidth: 15 * opts.pixelRatio,
|
|
3071
|
+
ringWidth: 0,
|
|
3072
|
+
border:false,
|
|
3073
|
+
borderWidth:2,
|
|
3074
|
+
borderColor:'#FFFFFF'
|
|
3075
|
+
}, opts.extra.pie);
|
|
3196
3076
|
var centerPosition = {
|
|
3197
3077
|
x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
|
|
3198
3078
|
y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
|
|
@@ -3201,52 +3081,36 @@ function drawPieDataPoints(series, opts, config, context) {
|
|
|
3201
3081
|
config.pieChartLinePadding = pieOption.activeRadius;
|
|
3202
3082
|
}
|
|
3203
3083
|
|
|
3204
|
-
var radius = Math.min(
|
|
3205
|
-
(opts.width - opts.area[1] - opts.area[3]) / 2 -
|
|
3206
|
-
config.pieChartLinePadding -
|
|
3207
|
-
config.pieChartTextPadding -
|
|
3208
|
-
config._pieTextMaxLength_,
|
|
3209
|
-
(opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding
|
|
3210
|
-
);
|
|
3084
|
+
var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
|
|
3211
3085
|
|
|
3212
3086
|
series = getPieDataPoints(series, radius, process);
|
|
3213
3087
|
|
|
3214
3088
|
var activeRadius = pieOption.activeRadius;
|
|
3215
3089
|
|
|
3216
|
-
series = series.map(function
|
|
3217
|
-
eachSeries._start_ += (pieOption.offsetAngle * Math.PI
|
|
3090
|
+
series = series.map(function(eachSeries) {
|
|
3091
|
+
eachSeries._start_ += (pieOption.offsetAngle) * Math.PI / 180;
|
|
3218
3092
|
return eachSeries;
|
|
3219
3093
|
});
|
|
3220
|
-
series.forEach(function
|
|
3094
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
3221
3095
|
if (opts.tooltip) {
|
|
3222
3096
|
if (opts.tooltip.index == seriesIndex) {
|
|
3223
3097
|
context.beginPath();
|
|
3224
3098
|
context.setFillStyle(hexToRgb(eachSeries.color, opts.extra.pie.activeOpacity || 0.5));
|
|
3225
3099
|
context.moveTo(centerPosition.x, centerPosition.y);
|
|
3226
|
-
context.arc(
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
eachSeries._radius_ + activeRadius,
|
|
3230
|
-
eachSeries._start_,
|
|
3231
|
-
eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI
|
|
3232
|
-
);
|
|
3100
|
+
context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_,
|
|
3101
|
+
eachSeries._start_ + 2 *
|
|
3102
|
+
eachSeries._proportion_ * Math.PI);
|
|
3233
3103
|
context.closePath();
|
|
3234
3104
|
context.fill();
|
|
3235
3105
|
}
|
|
3236
3106
|
}
|
|
3237
3107
|
context.beginPath();
|
|
3238
3108
|
context.setLineWidth(pieOption.borderWidth * opts.pixelRatio);
|
|
3239
|
-
context.lineJoin =
|
|
3109
|
+
context.lineJoin = "round";
|
|
3240
3110
|
context.setStrokeStyle(pieOption.borderColor);
|
|
3241
3111
|
context.setFillStyle(eachSeries.color);
|
|
3242
3112
|
context.moveTo(centerPosition.x, centerPosition.y);
|
|
3243
|
-
context.arc(
|
|
3244
|
-
centerPosition.x,
|
|
3245
|
-
centerPosition.y,
|
|
3246
|
-
eachSeries._radius_,
|
|
3247
|
-
eachSeries._start_,
|
|
3248
|
-
eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI
|
|
3249
|
-
);
|
|
3113
|
+
context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
|
|
3250
3114
|
context.closePath();
|
|
3251
3115
|
context.fill();
|
|
3252
3116
|
if (pieOption.border == true) {
|
|
@@ -3294,20 +3158,16 @@ function drawPieDataPoints(series, opts, config, context) {
|
|
|
3294
3158
|
|
|
3295
3159
|
function drawRoseDataPoints(series, opts, config, context) {
|
|
3296
3160
|
var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
3297
|
-
var roseOption = assign(
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
borderColor: '#FFFFFF'
|
|
3308
|
-
},
|
|
3309
|
-
opts.extra.rose
|
|
3310
|
-
);
|
|
3161
|
+
var roseOption = assign({}, {
|
|
3162
|
+
type: 'area',
|
|
3163
|
+
activeOpacity: 0.5,
|
|
3164
|
+
activeRadius: 10 * opts.pixelRatio,
|
|
3165
|
+
offsetAngle: 0,
|
|
3166
|
+
labelWidth: 15 * opts.pixelRatio,
|
|
3167
|
+
border:false,
|
|
3168
|
+
borderWidth:2,
|
|
3169
|
+
borderColor:'#FFFFFF'
|
|
3170
|
+
}, opts.extra.rose);
|
|
3311
3171
|
if (config.pieChartLinePadding == 0) {
|
|
3312
3172
|
config.pieChartLinePadding = roseOption.activeRadius;
|
|
3313
3173
|
}
|
|
@@ -3315,54 +3175,38 @@ function drawRoseDataPoints(series, opts, config, context) {
|
|
|
3315
3175
|
x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
|
|
3316
3176
|
y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
|
|
3317
3177
|
};
|
|
3318
|
-
|
|
3319
|
-
(opts.width - opts.area[1] - opts.area[3]) / 2 -
|
|
3320
|
-
config.pieChartLinePadding -
|
|
3321
|
-
config.pieChartTextPadding -
|
|
3322
|
-
config._pieTextMaxLength_,
|
|
3323
|
-
(opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding
|
|
3324
|
-
);
|
|
3178
|
+
var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
|
|
3325
3179
|
var minRadius = roseOption.minRadius || radius * 0.5;
|
|
3326
3180
|
|
|
3327
3181
|
series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
|
|
3328
3182
|
|
|
3329
3183
|
var activeRadius = roseOption.activeRadius;
|
|
3330
3184
|
|
|
3331
|
-
series = series.map(function
|
|
3332
|
-
eachSeries._start_ += (
|
|
3185
|
+
series = series.map(function(eachSeries) {
|
|
3186
|
+
eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
|
|
3333
3187
|
return eachSeries;
|
|
3334
3188
|
});
|
|
3335
3189
|
|
|
3336
|
-
series.forEach(function
|
|
3190
|
+
series.forEach(function(eachSeries, seriesIndex) {
|
|
3337
3191
|
if (opts.tooltip) {
|
|
3338
3192
|
if (opts.tooltip.index == seriesIndex) {
|
|
3339
3193
|
context.beginPath();
|
|
3340
3194
|
context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
|
|
3341
3195
|
context.moveTo(centerPosition.x, centerPosition.y);
|
|
3342
|
-
context.arc(
|
|
3343
|
-
|
|
3344
|
-
centerPosition.y,
|
|
3345
|
-
activeRadius + eachSeries._radius_,
|
|
3346
|
-
eachSeries._start_,
|
|
3347
|
-
eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI
|
|
3348
|
-
);
|
|
3196
|
+
context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_,
|
|
3197
|
+
eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
|
|
3349
3198
|
context.closePath();
|
|
3350
3199
|
context.fill();
|
|
3351
3200
|
}
|
|
3352
3201
|
}
|
|
3353
3202
|
context.beginPath();
|
|
3354
3203
|
context.setLineWidth(roseOption.borderWidth * opts.pixelRatio);
|
|
3355
|
-
context.lineJoin =
|
|
3204
|
+
context.lineJoin = "round";
|
|
3356
3205
|
context.setStrokeStyle(roseOption.borderColor);
|
|
3357
3206
|
context.setFillStyle(eachSeries.color);
|
|
3358
3207
|
context.moveTo(centerPosition.x, centerPosition.y);
|
|
3359
|
-
context.arc(
|
|
3360
|
-
|
|
3361
|
-
centerPosition.y,
|
|
3362
|
-
eachSeries._radius_,
|
|
3363
|
-
eachSeries._start_,
|
|
3364
|
-
eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI
|
|
3365
|
-
);
|
|
3208
|
+
context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 *
|
|
3209
|
+
eachSeries._rose_proportion_ * Math.PI);
|
|
3366
3210
|
context.closePath();
|
|
3367
3211
|
context.fill();
|
|
3368
3212
|
if (roseOption.border == true) {
|
|
@@ -3393,16 +3237,12 @@ function drawRoseDataPoints(series, opts, config, context) {
|
|
|
3393
3237
|
|
|
3394
3238
|
function drawArcbarDataPoints(series, opts, config, context) {
|
|
3395
3239
|
var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
3396
|
-
var arcbarOption = assign(
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
width: 12 * opts.pixelRatio
|
|
3403
|
-
},
|
|
3404
|
-
opts.extra.arcbar
|
|
3405
|
-
);
|
|
3240
|
+
var arcbarOption = assign({}, {
|
|
3241
|
+
startAngle: 0.75,
|
|
3242
|
+
endAngle: 0.25,
|
|
3243
|
+
type: 'default',
|
|
3244
|
+
width: 12 * opts.pixelRatio
|
|
3245
|
+
}, opts.extra.arcbar);
|
|
3406
3246
|
|
|
3407
3247
|
series = getArcbarDataPoints(series, arcbarOption, process);
|
|
3408
3248
|
var centerPosition = {
|
|
@@ -3419,14 +3259,8 @@ function drawArcbarDataPoints(series, opts, config, context) {
|
|
|
3419
3259
|
context.setLineCap('round');
|
|
3420
3260
|
context.beginPath();
|
|
3421
3261
|
if (arcbarOption.type == 'default') {
|
|
3422
|
-
context.arc(
|
|
3423
|
-
|
|
3424
|
-
centerPosition.y,
|
|
3425
|
-
radius,
|
|
3426
|
-
arcbarOption.startAngle * Math.PI,
|
|
3427
|
-
arcbarOption.endAngle * Math.PI,
|
|
3428
|
-
false
|
|
3429
|
-
);
|
|
3262
|
+
context.arc(centerPosition.x, centerPosition.y, radius, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle *
|
|
3263
|
+
Math.PI, false);
|
|
3430
3264
|
} else {
|
|
3431
3265
|
context.arc(centerPosition.x, centerPosition.y, radius, 0, 2 * Math.PI, false);
|
|
3432
3266
|
}
|
|
@@ -3438,14 +3272,8 @@ function drawArcbarDataPoints(series, opts, config, context) {
|
|
|
3438
3272
|
context.setStrokeStyle(eachSeries.color);
|
|
3439
3273
|
context.setLineCap('round');
|
|
3440
3274
|
context.beginPath();
|
|
3441
|
-
context.arc(
|
|
3442
|
-
|
|
3443
|
-
centerPosition.y,
|
|
3444
|
-
radius,
|
|
3445
|
-
arcbarOption.startAngle * Math.PI,
|
|
3446
|
-
eachSeries._proportion_ * Math.PI,
|
|
3447
|
-
false
|
|
3448
|
-
);
|
|
3275
|
+
context.arc(centerPosition.x, centerPosition.y, radius, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ *
|
|
3276
|
+
Math.PI, false);
|
|
3449
3277
|
context.stroke();
|
|
3450
3278
|
}
|
|
3451
3279
|
|
|
@@ -3460,27 +3288,23 @@ function drawArcbarDataPoints(series, opts, config, context) {
|
|
|
3460
3288
|
|
|
3461
3289
|
function drawGaugeDataPoints(categories, series, opts, config, context) {
|
|
3462
3290
|
var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
3463
|
-
var gaugeOption = assign(
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3291
|
+
var gaugeOption = assign({}, {
|
|
3292
|
+
startAngle: 0.75,
|
|
3293
|
+
endAngle: 0.25,
|
|
3294
|
+
width: 15,
|
|
3295
|
+
splitLine: {
|
|
3296
|
+
fixRadius: 0,
|
|
3297
|
+
splitNumber: 10,
|
|
3468
3298
|
width: 15,
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
width: 15,
|
|
3473
|
-
color: '#FFFFFF',
|
|
3474
|
-
childNumber: 5,
|
|
3475
|
-
childWidth: 5
|
|
3476
|
-
},
|
|
3477
|
-
pointer: {
|
|
3478
|
-
width: 15,
|
|
3479
|
-
color: 'auto'
|
|
3480
|
-
}
|
|
3299
|
+
color: '#FFFFFF',
|
|
3300
|
+
childNumber: 5,
|
|
3301
|
+
childWidth: 5
|
|
3481
3302
|
},
|
|
3482
|
-
|
|
3483
|
-
|
|
3303
|
+
pointer: {
|
|
3304
|
+
width: 15,
|
|
3305
|
+
color: 'auto'
|
|
3306
|
+
}
|
|
3307
|
+
}, opts.extra.gauge);
|
|
3484
3308
|
|
|
3485
3309
|
if (gaugeOption.oldAngle == undefined) {
|
|
3486
3310
|
gaugeOption.oldAngle = gaugeOption.startAngle;
|
|
@@ -3506,14 +3330,8 @@ function drawGaugeDataPoints(categories, series, opts, config, context) {
|
|
|
3506
3330
|
let eachCategories = categories[i];
|
|
3507
3331
|
context.beginPath();
|
|
3508
3332
|
context.setStrokeStyle(eachCategories.color);
|
|
3509
|
-
context.arc(
|
|
3510
|
-
|
|
3511
|
-
centerPosition.y,
|
|
3512
|
-
radius,
|
|
3513
|
-
eachCategories._startAngle_ * Math.PI,
|
|
3514
|
-
eachCategories._endAngle_ * Math.PI,
|
|
3515
|
-
false
|
|
3516
|
-
);
|
|
3333
|
+
context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ *
|
|
3334
|
+
Math.PI, false);
|
|
3517
3335
|
context.stroke();
|
|
3518
3336
|
}
|
|
3519
3337
|
context.save();
|
|
@@ -3600,15 +3418,11 @@ function drawGaugeDataPoints(categories, series, opts, config, context) {
|
|
|
3600
3418
|
|
|
3601
3419
|
function drawRadarDataPoints(series, opts, config, context) {
|
|
3602
3420
|
var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
3603
|
-
var radarOption = assign(
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
opacity: 0.2
|
|
3609
|
-
},
|
|
3610
|
-
opts.extra.radar
|
|
3611
|
-
);
|
|
3421
|
+
var radarOption = assign({},{
|
|
3422
|
+
gridColor: '#cccccc',
|
|
3423
|
+
labelColor: '#666666',
|
|
3424
|
+
opacity: 0.2
|
|
3425
|
+
},opts.extra.radar);
|
|
3612
3426
|
|
|
3613
3427
|
var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
|
|
3614
3428
|
|
|
@@ -3617,10 +3431,8 @@ function drawRadarDataPoints(series, opts, config, context) {
|
|
|
3617
3431
|
y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
|
|
3618
3432
|
};
|
|
3619
3433
|
|
|
3620
|
-
var radius = Math.min(
|
|
3621
|
-
centerPosition.
|
|
3622
|
-
centerPosition.y - config.radarLabelTextMargin
|
|
3623
|
-
);
|
|
3434
|
+
var radius = Math.min(centerPosition.x - (getMaxTextListLength(opts.categories) + config.radarLabelTextMargin),
|
|
3435
|
+
centerPosition.y - config.radarLabelTextMargin);
|
|
3624
3436
|
//TODO逻辑不对
|
|
3625
3437
|
radius -= opts.padding[1];
|
|
3626
3438
|
|
|
@@ -3628,7 +3440,7 @@ function drawRadarDataPoints(series, opts, config, context) {
|
|
|
3628
3440
|
context.beginPath();
|
|
3629
3441
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
3630
3442
|
context.setStrokeStyle(radarOption.gridColor);
|
|
3631
|
-
coordinateAngle.forEach(function
|
|
3443
|
+
coordinateAngle.forEach(function(angle) {
|
|
3632
3444
|
var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
|
|
3633
3445
|
context.moveTo(centerPosition.x, centerPosition.y);
|
|
3634
3446
|
context.lineTo(pos.x, pos.y);
|
|
@@ -3642,12 +3454,9 @@ function drawRadarDataPoints(series, opts, config, context) {
|
|
|
3642
3454
|
context.beginPath();
|
|
3643
3455
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
3644
3456
|
context.setStrokeStyle(radarOption.gridColor);
|
|
3645
|
-
coordinateAngle.forEach(function
|
|
3646
|
-
var pos = convertCoordinateOrigin(
|
|
3647
|
-
|
|
3648
|
-
(radius / config.radarGridCount) * i * Math.sin(angle),
|
|
3649
|
-
centerPosition
|
|
3650
|
-
);
|
|
3457
|
+
coordinateAngle.forEach(function(angle, index) {
|
|
3458
|
+
var pos = convertCoordinateOrigin(radius / config.radarGridCount * i * Math.cos(angle), radius / config.radarGridCount *
|
|
3459
|
+
i * Math.sin(angle), centerPosition);
|
|
3651
3460
|
if (index === 0) {
|
|
3652
3461
|
startPos = pos;
|
|
3653
3462
|
context.moveTo(pos.x, pos.y);
|
|
@@ -3666,11 +3475,11 @@ function drawRadarDataPoints(series, opts, config, context) {
|
|
|
3666
3475
|
|
|
3667
3476
|
var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
|
|
3668
3477
|
|
|
3669
|
-
radarDataPoints.forEach(function
|
|
3478
|
+
radarDataPoints.forEach(function(eachSeries, seriesIndex) {
|
|
3670
3479
|
// 绘制区域数据
|
|
3671
3480
|
context.beginPath();
|
|
3672
3481
|
context.setFillStyle(hexToRgb(eachSeries.color, radarOption.opacity));
|
|
3673
|
-
eachSeries.data.forEach(function
|
|
3482
|
+
eachSeries.data.forEach(function(item, index) {
|
|
3674
3483
|
if (index === 0) {
|
|
3675
3484
|
context.moveTo(item.position.x, item.position.y);
|
|
3676
3485
|
} else {
|
|
@@ -3682,7 +3491,7 @@ function drawRadarDataPoints(series, opts, config, context) {
|
|
|
3682
3491
|
|
|
3683
3492
|
if (opts.dataPointShape !== false) {
|
|
3684
3493
|
var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
|
|
3685
|
-
var points = eachSeries.data.map(function
|
|
3494
|
+
var points = eachSeries.data.map(function(item) {
|
|
3686
3495
|
return item.position;
|
|
3687
3496
|
});
|
|
3688
3497
|
drawPointShape(points, eachSeries.color, shape, context, opts);
|
|
@@ -3699,168 +3508,139 @@ function drawRadarDataPoints(series, opts, config, context) {
|
|
|
3699
3508
|
}
|
|
3700
3509
|
|
|
3701
3510
|
function normalInt(min, max, iter) {
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
return (
|
|
3708
|
-
|
|
3709
|
-
(arr.reduce(function (i, j) {
|
|
3710
|
-
return i + j;
|
|
3711
|
-
}) /
|
|
3712
|
-
iter) *
|
|
3713
|
-
(max - min)
|
|
3714
|
-
) + min
|
|
3715
|
-
);
|
|
3716
|
-
}
|
|
3511
|
+
iter = iter==0?1:iter;
|
|
3512
|
+
var arr = [];
|
|
3513
|
+
for (var i = 0; i < iter; i++) {
|
|
3514
|
+
arr[i] = Math.random();
|
|
3515
|
+
};
|
|
3516
|
+
return Math.floor(arr.reduce(function(i,j){return i+j})/iter*(max-min))+min;
|
|
3517
|
+
};
|
|
3717
3518
|
|
|
3718
|
-
function collisionNew(area,
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3519
|
+
function collisionNew(area,points,width,height){
|
|
3520
|
+
var isIn=false;
|
|
3521
|
+
for(let i=0;i<points.length;i++){
|
|
3522
|
+
if(points[i].area){
|
|
3523
|
+
if(area[3]<points[i].area[1]||area[0]>points[i].area[2]||area[1]>points[i].area[3]||area[2]<points[i].area[0]){
|
|
3524
|
+
if(area[0]<0 || area[1]<0 || area[2]>width || area[3]>height){
|
|
3525
|
+
isIn=true;
|
|
3526
|
+
break;
|
|
3527
|
+
}else{
|
|
3528
|
+
isIn=false;
|
|
3529
|
+
}
|
|
3530
|
+
}else{
|
|
3531
|
+
isIn=true;
|
|
3730
3532
|
break;
|
|
3731
|
-
} else {
|
|
3732
|
-
isIn = false;
|
|
3733
3533
|
}
|
|
3734
|
-
} else {
|
|
3735
|
-
isIn = true;
|
|
3736
|
-
break;
|
|
3737
3534
|
}
|
|
3738
3535
|
}
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
}
|
|
3536
|
+
return isIn;
|
|
3537
|
+
};
|
|
3742
3538
|
|
|
3743
3539
|
function getBoundingBox(data) {
|
|
3744
|
-
var bounds = {},
|
|
3745
|
-
coords;
|
|
3540
|
+
var bounds = {}, coords;
|
|
3746
3541
|
bounds.xMin = 180;
|
|
3747
3542
|
bounds.xMax = 0;
|
|
3748
3543
|
bounds.yMin = 90;
|
|
3749
|
-
bounds.yMax = 0
|
|
3544
|
+
bounds.yMax = 0
|
|
3750
3545
|
for (var i = 0; i < data.length; i++) {
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3546
|
+
var coorda = data[i].geometry.coordinates
|
|
3547
|
+
for (var k = 0; k < coorda.length; k++) {
|
|
3548
|
+
coords = coorda[k];
|
|
3549
|
+
if (coords.length == 1) {
|
|
3550
|
+
coords = coords[0]
|
|
3551
|
+
}
|
|
3552
|
+
for (var j = 0; j < coords.length; j++) {
|
|
3553
|
+
var longitude = coords[j][0];
|
|
3554
|
+
var latitude = coords[j][1];
|
|
3555
|
+
var point = {
|
|
3556
|
+
x: longitude,
|
|
3557
|
+
y: latitude
|
|
3558
|
+
}
|
|
3559
|
+
bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
|
|
3560
|
+
bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
|
|
3561
|
+
bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
|
|
3562
|
+
bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
|
|
3563
|
+
}
|
|
3768
3564
|
}
|
|
3769
|
-
}
|
|
3770
3565
|
}
|
|
3771
3566
|
return bounds;
|
|
3772
3567
|
}
|
|
3773
3568
|
|
|
3774
|
-
function coordinateToPoint(latitude, longitude,
|
|
3569
|
+
function coordinateToPoint(latitude, longitude,bounds,scale,xoffset,yoffset) {
|
|
3775
3570
|
return {
|
|
3776
|
-
|
|
3777
|
-
|
|
3571
|
+
x: (longitude - bounds.xMin) * scale+xoffset,
|
|
3572
|
+
y: (bounds.yMax - latitude) * scale+yoffset
|
|
3778
3573
|
};
|
|
3779
3574
|
}
|
|
3780
3575
|
|
|
3781
|
-
function pointToCoordinate(pointY, pointX,
|
|
3576
|
+
function pointToCoordinate(pointY, pointX,bounds,scale,xoffset,yoffset) {
|
|
3782
3577
|
return {
|
|
3783
|
-
|
|
3784
|
-
|
|
3578
|
+
x: (pointX-xoffset)/scale+bounds.xMin,
|
|
3579
|
+
y: bounds.yMax - (pointY-yoffset)/scale
|
|
3785
3580
|
};
|
|
3786
3581
|
}
|
|
3787
3582
|
|
|
3788
|
-
function isRayIntersectsSegment(poi,
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {
|
|
3802
|
-
return false;
|
|
3803
|
-
}
|
|
3804
|
-
if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {
|
|
3805
|
-
return false;
|
|
3806
|
-
}
|
|
3807
|
-
let xseg = e_poi[0] - ((e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1])) / (e_poi[1] - s_poi[1]);
|
|
3808
|
-
if (xseg < poi[0]) {
|
|
3809
|
-
return false;
|
|
3810
|
-
} else {
|
|
3811
|
-
return true;
|
|
3812
|
-
}
|
|
3583
|
+
function isRayIntersectsSegment(poi,s_poi,e_poi){
|
|
3584
|
+
if (s_poi[1]==e_poi[1]){return false;}
|
|
3585
|
+
if (s_poi[1]>poi[1] && e_poi[1]>poi[1]){return false;}
|
|
3586
|
+
if (s_poi[1]<poi[1] && e_poi[1]<poi[1]){return false;}
|
|
3587
|
+
if (s_poi[1]==poi[1] && e_poi[1]>poi[1]){return false;}
|
|
3588
|
+
if (e_poi[1]==poi[1] && s_poi[1]>poi[1]){return false;}
|
|
3589
|
+
if (s_poi[0]<poi[0] && e_poi[1]<poi[1]){return false;}
|
|
3590
|
+
let xseg=e_poi[0]-(e_poi[0]-s_poi[0])*(e_poi[1]-poi[1])/(e_poi[1]-s_poi[1]);
|
|
3591
|
+
if (xseg<poi[0]){
|
|
3592
|
+
return false;
|
|
3593
|
+
}else{
|
|
3594
|
+
return true;
|
|
3595
|
+
}
|
|
3813
3596
|
}
|
|
3814
3597
|
|
|
3815
|
-
function isPoiWithinPoly(poi,
|
|
3816
|
-
let sinsc
|
|
3817
|
-
for (let i
|
|
3818
|
-
let epoly
|
|
3598
|
+
function isPoiWithinPoly(poi,poly){
|
|
3599
|
+
let sinsc=0;
|
|
3600
|
+
for (let i=0;i<poly.length;i++){
|
|
3601
|
+
let epoly=poly[i][0];
|
|
3819
3602
|
if (poly.length == 1) {
|
|
3820
|
-
epoly = poly[i][0]
|
|
3603
|
+
epoly = poly[i][0]
|
|
3821
3604
|
}
|
|
3822
|
-
for
|
|
3823
|
-
let s_poi
|
|
3824
|
-
let e_poi
|
|
3825
|
-
if (isRayIntersectsSegment(poi,
|
|
3826
|
-
sinsc
|
|
3605
|
+
for(let j=0;j<epoly.length-1;j++){
|
|
3606
|
+
let s_poi=epoly[j];
|
|
3607
|
+
let e_poi=epoly[j+1];
|
|
3608
|
+
if (isRayIntersectsSegment(poi,s_poi,e_poi)){
|
|
3609
|
+
sinsc+=1;
|
|
3827
3610
|
}
|
|
3828
3611
|
}
|
|
3829
3612
|
}
|
|
3830
3613
|
|
|
3831
|
-
if
|
|
3614
|
+
if(sinsc%2==1){
|
|
3832
3615
|
return true;
|
|
3833
|
-
}
|
|
3616
|
+
}else{
|
|
3834
3617
|
return false;
|
|
3835
3618
|
}
|
|
3836
3619
|
}
|
|
3837
3620
|
|
|
3621
|
+
|
|
3838
3622
|
function drawMapDataPoints(series, opts, config, context) {
|
|
3839
|
-
var mapOption
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
activeFillOpacity: 1
|
|
3849
|
-
},
|
|
3850
|
-
opts.extra.map
|
|
3851
|
-
);
|
|
3623
|
+
var mapOption=assign({},{
|
|
3624
|
+
border:true,
|
|
3625
|
+
borderWidth:1,
|
|
3626
|
+
borderColor:'#666666',
|
|
3627
|
+
fillOpacity:0.6,
|
|
3628
|
+
activeBorderColor:'#f04864',
|
|
3629
|
+
activeFillColor:'#facc14',
|
|
3630
|
+
activeFillOpacity:1
|
|
3631
|
+
},opts.extra.map);
|
|
3852
3632
|
var coords, point;
|
|
3853
3633
|
var data = series;
|
|
3854
|
-
var bounds
|
|
3634
|
+
var bounds= getBoundingBox(data);
|
|
3855
3635
|
var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
|
|
3856
3636
|
var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
|
|
3857
3637
|
var scale = xScale < yScale ? xScale : yScale;
|
|
3858
|
-
var xoffset
|
|
3859
|
-
var yoffset
|
|
3638
|
+
var xoffset=opts.width/2-Math.abs(bounds.xMax - bounds.xMin)/2*scale;
|
|
3639
|
+
var yoffset=opts.height/2-Math.abs(bounds.yMax - bounds.yMin)/2*scale;
|
|
3860
3640
|
context.beginPath();
|
|
3861
3641
|
context.clearRect(0, 0, opts.width, opts.height);
|
|
3862
|
-
context.setFillStyle(opts.background
|
|
3863
|
-
context.rect(0,
|
|
3642
|
+
context.setFillStyle(opts.background||'#FFFFFF');
|
|
3643
|
+
context.rect(0,0,opts.width,opts.height);
|
|
3864
3644
|
context.fill();
|
|
3865
3645
|
for (var i = 0; i < data.length; i++) {
|
|
3866
3646
|
context.beginPath();
|
|
@@ -3868,19 +3648,19 @@ function drawMapDataPoints(series, opts, config, context) {
|
|
|
3868
3648
|
context.setStrokeStyle(mapOption.borderColor);
|
|
3869
3649
|
context.setFillStyle(hexToRgb(series[i].color, mapOption.fillOpacity));
|
|
3870
3650
|
if (opts.tooltip) {
|
|
3871
|
-
if (opts.tooltip.index == i) {
|
|
3651
|
+
if (opts.tooltip.index == i ) {
|
|
3872
3652
|
context.setStrokeStyle(mapOption.activeBorderColor);
|
|
3873
3653
|
context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
|
|
3874
3654
|
}
|
|
3875
3655
|
}
|
|
3876
|
-
var coorda = data[i].geometry.coordinates
|
|
3656
|
+
var coorda = data[i].geometry.coordinates
|
|
3877
3657
|
for (var k = 0; k < coorda.length; k++) {
|
|
3878
3658
|
coords = coorda[k];
|
|
3879
3659
|
if (coords.length == 1) {
|
|
3880
|
-
coords = coords[0]
|
|
3660
|
+
coords = coords[0]
|
|
3881
3661
|
}
|
|
3882
3662
|
for (var j = 0; j < coords.length; j++) {
|
|
3883
|
-
point = coordinateToPoint(coords[j][1], coords[j][0],
|
|
3663
|
+
point = coordinateToPoint(coords[j][1], coords[j][0],bounds,scale,xoffset,yoffset)
|
|
3884
3664
|
if (j === 0) {
|
|
3885
3665
|
context.beginPath();
|
|
3886
3666
|
context.moveTo(point.x, point.y);
|
|
@@ -3889,269 +3669,207 @@ function drawMapDataPoints(series, opts, config, context) {
|
|
|
3889
3669
|
}
|
|
3890
3670
|
}
|
|
3891
3671
|
context.fill();
|
|
3892
|
-
if
|
|
3672
|
+
if(mapOption.border == true){
|
|
3893
3673
|
context.stroke();
|
|
3894
3674
|
}
|
|
3895
3675
|
}
|
|
3896
|
-
if
|
|
3676
|
+
if(opts.dataLabel == true){
|
|
3897
3677
|
var centerPoint = data[i].properties.centroid;
|
|
3898
|
-
if
|
|
3899
|
-
point = coordinateToPoint(centerPoint[1], centerPoint[0],
|
|
3900
|
-
let fontSize
|
|
3901
|
-
let text
|
|
3678
|
+
if(centerPoint){
|
|
3679
|
+
point = coordinateToPoint(centerPoint[1], centerPoint[0],bounds,scale,xoffset,yoffset);
|
|
3680
|
+
let fontSize=data[i].textSize||config.fontSize;
|
|
3681
|
+
let text=data[i].properties.name;
|
|
3902
3682
|
context.beginPath();
|
|
3903
|
-
context.setFontSize(fontSize)
|
|
3904
|
-
context.setFillStyle(data[i].textColor
|
|
3905
|
-
context.fillText(text, point.x
|
|
3683
|
+
context.setFontSize(fontSize)
|
|
3684
|
+
context.setFillStyle(data[i].textColor||'#666666')
|
|
3685
|
+
context.fillText(text, point.x-measureText(text,fontSize)/2, point.y+fontSize/2);
|
|
3906
3686
|
context.closePath();
|
|
3907
3687
|
context.stroke();
|
|
3908
3688
|
}
|
|
3909
3689
|
}
|
|
3910
3690
|
}
|
|
3911
|
-
opts.chartData.mapData
|
|
3912
|
-
bounds:
|
|
3913
|
-
scale:
|
|
3914
|
-
xoffset:
|
|
3915
|
-
yoffset:
|
|
3916
|
-
}
|
|
3917
|
-
drawToolTipBridge(opts, config, context,
|
|
3691
|
+
opts.chartData.mapData={
|
|
3692
|
+
bounds:bounds,
|
|
3693
|
+
scale:scale,
|
|
3694
|
+
xoffset:xoffset,
|
|
3695
|
+
yoffset:yoffset
|
|
3696
|
+
}
|
|
3697
|
+
drawToolTipBridge(opts, config, context,1);
|
|
3918
3698
|
context.draw();
|
|
3919
3699
|
}
|
|
3920
3700
|
|
|
3921
|
-
function getWordCloudPoint(opts,
|
|
3922
|
-
let points = opts.series.sort(function
|
|
3923
|
-
return parseInt(b.textSize) - parseInt(a.textSize);
|
|
3924
|
-
});
|
|
3701
|
+
function getWordCloudPoint(opts,type){
|
|
3702
|
+
let points = opts.series.sort(function(a,b){return parseInt(b.textSize)-parseInt(a.textSize);});
|
|
3925
3703
|
switch (type) {
|
|
3926
3704
|
case 'normal':
|
|
3927
3705
|
for (let i = 0; i < points.length; i++) {
|
|
3928
3706
|
let text = points[i].name;
|
|
3929
3707
|
let tHeight = points[i].textSize;
|
|
3930
|
-
let tWidth = measureText(text,
|
|
3931
|
-
let x,
|
|
3708
|
+
let tWidth = measureText(text,tHeight);
|
|
3709
|
+
let x,y;
|
|
3932
3710
|
let area;
|
|
3933
|
-
let breaknum
|
|
3934
|
-
while
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
area = [-100, -100, -100, -100];
|
|
3948
|
-
break;
|
|
3949
|
-
}
|
|
3950
|
-
}
|
|
3951
|
-
points[i].area = area;
|
|
3711
|
+
let breaknum=0;
|
|
3712
|
+
while(true) {
|
|
3713
|
+
breaknum++;
|
|
3714
|
+
x = normalInt(-opts.width/2, opts.width/2,5) - tWidth/2;
|
|
3715
|
+
y = normalInt(-opts.height/2, opts.height/2,5) + tHeight/2;
|
|
3716
|
+
area=[x-5+opts.width/2,y-5-tHeight+opts.height/2,x+tWidth+5+opts.width/2,y+5+opts.height/2];
|
|
3717
|
+
let isCollision = collisionNew(area,points,opts.width,opts.height);
|
|
3718
|
+
if (!isCollision) break;
|
|
3719
|
+
if (breaknum==1000){
|
|
3720
|
+
area=[-100,-100,-100,-100];
|
|
3721
|
+
break;
|
|
3722
|
+
}
|
|
3723
|
+
};
|
|
3724
|
+
points[i].area=area;
|
|
3952
3725
|
}
|
|
3953
|
-
|
|
3726
|
+
break;
|
|
3954
3727
|
case 'vertical':
|
|
3955
|
-
function Spin()
|
|
3728
|
+
function Spin(){
|
|
3956
3729
|
//获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
|
|
3957
|
-
if (Math.random()
|
|
3958
|
-
|
|
3959
|
-
}
|
|
3960
|
-
|
|
3961
|
-
}
|
|
3962
|
-
}
|
|
3730
|
+
if (Math.random()>0.7) {
|
|
3731
|
+
return true;
|
|
3732
|
+
}else {return false};
|
|
3733
|
+
};
|
|
3963
3734
|
for (let i = 0; i < points.length; i++) {
|
|
3964
3735
|
let text = points[i].name;
|
|
3965
3736
|
let tHeight = points[i].textSize;
|
|
3966
|
-
let tWidth = measureText(text,
|
|
3737
|
+
let tWidth = measureText(text,tHeight);
|
|
3967
3738
|
let isSpin = Spin();
|
|
3968
|
-
let x,
|
|
3969
|
-
let breaknum
|
|
3970
|
-
while
|
|
3739
|
+
let x,y,area,areav;
|
|
3740
|
+
let breaknum=0;
|
|
3741
|
+
while(true) {
|
|
3971
3742
|
breaknum++;
|
|
3972
3743
|
let isCollision;
|
|
3973
3744
|
if (isSpin) {
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
y
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
opts.height / 2 - opts.width / 2 + (y - 5 - tWidth + opts.width / 2) - 5,
|
|
3985
|
-
opts.width - (opts.width / 2 - opts.height / 2) - (-x + tHeight + 5 + opts.height / 2) + tHeight,
|
|
3986
|
-
opts.height / 2 - opts.width / 2 + (y - 5 - tWidth + opts.width / 2) + tWidth + 5
|
|
3987
|
-
];
|
|
3988
|
-
isCollision = collisionNew(areav, points, opts.height, opts.width);
|
|
3989
|
-
} else {
|
|
3990
|
-
x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
|
|
3991
|
-
y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
|
|
3992
|
-
area = [
|
|
3993
|
-
x - 5 + opts.width / 2,
|
|
3994
|
-
y - 5 - tHeight + opts.height / 2,
|
|
3995
|
-
x + tWidth + 5 + opts.width / 2,
|
|
3996
|
-
y + 5 + opts.height / 2
|
|
3997
|
-
];
|
|
3998
|
-
isCollision = collisionNew(area, points, opts.width, opts.height);
|
|
3745
|
+
x = normalInt(-opts.width/2, opts.width/2,5) - tWidth/2;
|
|
3746
|
+
y = normalInt(-opts.height/2, opts.height/2,5)+tHeight/2;
|
|
3747
|
+
area=[y-5-tWidth+opts.width/2,(-x-5+opts.height/2),y+5+opts.width/2,(-x+tHeight+5+opts.height/2)];
|
|
3748
|
+
areav=[opts.width-(opts.width/2-opts.height/2)-(-x+tHeight+5+opts.height/2)-5,(opts.height/2-opts.width/2)+(y-5-tWidth+opts.width/2)-5,opts.width-(opts.width/2-opts.height/2)-(-x+tHeight+5+opts.height/2)+tHeight,(opts.height/2-opts.width/2)+(y-5-tWidth+opts.width/2)+tWidth+5];
|
|
3749
|
+
isCollision = collisionNew(areav,points,opts.height,opts.width);
|
|
3750
|
+
}else{
|
|
3751
|
+
x = normalInt(-opts.width/2, opts.width/2,5) - tWidth/2;
|
|
3752
|
+
y = normalInt(-opts.height/2, opts.height/2,5)+tHeight/2;
|
|
3753
|
+
area=[x-5+opts.width/2,y-5-tHeight+opts.height/2,x+tWidth+5+opts.width/2,y+5+opts.height/2];
|
|
3754
|
+
isCollision = collisionNew(area,points,opts.width,opts.height);
|
|
3999
3755
|
}
|
|
4000
3756
|
if (!isCollision) break;
|
|
4001
|
-
if (breaknum
|
|
4002
|
-
area
|
|
3757
|
+
if (breaknum==1000){
|
|
3758
|
+
area=[-1000,-1000,-1000,-1000];
|
|
4003
3759
|
break;
|
|
4004
3760
|
}
|
|
4005
|
-
}
|
|
3761
|
+
};
|
|
4006
3762
|
if (isSpin) {
|
|
4007
|
-
points[i].area
|
|
4008
|
-
points[i].areav
|
|
4009
|
-
}
|
|
4010
|
-
points[i].area
|
|
3763
|
+
points[i].area=areav;
|
|
3764
|
+
points[i].areav=area;
|
|
3765
|
+
}else{
|
|
3766
|
+
points[i].area=area;
|
|
4011
3767
|
}
|
|
4012
|
-
points[i].rotate
|
|
4013
|
-
}
|
|
4014
|
-
|
|
3768
|
+
points[i].rotate=isSpin;
|
|
3769
|
+
};
|
|
3770
|
+
break;
|
|
4015
3771
|
}
|
|
4016
3772
|
return points;
|
|
4017
3773
|
}
|
|
4018
3774
|
|
|
3775
|
+
|
|
4019
3776
|
function drawWordCloudDataPoints(series, opts, config, context) {
|
|
4020
3777
|
let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
4021
|
-
let wordOption = assign(
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
autoColors: true
|
|
4026
|
-
},
|
|
4027
|
-
opts.extra.word
|
|
4028
|
-
);
|
|
3778
|
+
let wordOption = assign({},{
|
|
3779
|
+
type: 'normal',
|
|
3780
|
+
autoColors: true
|
|
3781
|
+
},opts.extra.word);
|
|
4029
3782
|
|
|
4030
3783
|
context.beginPath();
|
|
4031
|
-
context.setFillStyle(opts.background
|
|
4032
|
-
context.rect(0,
|
|
3784
|
+
context.setFillStyle(opts.background||'#FFFFFF');
|
|
3785
|
+
context.rect(0,0,opts.width,opts.height);
|
|
4033
3786
|
context.fill();
|
|
4034
3787
|
context.save();
|
|
4035
3788
|
let points = opts.chartData.wordCloudData;
|
|
4036
|
-
context.translate(opts.width
|
|
3789
|
+
context.translate(opts.width/2,opts.height/2);
|
|
4037
3790
|
|
|
4038
|
-
for
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
context.fillText(
|
|
4061
|
-
text,
|
|
4062
|
-
(points[i].areav[0] + 5 - opts.width / 2) * process - (tWidth * (1 - process)) / 2,
|
|
4063
|
-
(points[i].areav[1] + 5 + tHeight - opts.height / 2) * process
|
|
4064
|
-
);
|
|
3791
|
+
for(let i=0;i<points.length;i++){
|
|
3792
|
+
context.save();
|
|
3793
|
+
if(points[i].rotate){
|
|
3794
|
+
context.rotate(90 * Math.PI / 180);
|
|
3795
|
+
}
|
|
3796
|
+
let text = points[i].name;
|
|
3797
|
+
let tHeight = points[i].textSize;
|
|
3798
|
+
let tWidth = measureText(text,tHeight);
|
|
3799
|
+
context.beginPath();
|
|
3800
|
+
context.setStrokeStyle(points[i].color);
|
|
3801
|
+
context.setFillStyle(points[i].color);
|
|
3802
|
+
context.setFontSize(tHeight);
|
|
3803
|
+
if(points[i].rotate){
|
|
3804
|
+
if(points[i].areav[0]>0){
|
|
3805
|
+
if (opts.tooltip) {
|
|
3806
|
+
if (opts.tooltip.index == i) {
|
|
3807
|
+
context.strokeText(text,(points[i].areav[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].areav[1]+5+tHeight-opts.height/2)*process);
|
|
3808
|
+
}else{
|
|
3809
|
+
context.fillText(text,(points[i].areav[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].areav[1]+5+tHeight-opts.height/2)*process);
|
|
3810
|
+
}
|
|
3811
|
+
}else{
|
|
3812
|
+
context.fillText(text,(points[i].areav[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].areav[1]+5+tHeight-opts.height/2)*process);
|
|
4065
3813
|
}
|
|
4066
|
-
} else {
|
|
4067
|
-
context.fillText(
|
|
4068
|
-
text,
|
|
4069
|
-
(points[i].areav[0] + 5 - opts.width / 2) * process - (tWidth * (1 - process)) / 2,
|
|
4070
|
-
(points[i].areav[1] + 5 + tHeight - opts.height / 2) * process
|
|
4071
|
-
);
|
|
4072
3814
|
}
|
|
4073
|
-
}
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
text,
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
);
|
|
4083
|
-
} else {
|
|
4084
|
-
context.fillText(
|
|
4085
|
-
text,
|
|
4086
|
-
(points[i].area[0] + 5 - opts.width / 2) * process - (tWidth * (1 - process)) / 2,
|
|
4087
|
-
(points[i].area[1] + 5 + tHeight - opts.height / 2) * process
|
|
4088
|
-
);
|
|
3815
|
+
}else{
|
|
3816
|
+
if(points[i].area[0]>0){
|
|
3817
|
+
if (opts.tooltip) {
|
|
3818
|
+
if (opts.tooltip.index == i) {
|
|
3819
|
+
context.strokeText(text,(points[i].area[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].area[1]+5+tHeight-opts.height/2)*process);
|
|
3820
|
+
}else{
|
|
3821
|
+
context.fillText(text,(points[i].area[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].area[1]+5+tHeight-opts.height/2)*process);
|
|
3822
|
+
}
|
|
3823
|
+
}else{
|
|
3824
|
+
context.fillText(text,(points[i].area[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].area[1]+5+tHeight-opts.height/2)*process);
|
|
4089
3825
|
}
|
|
4090
|
-
|
|
4091
|
-
context.fillText(
|
|
4092
|
-
text,
|
|
4093
|
-
(points[i].area[0] + 5 - opts.width / 2) * process - (tWidth * (1 - process)) / 2,
|
|
4094
|
-
(points[i].area[1] + 5 + tHeight - opts.height / 2) * process
|
|
4095
|
-
);
|
|
3826
|
+
|
|
4096
3827
|
}
|
|
4097
3828
|
}
|
|
4098
|
-
}
|
|
4099
3829
|
|
|
4100
|
-
|
|
4101
|
-
|
|
3830
|
+
context.stroke();
|
|
3831
|
+
context.restore();
|
|
4102
3832
|
}
|
|
4103
3833
|
context.restore();
|
|
4104
3834
|
}
|
|
4105
3835
|
|
|
4106
3836
|
function drawFunnelDataPoints(series, opts, config, context) {
|
|
4107
3837
|
let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
4108
|
-
let funnelOption = assign(
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
},
|
|
4119
|
-
opts.extra.funnel
|
|
4120
|
-
);
|
|
4121
|
-
let eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
|
|
3838
|
+
let funnelOption = assign({},{
|
|
3839
|
+
activeWidth:10,
|
|
3840
|
+
activeOpacity:0.3,
|
|
3841
|
+
border:false,
|
|
3842
|
+
borderWidth:2,
|
|
3843
|
+
borderColor:'#FFFFFF',
|
|
3844
|
+
fillOpacity:1,
|
|
3845
|
+
labelAlign:'right'
|
|
3846
|
+
},opts.extra.funnel);
|
|
3847
|
+
let eachSpacing = (opts.height - opts.area[0] - opts.area[2])/series.length;
|
|
4122
3848
|
let centerPosition = {
|
|
4123
3849
|
x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
|
|
4124
|
-
y: opts.height
|
|
3850
|
+
y: opts.height-opts.area[2]
|
|
4125
3851
|
};
|
|
4126
3852
|
let activeWidth = funnelOption.activeWidth;
|
|
4127
|
-
let radius = Math.min(
|
|
4128
|
-
(opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth,
|
|
4129
|
-
(opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth
|
|
4130
|
-
);
|
|
3853
|
+
let radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
|
|
4131
3854
|
series = getFunnelDataPoints(series, radius, process);
|
|
4132
3855
|
context.save();
|
|
4133
|
-
context.translate(centerPosition.x,
|
|
4134
|
-
for
|
|
4135
|
-
if
|
|
3856
|
+
context.translate(centerPosition.x,centerPosition.y);
|
|
3857
|
+
for(let i=0;i<series.length;i++){
|
|
3858
|
+
if(i==0){
|
|
4136
3859
|
if (opts.tooltip) {
|
|
4137
3860
|
if (opts.tooltip.index == i) {
|
|
4138
3861
|
context.beginPath();
|
|
4139
3862
|
context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
|
|
4140
3863
|
context.moveTo(-activeWidth, 0);
|
|
4141
|
-
context.lineTo(-series[i].radius
|
|
4142
|
-
context.lineTo(series[i].radius
|
|
3864
|
+
context.lineTo(-series[i].radius-activeWidth, -eachSpacing);
|
|
3865
|
+
context.lineTo(series[i].radius+activeWidth, -eachSpacing);
|
|
4143
3866
|
context.lineTo(activeWidth, 0);
|
|
4144
3867
|
context.lineTo(-activeWidth, 0);
|
|
4145
3868
|
context.closePath();
|
|
4146
3869
|
context.fill();
|
|
4147
3870
|
}
|
|
4148
3871
|
}
|
|
4149
|
-
series[i].funnelArea
|
|
4150
|
-
centerPosition.x - series[i].radius,
|
|
4151
|
-
centerPosition.y - eachSpacing,
|
|
4152
|
-
centerPosition.x + series[i].radius,
|
|
4153
|
-
centerPosition.y
|
|
4154
|
-
];
|
|
3872
|
+
series[i].funnelArea=[centerPosition.x-series[i].radius,centerPosition.y-eachSpacing,centerPosition.x+series[i].radius,centerPosition.y];
|
|
4155
3873
|
context.beginPath();
|
|
4156
3874
|
context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
|
|
4157
3875
|
context.setStrokeStyle(funnelOption.borderColor);
|
|
@@ -4162,19 +3880,19 @@ function drawFunnelDataPoints(series, opts, config, context) {
|
|
|
4162
3880
|
context.lineTo(0, 0);
|
|
4163
3881
|
context.closePath();
|
|
4164
3882
|
context.fill();
|
|
4165
|
-
if
|
|
3883
|
+
if(funnelOption.border == true){
|
|
4166
3884
|
context.stroke();
|
|
4167
3885
|
}
|
|
4168
|
-
}
|
|
3886
|
+
}else{
|
|
4169
3887
|
if (opts.tooltip) {
|
|
4170
3888
|
if (opts.tooltip.index == i) {
|
|
4171
3889
|
context.beginPath();
|
|
4172
3890
|
context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
|
|
4173
3891
|
context.moveTo(0, 0);
|
|
4174
|
-
context.lineTo(-series[i
|
|
4175
|
-
context.lineTo(-series[i].radius
|
|
4176
|
-
context.lineTo(series[i].radius
|
|
4177
|
-
context.lineTo(series[i
|
|
3892
|
+
context.lineTo(-series[i-1].radius-activeWidth, 0);
|
|
3893
|
+
context.lineTo(-series[i].radius-activeWidth, -eachSpacing);
|
|
3894
|
+
context.lineTo(series[i].radius+activeWidth, -eachSpacing);
|
|
3895
|
+
context.lineTo(series[i-1].radius+activeWidth, 0);
|
|
4178
3896
|
context.lineTo(0, 0);
|
|
4179
3897
|
context.closePath();
|
|
4180
3898
|
context.fill();
|
|
@@ -4182,29 +3900,24 @@ function drawFunnelDataPoints(series, opts, config, context) {
|
|
|
4182
3900
|
context.fill();
|
|
4183
3901
|
}
|
|
4184
3902
|
}
|
|
4185
|
-
series[i].funnelArea
|
|
4186
|
-
centerPosition.x - series[i].radius,
|
|
4187
|
-
centerPosition.y - eachSpacing * (i + 1),
|
|
4188
|
-
centerPosition.x + series[i].radius,
|
|
4189
|
-
centerPosition.y - eachSpacing * i
|
|
4190
|
-
];
|
|
3903
|
+
series[i].funnelArea=[centerPosition.x-series[i].radius,centerPosition.y-eachSpacing*(i+1),centerPosition.x+series[i].radius,centerPosition.y-eachSpacing*i];
|
|
4191
3904
|
context.beginPath();
|
|
4192
3905
|
context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
|
|
4193
3906
|
context.setStrokeStyle(funnelOption.borderColor);
|
|
4194
3907
|
context.setFillStyle(hexToRgb(series[i].color, funnelOption.fillOpacity));
|
|
4195
3908
|
context.moveTo(0, 0);
|
|
4196
|
-
context.lineTo(-series[i
|
|
3909
|
+
context.lineTo(-series[i-1].radius, 0);
|
|
4197
3910
|
context.lineTo(-series[i].radius, -eachSpacing);
|
|
4198
3911
|
context.lineTo(series[i].radius, -eachSpacing);
|
|
4199
|
-
context.lineTo(series[i
|
|
3912
|
+
context.lineTo(series[i-1].radius, 0);
|
|
4200
3913
|
context.lineTo(0, 0);
|
|
4201
3914
|
context.closePath();
|
|
4202
3915
|
context.fill();
|
|
4203
|
-
if
|
|
3916
|
+
if(funnelOption.border == true){
|
|
4204
3917
|
context.stroke();
|
|
4205
3918
|
}
|
|
4206
3919
|
}
|
|
4207
|
-
context.translate(0
|
|
3920
|
+
context.translate(0,-eachSpacing)
|
|
4208
3921
|
}
|
|
4209
3922
|
context.restore();
|
|
4210
3923
|
|
|
@@ -4219,26 +3932,26 @@ function drawFunnelDataPoints(series, opts, config, context) {
|
|
|
4219
3932
|
};
|
|
4220
3933
|
}
|
|
4221
3934
|
|
|
4222
|
-
function drawFunnelText(series, opts, context, eachSpacing, labelAlign,
|
|
4223
|
-
for
|
|
3935
|
+
function drawFunnelText(series, opts, context, eachSpacing, labelAlign,activeWidth, centerPosition){
|
|
3936
|
+
for(let i=0;i<series.length;i++){
|
|
4224
3937
|
let item = series[i];
|
|
4225
|
-
let startX,
|
|
4226
|
-
let text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) +
|
|
4227
|
-
if
|
|
4228
|
-
if
|
|
4229
|
-
startX
|
|
4230
|
-
}
|
|
4231
|
-
startX
|
|
3938
|
+
let startX,endX,startY,fontSize;
|
|
3939
|
+
let text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) +'%';
|
|
3940
|
+
if(labelAlign == 'right'){
|
|
3941
|
+
if(i==0){
|
|
3942
|
+
startX=(item.funnelArea[2]+centerPosition.x)/2;
|
|
3943
|
+
}else{
|
|
3944
|
+
startX=(item.funnelArea[2]+series[i-1].funnelArea[2])/2;
|
|
4232
3945
|
}
|
|
4233
|
-
endX
|
|
4234
|
-
startY
|
|
3946
|
+
endX=startX+activeWidth*2;
|
|
3947
|
+
startY=item.funnelArea[1]+eachSpacing/2;
|
|
4235
3948
|
fontSize = item.textSize || opts.fontSize;
|
|
4236
3949
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
4237
3950
|
context.setStrokeStyle(item.color);
|
|
4238
3951
|
context.setFillStyle(item.color);
|
|
4239
3952
|
context.beginPath();
|
|
4240
|
-
context.moveTo(startX,
|
|
4241
|
-
context.lineTo(endX,
|
|
3953
|
+
context.moveTo(startX,startY );
|
|
3954
|
+
context.lineTo(endX,startY);
|
|
4242
3955
|
context.stroke();
|
|
4243
3956
|
context.closePath();
|
|
4244
3957
|
context.beginPath();
|
|
@@ -4249,25 +3962,25 @@ function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWi
|
|
|
4249
3962
|
context.beginPath();
|
|
4250
3963
|
context.setFontSize(fontSize);
|
|
4251
3964
|
context.setFillStyle(item.textColor || '#666666');
|
|
4252
|
-
context.fillText(text, endX
|
|
3965
|
+
context.fillText(text, endX+5, startY + fontSize/2 -2);
|
|
4253
3966
|
context.closePath();
|
|
4254
3967
|
context.stroke();
|
|
4255
3968
|
context.closePath();
|
|
4256
|
-
}
|
|
4257
|
-
if
|
|
4258
|
-
startX
|
|
4259
|
-
}
|
|
4260
|
-
startX
|
|
3969
|
+
}else{
|
|
3970
|
+
if(i==0){
|
|
3971
|
+
startX=(item.funnelArea[0]+centerPosition.x)/2;
|
|
3972
|
+
}else{
|
|
3973
|
+
startX=(item.funnelArea[0]+series[i-1].funnelArea[0])/2;
|
|
4261
3974
|
}
|
|
4262
|
-
endX
|
|
4263
|
-
startY
|
|
3975
|
+
endX=startX-activeWidth*2;
|
|
3976
|
+
startY=item.funnelArea[1]+eachSpacing/2;
|
|
4264
3977
|
fontSize = item.textSize || opts.fontSize;
|
|
4265
3978
|
context.setLineWidth(1 * opts.pixelRatio);
|
|
4266
3979
|
context.setStrokeStyle(item.color);
|
|
4267
3980
|
context.setFillStyle(item.color);
|
|
4268
3981
|
context.beginPath();
|
|
4269
|
-
context.moveTo(startX,
|
|
4270
|
-
context.lineTo(endX,
|
|
3982
|
+
context.moveTo(startX,startY );
|
|
3983
|
+
context.lineTo(endX,startY);
|
|
4271
3984
|
context.stroke();
|
|
4272
3985
|
context.closePath();
|
|
4273
3986
|
context.beginPath();
|
|
@@ -4278,14 +3991,16 @@ function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWi
|
|
|
4278
3991
|
context.beginPath();
|
|
4279
3992
|
context.setFontSize(fontSize);
|
|
4280
3993
|
context.setFillStyle(item.textColor || '#666666');
|
|
4281
|
-
context.fillText(text, endX
|
|
3994
|
+
context.fillText(text, endX-5-measureText(text), startY + fontSize/2 -2);
|
|
4282
3995
|
context.closePath();
|
|
4283
3996
|
context.stroke();
|
|
4284
3997
|
context.closePath();
|
|
4285
3998
|
}
|
|
3999
|
+
|
|
4286
4000
|
}
|
|
4287
4001
|
}
|
|
4288
4002
|
|
|
4003
|
+
|
|
4289
4004
|
function drawCanvas(opts, context) {
|
|
4290
4005
|
context.draw();
|
|
4291
4006
|
}
|
|
@@ -4317,8 +4032,8 @@ function Animation(opts) {
|
|
|
4317
4032
|
|
|
4318
4033
|
function createAnimationFrame() {
|
|
4319
4034
|
if (typeof setTimeout !== 'undefined') {
|
|
4320
|
-
return function
|
|
4321
|
-
setTimeout(function
|
|
4035
|
+
return function(step, delay) {
|
|
4036
|
+
setTimeout(function() {
|
|
4322
4037
|
var timeStamp = +new Date();
|
|
4323
4038
|
step(timeStamp);
|
|
4324
4039
|
}, delay);
|
|
@@ -4326,11 +4041,11 @@ function Animation(opts) {
|
|
|
4326
4041
|
} else if (typeof requestAnimationFrame !== 'undefined') {
|
|
4327
4042
|
return requestAnimationFrame;
|
|
4328
4043
|
} else {
|
|
4329
|
-
return function
|
|
4044
|
+
return function(step) {
|
|
4330
4045
|
step(null);
|
|
4331
4046
|
};
|
|
4332
4047
|
}
|
|
4333
|
-
}
|
|
4048
|
+
};
|
|
4334
4049
|
var animationFrame = createAnimationFrame();
|
|
4335
4050
|
var startTimeStamp = null;
|
|
4336
4051
|
var _step = function step(timestamp) {
|
|
@@ -4360,7 +4075,7 @@ function Animation(opts) {
|
|
|
4360
4075
|
|
|
4361
4076
|
// stop animation immediately
|
|
4362
4077
|
// and tigger onAnimationFinish
|
|
4363
|
-
Animation.prototype.stop = function
|
|
4078
|
+
Animation.prototype.stop = function() {
|
|
4364
4079
|
this.isStop = true;
|
|
4365
4080
|
};
|
|
4366
4081
|
|
|
@@ -4419,8 +4134,7 @@ function drawCharts(type, opts, config, context) {
|
|
|
4419
4134
|
break;
|
|
4420
4135
|
}
|
|
4421
4136
|
|
|
4422
|
-
let _calYAxisData = {},
|
|
4423
|
-
yAxisWidth = 0;
|
|
4137
|
+
let _calYAxisData = {},yAxisWidth = 0;
|
|
4424
4138
|
if (opts.type === 'line' || opts.type === 'column' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle') {
|
|
4425
4139
|
_calYAxisData = calYAxisData(series, opts, config);
|
|
4426
4140
|
yAxisWidth = _calYAxisData.yAxisWidth;
|
|
@@ -4467,42 +4181,38 @@ function drawCharts(type, opts, config, context) {
|
|
|
4467
4181
|
|
|
4468
4182
|
switch (type) {
|
|
4469
4183
|
case 'word':
|
|
4470
|
-
let wordOption = assign(
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
opts.extra.word
|
|
4477
|
-
);
|
|
4478
|
-
if (opts.updateData == true || opts.updateData == undefined) {
|
|
4479
|
-
opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type);
|
|
4184
|
+
let wordOption = assign({},{
|
|
4185
|
+
type: 'normal',
|
|
4186
|
+
autoColors: true
|
|
4187
|
+
},opts.extra.word);
|
|
4188
|
+
if(opts.updateData==true || opts.updateData==undefined){
|
|
4189
|
+
opts.chartData.wordCloudData=getWordCloudPoint(opts,wordOption.type);
|
|
4480
4190
|
}
|
|
4481
4191
|
this.animationInstance = new Animation({
|
|
4482
4192
|
timing: 'easeInOut',
|
|
4483
4193
|
duration: duration,
|
|
4484
|
-
onProcess: function
|
|
4194
|
+
onProcess: function(process) {
|
|
4485
4195
|
context.clearRect(0, 0, opts.width, opts.height);
|
|
4486
4196
|
if (opts.rotate) {
|
|
4487
4197
|
contextRotate(context, opts);
|
|
4488
4198
|
}
|
|
4489
|
-
drawWordCloudDataPoints(series, opts, config, context,
|
|
4199
|
+
drawWordCloudDataPoints(series, opts, config, context,process);
|
|
4490
4200
|
drawCanvas(opts, context);
|
|
4491
4201
|
},
|
|
4492
4202
|
onAnimationFinish: function onAnimationFinish() {
|
|
4493
4203
|
_this.event.trigger('renderComplete');
|
|
4494
4204
|
}
|
|
4495
4205
|
});
|
|
4496
|
-
|
|
4206
|
+
break;
|
|
4497
4207
|
case 'map':
|
|
4498
4208
|
context.clearRect(0, 0, opts.width, opts.height);
|
|
4499
4209
|
drawMapDataPoints(series, opts, config, context);
|
|
4500
|
-
|
|
4210
|
+
break;
|
|
4501
4211
|
case 'funnel':
|
|
4502
4212
|
this.animationInstance = new Animation({
|
|
4503
4213
|
timing: 'easeInOut',
|
|
4504
4214
|
duration: duration,
|
|
4505
|
-
onProcess: function
|
|
4215
|
+
onProcess: function(process) {
|
|
4506
4216
|
context.clearRect(0, 0, opts.width, opts.height);
|
|
4507
4217
|
if (opts.rotate) {
|
|
4508
4218
|
contextRotate(context, opts);
|
|
@@ -4516,7 +4226,7 @@ function drawCharts(type, opts, config, context) {
|
|
|
4516
4226
|
_this.event.trigger('renderComplete');
|
|
4517
4227
|
}
|
|
4518
4228
|
});
|
|
4519
|
-
|
|
4229
|
+
break;
|
|
4520
4230
|
case 'line':
|
|
4521
4231
|
this.animationInstance = new Animation({
|
|
4522
4232
|
timing: 'easeIn',
|
|
@@ -4544,6 +4254,7 @@ function drawCharts(type, opts, config, context) {
|
|
|
4544
4254
|
drawLegend(opts.series, opts, config, context, opts.chartData);
|
|
4545
4255
|
drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
|
|
4546
4256
|
drawCanvas(opts, context);
|
|
4257
|
+
|
|
4547
4258
|
},
|
|
4548
4259
|
onAnimationFinish: function onAnimationFinish() {
|
|
4549
4260
|
_this.event.trigger('renderComplete');
|
|
@@ -4787,12 +4498,12 @@ function Event() {
|
|
|
4787
4498
|
this.events = {};
|
|
4788
4499
|
}
|
|
4789
4500
|
|
|
4790
|
-
Event.prototype.addEventListener = function
|
|
4501
|
+
Event.prototype.addEventListener = function(type, listener) {
|
|
4791
4502
|
this.events[type] = this.events[type] || [];
|
|
4792
4503
|
this.events[type].push(listener);
|
|
4793
4504
|
};
|
|
4794
4505
|
|
|
4795
|
-
Event.prototype.trigger = function
|
|
4506
|
+
Event.prototype.trigger = function() {
|
|
4796
4507
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
4797
4508
|
args[_key] = arguments[_key];
|
|
4798
4509
|
}
|
|
@@ -4800,7 +4511,7 @@ Event.prototype.trigger = function () {
|
|
|
4800
4511
|
var type = args[0];
|
|
4801
4512
|
var params = args.slice(1);
|
|
4802
4513
|
if (!!this.events[type]) {
|
|
4803
|
-
this.events[type].forEach(function
|
|
4514
|
+
this.events[type].forEach(function(listener) {
|
|
4804
4515
|
try {
|
|
4805
4516
|
listener.apply(null, params);
|
|
4806
4517
|
} catch (e) {
|
|
@@ -4816,46 +4527,34 @@ var Charts = function Charts(opts) {
|
|
|
4816
4527
|
opts.title = assign({}, opts.title);
|
|
4817
4528
|
opts.subtitle = assign({}, opts.subtitle);
|
|
4818
4529
|
opts.duration = opts.duration ? opts.duration : 1000;
|
|
4819
|
-
opts.yAxis = assign(
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
borderWidth: 0,
|
|
4848
|
-
padding: 5,
|
|
4849
|
-
margin: 5,
|
|
4850
|
-
itemGap: 10,
|
|
4851
|
-
fontSize: opts.fontSize,
|
|
4852
|
-
lineHeight: opts.fontSize,
|
|
4853
|
-
fontColor: '#333333',
|
|
4854
|
-
format: {},
|
|
4855
|
-
hiddenColor: '#CECECE'
|
|
4856
|
-
},
|
|
4857
|
-
opts.legend
|
|
4858
|
-
);
|
|
4530
|
+
opts.yAxis = assign({}, {
|
|
4531
|
+
gridType: 'solid',
|
|
4532
|
+
dashLength: 4 * opts.pixelRatio
|
|
4533
|
+
}, opts.yAxis);
|
|
4534
|
+
opts.xAxis = assign({}, {
|
|
4535
|
+
rotateLabel: false,
|
|
4536
|
+
type: 'calibration',
|
|
4537
|
+
gridType: 'solid',
|
|
4538
|
+
dashLength: 4 * opts.pixelRatio,
|
|
4539
|
+
scrollAlign: 'left',
|
|
4540
|
+
boundaryGap:'center'
|
|
4541
|
+
}, opts.xAxis);
|
|
4542
|
+
opts.legend = assign({}, {
|
|
4543
|
+
show: true,
|
|
4544
|
+
position: 'bottom',
|
|
4545
|
+
float: 'center',
|
|
4546
|
+
backgroundColor: 'rgba(0,0,0,0)',
|
|
4547
|
+
borderColor: 'rgba(0,0,0,0)',
|
|
4548
|
+
borderWidth: 0,
|
|
4549
|
+
padding: 5,
|
|
4550
|
+
margin: 5,
|
|
4551
|
+
itemGap: 10,
|
|
4552
|
+
fontSize: opts.fontSize,
|
|
4553
|
+
lineHeight: opts.fontSize,
|
|
4554
|
+
fontColor: '#333333',
|
|
4555
|
+
format: {},
|
|
4556
|
+
hiddenColor: '#CECECE'
|
|
4557
|
+
}, opts.legend);
|
|
4859
4558
|
opts.legend.borderWidth = opts.legend.borderWidth * opts.pixelRatio;
|
|
4860
4559
|
opts.legend.itemGap = opts.legend.itemGap * opts.pixelRatio;
|
|
4861
4560
|
opts.legend.padding = opts.legend.padding * opts.pixelRatio;
|
|
@@ -4868,16 +4567,10 @@ var Charts = function Charts(opts) {
|
|
|
4868
4567
|
config$$1.colors = opts.colors ? opts.colors : config$$1.colors;
|
|
4869
4568
|
config$$1.yAxisTitleWidth = opts.yAxis.disabled !== true && opts.yAxis.title ? config$$1.yAxisTitleWidth : 0;
|
|
4870
4569
|
if (opts.type == 'pie' || opts.type == 'ring') {
|
|
4871
|
-
config$$1.pieChartLinePadding =
|
|
4872
|
-
opts.dataLabel === false
|
|
4873
|
-
? 0
|
|
4874
|
-
: opts.extra.pie.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
|
|
4570
|
+
config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
|
|
4875
4571
|
}
|
|
4876
4572
|
if (opts.type == 'rose') {
|
|
4877
|
-
config$$1.pieChartLinePadding =
|
|
4878
|
-
opts.dataLabel === false
|
|
4879
|
-
? 0
|
|
4880
|
-
: opts.extra.rose.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
|
|
4573
|
+
config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
|
|
4881
4574
|
}
|
|
4882
4575
|
config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pixelRatio;
|
|
4883
4576
|
config$$1.yAxisSplit = opts.yAxis.splitNumber ? opts.yAxis.splitNumber : config.yAxisSplit;
|
|
@@ -4937,7 +4630,7 @@ var Charts = function Charts(opts) {
|
|
|
4937
4630
|
drawCharts.call(this, opts.type, opts, config$$1, this.context);
|
|
4938
4631
|
};
|
|
4939
4632
|
|
|
4940
|
-
Charts.prototype.updateData = function
|
|
4633
|
+
Charts.prototype.updateData = function() {
|
|
4941
4634
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4942
4635
|
this.opts = assign({}, this.opts, data);
|
|
4943
4636
|
this.opts.updateData = true;
|
|
@@ -4980,16 +4673,15 @@ Charts.prototype.updateData = function () {
|
|
|
4980
4673
|
drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
|
|
4981
4674
|
};
|
|
4982
4675
|
|
|
4983
|
-
Charts.prototype.zoom = function
|
|
4676
|
+
Charts.prototype.zoom = function() {
|
|
4984
4677
|
var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
|
|
4985
4678
|
if (this.opts.enableScroll !== true) {
|
|
4986
|
-
console.log('请启用滚动条后使用!')
|
|
4679
|
+
console.log('请启用滚动条后使用!')
|
|
4987
4680
|
return;
|
|
4988
4681
|
}
|
|
4989
4682
|
//当前屏幕中间点
|
|
4990
|
-
let centerPoint =
|
|
4991
|
-
|
|
4992
|
-
Math.round(this.opts.xAxis.itemCount / 2);
|
|
4683
|
+
let centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(
|
|
4684
|
+
this.opts.xAxis.itemCount / 2);
|
|
4993
4685
|
this.opts.animation = false;
|
|
4994
4686
|
this.opts.xAxis.itemCount = val.itemCount;
|
|
4995
4687
|
//重新计算x轴偏移距离
|
|
@@ -5022,15 +4714,15 @@ Charts.prototype.zoom = function () {
|
|
|
5022
4714
|
drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
|
|
5023
4715
|
};
|
|
5024
4716
|
|
|
5025
|
-
Charts.prototype.stopAnimation = function
|
|
4717
|
+
Charts.prototype.stopAnimation = function() {
|
|
5026
4718
|
this.animationInstance && this.animationInstance.stop();
|
|
5027
4719
|
};
|
|
5028
4720
|
|
|
5029
|
-
Charts.prototype.addEventListener = function
|
|
4721
|
+
Charts.prototype.addEventListener = function(type, listener) {
|
|
5030
4722
|
this.event.addEventListener(type, listener);
|
|
5031
4723
|
};
|
|
5032
4724
|
|
|
5033
|
-
Charts.prototype.getCurrentDataIndex = function
|
|
4725
|
+
Charts.prototype.getCurrentDataIndex = function(e) {
|
|
5034
4726
|
var touches = null;
|
|
5035
4727
|
if (e.changedTouches) {
|
|
5036
4728
|
touches = e.changedTouches[0];
|
|
@@ -5040,63 +4732,41 @@ Charts.prototype.getCurrentDataIndex = function (e) {
|
|
|
5040
4732
|
if (touches) {
|
|
5041
4733
|
let _touches$ = getTouches(touches, this.opts, e);
|
|
5042
4734
|
if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose') {
|
|
5043
|
-
return findPieChartCurrentIndex(
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
},
|
|
5048
|
-
this.opts.chartData.pieData
|
|
5049
|
-
);
|
|
4735
|
+
return findPieChartCurrentIndex({
|
|
4736
|
+
x: _touches$.x,
|
|
4737
|
+
y: _touches$.y
|
|
4738
|
+
}, this.opts.chartData.pieData);
|
|
5050
4739
|
} else if (this.opts.type === 'radar') {
|
|
5051
|
-
return findRadarChartCurrentIndex(
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
},
|
|
5056
|
-
this.opts.chartData.radarData,
|
|
5057
|
-
this.opts.categories.length
|
|
5058
|
-
);
|
|
4740
|
+
return findRadarChartCurrentIndex({
|
|
4741
|
+
x: _touches$.x,
|
|
4742
|
+
y: _touches$.y
|
|
4743
|
+
}, this.opts.chartData.radarData, this.opts.categories.length);
|
|
5059
4744
|
} else if (this.opts.type === 'funnel') {
|
|
5060
|
-
return findFunnelChartCurrentIndex(
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
},
|
|
5065
|
-
this.opts.chartData.funnelData
|
|
5066
|
-
);
|
|
4745
|
+
return findFunnelChartCurrentIndex({
|
|
4746
|
+
x: _touches$.x,
|
|
4747
|
+
y: _touches$.y
|
|
4748
|
+
}, this.opts.chartData.funnelData);
|
|
5067
4749
|
} else if (this.opts.type === 'map') {
|
|
5068
|
-
return findMapChartCurrentIndex(
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
{
|
|
5078
|
-
x: _touches$.x,
|
|
5079
|
-
y: _touches$.y
|
|
5080
|
-
},
|
|
5081
|
-
this.opts.chartData.wordCloudData
|
|
5082
|
-
);
|
|
4750
|
+
return findMapChartCurrentIndex({
|
|
4751
|
+
x: _touches$.x,
|
|
4752
|
+
y: _touches$.y
|
|
4753
|
+
}, this.opts);
|
|
4754
|
+
}else if (this.opts.type === 'word') {
|
|
4755
|
+
return findWordChartCurrentIndex({
|
|
4756
|
+
x: _touches$.x,
|
|
4757
|
+
y: _touches$.y
|
|
4758
|
+
}, this.opts.chartData.wordCloudData);
|
|
5083
4759
|
} else {
|
|
5084
|
-
return findCurrentIndex(
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
},
|
|
5089
|
-
this.opts.chartData.xAxisPoints,
|
|
5090
|
-
this.opts,
|
|
5091
|
-
this.config,
|
|
5092
|
-
Math.abs(this.scrollOption.currentOffset)
|
|
5093
|
-
);
|
|
4760
|
+
return findCurrentIndex({
|
|
4761
|
+
x: _touches$.x,
|
|
4762
|
+
y: _touches$.y
|
|
4763
|
+
}, this.opts.chartData.xAxisPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
|
|
5094
4764
|
}
|
|
5095
4765
|
}
|
|
5096
4766
|
return -1;
|
|
5097
4767
|
};
|
|
5098
4768
|
|
|
5099
|
-
Charts.prototype.getLegendDataIndex = function
|
|
4769
|
+
Charts.prototype.getLegendDataIndex = function(e) {
|
|
5100
4770
|
var touches = null;
|
|
5101
4771
|
if (e.changedTouches) {
|
|
5102
4772
|
touches = e.changedTouches[0];
|
|
@@ -5105,18 +4775,15 @@ Charts.prototype.getLegendDataIndex = function (e) {
|
|
|
5105
4775
|
}
|
|
5106
4776
|
if (touches) {
|
|
5107
4777
|
let _touches$ = getTouches(touches, this.opts, e);
|
|
5108
|
-
return findLegendIndex(
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
},
|
|
5113
|
-
this.opts.chartData.legendData
|
|
5114
|
-
);
|
|
4778
|
+
return findLegendIndex({
|
|
4779
|
+
x: _touches$.x,
|
|
4780
|
+
y: _touches$.y
|
|
4781
|
+
}, this.opts.chartData.legendData);
|
|
5115
4782
|
}
|
|
5116
4783
|
return -1;
|
|
5117
4784
|
};
|
|
5118
4785
|
|
|
5119
|
-
Charts.prototype.touchLegend = function
|
|
4786
|
+
Charts.prototype.touchLegend = function(e) {
|
|
5120
4787
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5121
4788
|
var touches = null;
|
|
5122
4789
|
if (e.changedTouches) {
|
|
@@ -5133,9 +4800,10 @@ Charts.prototype.touchLegend = function (e) {
|
|
|
5133
4800
|
drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
|
|
5134
4801
|
}
|
|
5135
4802
|
}
|
|
4803
|
+
|
|
5136
4804
|
};
|
|
5137
4805
|
|
|
5138
|
-
Charts.prototype.showToolTip = function
|
|
4806
|
+
Charts.prototype.showToolTip = function(e) {
|
|
5139
4807
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5140
4808
|
var touches = null;
|
|
5141
4809
|
if (e.changedTouches) {
|
|
@@ -5144,7 +4812,7 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5144
4812
|
touches = e.mp.changedTouches[0];
|
|
5145
4813
|
}
|
|
5146
4814
|
if (!touches) {
|
|
5147
|
-
console.log(
|
|
4815
|
+
console.log("touchError");
|
|
5148
4816
|
}
|
|
5149
4817
|
var _touches$ = getTouches(touches, this.opts, e);
|
|
5150
4818
|
var currentOffset = this.scrollOption.currentOffset;
|
|
@@ -5157,7 +4825,7 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5157
4825
|
if (index > -1) {
|
|
5158
4826
|
var seriesData = getSeriesDataItem(this.opts.series, index);
|
|
5159
4827
|
if (seriesData.length !== 0) {
|
|
5160
|
-
var _getToolTipData = getToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories,
|
|
4828
|
+
var _getToolTipData = getToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories,option),
|
|
5161
4829
|
textList = _getToolTipData.textList,
|
|
5162
4830
|
offset = _getToolTipData.offset;
|
|
5163
4831
|
offset.y = _touches$.y;
|
|
@@ -5181,13 +4849,7 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5181
4849
|
});
|
|
5182
4850
|
var seriesData = getSeriesDataItem(this.opts.series, index);
|
|
5183
4851
|
if (seriesData.length !== 0) {
|
|
5184
|
-
var _getMixToolTipData = getMixToolTipData(
|
|
5185
|
-
seriesData,
|
|
5186
|
-
this.opts.chartData.calPoints,
|
|
5187
|
-
index,
|
|
5188
|
-
this.opts.categories,
|
|
5189
|
-
option
|
|
5190
|
-
),
|
|
4852
|
+
var _getMixToolTipData = getMixToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories,option),
|
|
5191
4853
|
textList = _getMixToolTipData.textList,
|
|
5192
4854
|
offset = _getMixToolTipData.offset;
|
|
5193
4855
|
offset.y = _touches$.y;
|
|
@@ -5211,15 +4873,8 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5211
4873
|
});
|
|
5212
4874
|
var seriesData = getSeriesDataItem(this.opts.series, index);
|
|
5213
4875
|
if (seriesData.length !== 0) {
|
|
5214
|
-
var _getToolTipData = getCandleToolTipData(
|
|
5215
|
-
this.opts.
|
|
5216
|
-
seriesData,
|
|
5217
|
-
this.opts.chartData.calPoints,
|
|
5218
|
-
index,
|
|
5219
|
-
this.opts.categories,
|
|
5220
|
-
this.opts.extra.candle,
|
|
5221
|
-
option
|
|
5222
|
-
),
|
|
4876
|
+
var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts.chartData.calPoints,
|
|
4877
|
+
index, this.opts.categories, this.opts.extra.candle, option),
|
|
5223
4878
|
textList = _getToolTipData.textList,
|
|
5224
4879
|
offset = _getToolTipData.offset;
|
|
5225
4880
|
offset.y = _touches$.y;
|
|
@@ -5233,7 +4888,7 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5233
4888
|
}
|
|
5234
4889
|
drawCharts.call(this, opts.type, opts, this.config, this.context);
|
|
5235
4890
|
}
|
|
5236
|
-
if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose'
|
|
4891
|
+
if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose'||this.opts.type === 'funnel' ) {
|
|
5237
4892
|
var index = this.getCurrentDataIndex(e);
|
|
5238
4893
|
if (index > -1) {
|
|
5239
4894
|
var currentOffset = this.scrollOption.currentOffset;
|
|
@@ -5242,12 +4897,10 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5242
4897
|
animation: false
|
|
5243
4898
|
});
|
|
5244
4899
|
var seriesData = this.opts._series_[index];
|
|
5245
|
-
var textList = [
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
}
|
|
5250
|
-
];
|
|
4900
|
+
var textList = [{
|
|
4901
|
+
text: option.format ? option.format(seriesData) : seriesData.name + ': ' + seriesData.data,
|
|
4902
|
+
color: seriesData.color
|
|
4903
|
+
}];
|
|
5251
4904
|
var offset = {
|
|
5252
4905
|
x: _touches$.x,
|
|
5253
4906
|
y: _touches$.y
|
|
@@ -5261,7 +4914,7 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5261
4914
|
}
|
|
5262
4915
|
drawCharts.call(this, opts.type, opts, this.config, this.context);
|
|
5263
4916
|
}
|
|
5264
|
-
if (this.opts.type === 'map'
|
|
4917
|
+
if (this.opts.type === 'map'||this.opts.type === 'word') {
|
|
5265
4918
|
var index = this.getCurrentDataIndex(e);
|
|
5266
4919
|
if (index > -1) {
|
|
5267
4920
|
var currentOffset = this.scrollOption.currentOffset;
|
|
@@ -5270,12 +4923,10 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5270
4923
|
animation: false
|
|
5271
4924
|
});
|
|
5272
4925
|
var seriesData = this.opts._series_[index];
|
|
5273
|
-
var textList = [
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
}
|
|
5278
|
-
];
|
|
4926
|
+
var textList = [{
|
|
4927
|
+
text: option.format ? option.format(seriesData) : seriesData.properties.name ,
|
|
4928
|
+
color: seriesData.color
|
|
4929
|
+
}];
|
|
5279
4930
|
var offset = {
|
|
5280
4931
|
x: _touches$.x,
|
|
5281
4932
|
y: _touches$.y
|
|
@@ -5300,7 +4951,7 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5300
4951
|
});
|
|
5301
4952
|
var seriesData = getSeriesDataItem(this.opts.series, index);
|
|
5302
4953
|
if (seriesData.length !== 0) {
|
|
5303
|
-
var textList = seriesData.map(function
|
|
4954
|
+
var textList = seriesData.map(function(item) {
|
|
5304
4955
|
return {
|
|
5305
4956
|
text: option.format ? option.format(item) : item.name + ': ' + item.data,
|
|
5306
4957
|
color: item.color
|
|
@@ -5322,7 +4973,7 @@ Charts.prototype.showToolTip = function (e) {
|
|
|
5322
4973
|
}
|
|
5323
4974
|
};
|
|
5324
4975
|
|
|
5325
|
-
Charts.prototype.translate = function
|
|
4976
|
+
Charts.prototype.translate = function(distance) {
|
|
5326
4977
|
this.scrollOption = {
|
|
5327
4978
|
currentOffset: distance,
|
|
5328
4979
|
startTouchX: distance,
|
|
@@ -5336,7 +4987,7 @@ Charts.prototype.translate = function (distance) {
|
|
|
5336
4987
|
drawCharts.call(this, this.opts.type, opts, this.config, this.context);
|
|
5337
4988
|
};
|
|
5338
4989
|
|
|
5339
|
-
Charts.prototype.scrollStart = function
|
|
4990
|
+
Charts.prototype.scrollStart = function(e) {
|
|
5340
4991
|
var touches = null;
|
|
5341
4992
|
if (e.changedTouches) {
|
|
5342
4993
|
touches = e.changedTouches[0];
|
|
@@ -5349,7 +5000,7 @@ Charts.prototype.scrollStart = function (e) {
|
|
|
5349
5000
|
}
|
|
5350
5001
|
};
|
|
5351
5002
|
|
|
5352
|
-
Charts.prototype.scroll = function
|
|
5003
|
+
Charts.prototype.scroll = function(e) {
|
|
5353
5004
|
if (this.scrollOption.lastMoveTime === 0) {
|
|
5354
5005
|
this.scrollOption.lastMoveTime = Date.now();
|
|
5355
5006
|
}
|
|
@@ -5380,7 +5031,7 @@ Charts.prototype.scroll = function (e) {
|
|
|
5380
5031
|
}
|
|
5381
5032
|
};
|
|
5382
5033
|
|
|
5383
|
-
Charts.prototype.scrollEnd = function
|
|
5034
|
+
Charts.prototype.scrollEnd = function(e) {
|
|
5384
5035
|
if (this.opts.enableScroll === true) {
|
|
5385
5036
|
var _scrollOption = this.scrollOption,
|
|
5386
5037
|
currentOffset = _scrollOption.currentOffset,
|
|
@@ -5389,7 +5040,7 @@ Charts.prototype.scrollEnd = function (e) {
|
|
|
5389
5040
|
this.scrollOption.distance = 0;
|
|
5390
5041
|
}
|
|
5391
5042
|
};
|
|
5392
|
-
if (typeof module ===
|
|
5043
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
5393
5044
|
module.exports = Charts;
|
|
5394
5045
|
//export default Charts;//建议使用nodejs的module导出方式,如报错请使用export方式导出
|
|
5395
5046
|
}
|