tvcharts 0.9.36 → 0.9.38
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.
|
@@ -54,6 +54,14 @@ var positiveColorQuery = ['itemStyle', 'color'];
|
|
|
54
54
|
var negativeColorQuery = ['itemStyle', 'color0'];
|
|
55
55
|
var positiveWickColorQuery = ['itemStyle', 'wickColor'];
|
|
56
56
|
var negativeWickColorQuery = ['itemStyle', 'wickColor0'];
|
|
57
|
+
function getFormatSumVol(vol) {
|
|
58
|
+
if (vol > 1000000) {
|
|
59
|
+
return vol / 1000000;
|
|
60
|
+
} else if (vol > 1000) {
|
|
61
|
+
return vol / 1000;
|
|
62
|
+
}
|
|
63
|
+
return vol;
|
|
64
|
+
}
|
|
57
65
|
function getColor(sign, model, ignoreParentColor) {
|
|
58
66
|
return model.get(sign > 0 ? positiveColorQuery : negativeColorQuery, ignoreParentColor);
|
|
59
67
|
}
|
|
@@ -155,6 +163,7 @@ var volPathLayout = {
|
|
|
155
163
|
var textColorByBg = new Map();
|
|
156
164
|
var lastIndex = candleData.count(true) - 1;
|
|
157
165
|
var maxSumVol = 0;
|
|
166
|
+
var maxFSumVol = 0;
|
|
158
167
|
var rectHeight = 0;
|
|
159
168
|
for (var dataIndex = params.start; dataIndex < params.end; dataIndex++) {
|
|
160
169
|
if (showLast && lastIndex - candleData.getRawIndex(dataIndex) >= showLast) {
|
|
@@ -245,8 +254,10 @@ var volPathLayout = {
|
|
|
245
254
|
var leftX = buyX;
|
|
246
255
|
var firstBottomY = 0;
|
|
247
256
|
var maxVol = Math.max(maxBuy, maxSell);
|
|
248
|
-
|
|
257
|
+
var maxFVol = getFormatSumVol(maxVol);
|
|
258
|
+
if (maxFVol > maxFSumVol) {
|
|
249
259
|
maxSumVol = maxVol;
|
|
260
|
+
maxFSumVol = maxFVol;
|
|
250
261
|
}
|
|
251
262
|
// const pocItem = volList[pocIndex];
|
|
252
263
|
each(volList, function (item, i) {
|
|
@@ -536,7 +536,7 @@ function setEventData(el, graphicModel, elOption) {
|
|
|
536
536
|
}
|
|
537
537
|
// `elOption.info` enables user to mount some info on
|
|
538
538
|
// elements and use them in event handlers.
|
|
539
|
-
if (eventData) {
|
|
539
|
+
if (eventData && elOption.hasOwnProperty('info')) {
|
|
540
540
|
eventData.info = elOption.info;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
@@ -45,52 +45,45 @@ export function weightToTickMarkType(weight, timeVisible, secondsVisible) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
var dateTimeFormatCache = {};
|
|
49
|
+
function getDateTimeFormat(locale, timeZone, tickMarkType) {
|
|
50
|
+
var key = locale + '\0' + timeZone + '\0' + tickMarkType;
|
|
51
|
+
var fmt = dateTimeFormatCache[key];
|
|
52
|
+
if (!fmt) {
|
|
53
|
+
var options = {
|
|
54
|
+
timeZone: timeZone
|
|
55
|
+
};
|
|
56
|
+
switch (tickMarkType) {
|
|
57
|
+
case 0 /* Year */:
|
|
58
|
+
options.year = 'numeric';
|
|
59
|
+
break;
|
|
60
|
+
case 1 /* Month */:
|
|
61
|
+
options.month = 'short';
|
|
62
|
+
break;
|
|
63
|
+
case 2 /* DayOfMonth */:
|
|
64
|
+
options.day = 'numeric';
|
|
65
|
+
break;
|
|
66
|
+
case 3 /* Time */:
|
|
67
|
+
options.hour12 = false;
|
|
68
|
+
options.hour = '2-digit';
|
|
69
|
+
options.minute = '2-digit';
|
|
70
|
+
break;
|
|
71
|
+
case 4 /* TimeWithSeconds */:
|
|
72
|
+
options.hour12 = false;
|
|
73
|
+
options.hour = '2-digit';
|
|
74
|
+
options.minute = '2-digit';
|
|
75
|
+
options.second = '2-digit';
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
fmt = new Intl.DateTimeFormat(locale, options);
|
|
79
|
+
dateTimeFormatCache[key] = fmt;
|
|
80
|
+
}
|
|
81
|
+
return fmt;
|
|
82
|
+
}
|
|
48
83
|
export function defaultTickMarkFormatter(timePoint, tickMarkType, locale, timeZone) {
|
|
49
84
|
if (timeZone === void 0) {
|
|
50
85
|
timeZone = 'Asia/Shanghai';
|
|
51
86
|
}
|
|
52
|
-
var formatOptions = {
|
|
53
|
-
timeZone: timeZone
|
|
54
|
-
};
|
|
55
|
-
switch (tickMarkType) {
|
|
56
|
-
case 0 /* Year */:
|
|
57
|
-
formatOptions.year = 'numeric';
|
|
58
|
-
break;
|
|
59
|
-
case 1 /* Month */:
|
|
60
|
-
formatOptions.month = 'short';
|
|
61
|
-
break;
|
|
62
|
-
case 2 /* DayOfMonth */:
|
|
63
|
-
formatOptions.day = 'numeric';
|
|
64
|
-
break;
|
|
65
|
-
case 3 /* Time */:
|
|
66
|
-
formatOptions.hour12 = false;
|
|
67
|
-
formatOptions.hour = '2-digit';
|
|
68
|
-
formatOptions.minute = '2-digit';
|
|
69
|
-
break;
|
|
70
|
-
case 4 /* TimeWithSeconds */:
|
|
71
|
-
formatOptions.hour12 = false;
|
|
72
|
-
formatOptions.hour = '2-digit';
|
|
73
|
-
formatOptions.minute = '2-digit';
|
|
74
|
-
formatOptions.second = '2-digit';
|
|
75
|
-
break;
|
|
76
|
-
default:
|
|
77
|
-
return '';
|
|
78
|
-
}
|
|
79
87
|
var date = new Date(timePoint.timestamp * 1000);
|
|
80
|
-
return
|
|
81
|
-
// const date = timePoint.businessDay === undefined
|
|
82
|
-
// ? new Date(timePoint.timestamp * 1000)
|
|
83
|
-
// : new Date(Date.UTC(timePoint.businessDay.year, timePoint.businessDay.month - 1, timePoint.businessDay.day));
|
|
84
|
-
// // from given date we should use only as UTC date or timestamp
|
|
85
|
-
// // but to format as locale date we can convert UTC date to local date
|
|
86
|
-
// const localDateFromUtc = new Date(
|
|
87
|
-
// date.getUTCFullYear(),
|
|
88
|
-
// date.getUTCMonth(),
|
|
89
|
-
// date.getUTCDate(),
|
|
90
|
-
// date.getUTCHours(),
|
|
91
|
-
// date.getUTCMinutes(),
|
|
92
|
-
// date.getUTCSeconds(),
|
|
93
|
-
// date.getUTCMilliseconds()
|
|
94
|
-
// );
|
|
95
|
-
// return localDateFromUtc.toLocaleString(locale, formatOptions);
|
|
88
|
+
return getDateTimeFormat(locale, timeZone, tickMarkType).format(date);
|
|
96
89
|
}
|