tvcharts 0.8.88 → 0.8.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chart/candlePlot/candlePlotLayout.js +3 -0
- package/lib/component/alarm/AlarmView.js +6 -2
- package/lib/component/dataZoom/InsideZoomView.js +8 -0
- package/lib/component/helper/RoamController.js +9 -3
- package/lib/core/echarts.js +7 -7
- package/package.json +1 -1
- package/types/src/chart/candlePlot/candlePlotLayout.d.ts +1 -0
- package/types/src/component/helper/RoamController.d.ts +2 -0
- package/types/src/data/scale-time/types.d.ts +0 -7
|
@@ -224,4 +224,7 @@ function calculateCandleWidth(seriesModel, data) {
|
|
|
224
224
|
// return Math.floor(Math.max(bandWidth * 0.7, 1));
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
export function getRenderIndexX(bandWidth, x) {
|
|
228
|
+
return subPixelOptimize(x - bandWidth / 2, 1, false);
|
|
229
|
+
}
|
|
227
230
|
export default candlePlotLayout;
|
|
@@ -410,6 +410,9 @@ var AlarmView = /** @class */function (_super) {
|
|
|
410
410
|
// }
|
|
411
411
|
var selectId = this.model.get('selectedId');
|
|
412
412
|
if (selectId) {
|
|
413
|
+
if (this.mouseOverId) {
|
|
414
|
+
this.mouseOverId = '';
|
|
415
|
+
}
|
|
413
416
|
this.model.setSelectedId('');
|
|
414
417
|
this._reCreate(selectId);
|
|
415
418
|
}
|
|
@@ -420,8 +423,9 @@ var AlarmView = /** @class */function (_super) {
|
|
|
420
423
|
eventTool.stop(e.event);
|
|
421
424
|
this.dragAlarmId = id;
|
|
422
425
|
var selectId = this.model.get('selectedId');
|
|
423
|
-
if (selectId && selectId !== id) {
|
|
424
|
-
this.
|
|
426
|
+
if (selectId && selectId !== id || !this.mouseOverId) {
|
|
427
|
+
!this.mouseOverId && (this.mouseOverId = id);
|
|
428
|
+
this._reCreate(selectId || id);
|
|
425
429
|
}
|
|
426
430
|
this.model.setSelectedId(id);
|
|
427
431
|
// this.downStop = true;
|
|
@@ -47,6 +47,7 @@ import sliderMove from '../helper/sliderMove.js';
|
|
|
47
47
|
import * as roams from './roams.js';
|
|
48
48
|
import { bind } from 'tvrender/lib/core/util.js';
|
|
49
49
|
import { barSpaceLimit } from './helper.js';
|
|
50
|
+
import { getRenderIndexX } from '../../chart/candlePlot/candlePlotLayout.js';
|
|
50
51
|
var InsideZoomView = /** @class */function (_super) {
|
|
51
52
|
__extends(InsideZoomView, _super);
|
|
52
53
|
function InsideZoomView() {
|
|
@@ -109,6 +110,13 @@ var getRangeHandlers = {
|
|
|
109
110
|
if (e.inSitu) {
|
|
110
111
|
var extent = axisModel.axis.getExtent()[1];
|
|
111
112
|
var x = axisModel.axis.toLocalCoord(e.originX);
|
|
113
|
+
if (e.isPinch) {
|
|
114
|
+
var _a = axisModel.axis.scale.getExtent(),
|
|
115
|
+
startIndex = _a[0],
|
|
116
|
+
endIndex = _a[1];
|
|
117
|
+
var basex = axisModel.axis.toLocalCoord(axisModel.axis.dataToCoord(Math.floor((endIndex + startIndex) / 2)));
|
|
118
|
+
x = getRenderIndexX(axisModel.axis.getBandWidth(), basex);
|
|
119
|
+
}
|
|
112
120
|
var dataCount = axisModel.axis.scale.getAxisDataLen();
|
|
113
121
|
var deltaFromRight = (extent - x) / lastDistanceRange[0];
|
|
114
122
|
var floatIndex = dataCount + distanceRange[1] - deltaFromRight;
|
|
@@ -242,17 +242,23 @@ var RoamController = /** @class */function (_super) {
|
|
|
242
242
|
if (interactionMutex.isTaken(this._zr, 'globalPan')) {
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
// const scale = e.pinchScale > 1 ? 1.03 : 1 / 1.03;
|
|
246
|
+
var scale = e.pinchScale;
|
|
247
247
|
// if (e.pinchScale === 1) {
|
|
248
248
|
// console.log('%c [ e ]-316', 'font-size:13px; background:pink; color:#bf2c9f;', e)
|
|
249
249
|
// }
|
|
250
|
+
// const now = Date.now();
|
|
251
|
+
// if (this._lastPinchTime && now - this._lastPinchTime < 16) {
|
|
252
|
+
// return;
|
|
253
|
+
// }
|
|
254
|
+
// this._lastPinchTime = now;
|
|
250
255
|
checkPointerAndTrigger(this, 'zoom', 'zoomOnMouseWheel', e, {
|
|
251
256
|
scale: scale,
|
|
252
257
|
originX: e.pinchX,
|
|
253
258
|
originY: e.pinchY,
|
|
254
259
|
isAvailableBehavior: null,
|
|
255
|
-
inSitu: true
|
|
260
|
+
inSitu: true,
|
|
261
|
+
isPinch: true
|
|
256
262
|
});
|
|
257
263
|
};
|
|
258
264
|
RoamController.prototype._kineticScroll = function () {
|
package/lib/core/echarts.js
CHANGED
|
@@ -939,10 +939,8 @@ var ECharts = /** @class */function (_super) {
|
|
|
939
939
|
defaultMainType: 'series'
|
|
940
940
|
});
|
|
941
941
|
var seriesModel = parsedFinder.seriesModel;
|
|
942
|
-
if (
|
|
943
|
-
|
|
944
|
-
warn('There is no specified series model');
|
|
945
|
-
}
|
|
942
|
+
if (!seriesModel) {
|
|
943
|
+
return;
|
|
946
944
|
}
|
|
947
945
|
// const data = seriesModel.getData();
|
|
948
946
|
var dataIndex = parsedFinder.hasOwnProperty('dataIndex') ? parsedFinder.dataIndex : 0;
|
|
@@ -2877,9 +2875,11 @@ export function connectLayoutAction(layoutId, action) {
|
|
|
2877
2875
|
return layoutId;
|
|
2878
2876
|
}
|
|
2879
2877
|
export function disconnectLayoutAction(layoutId, action) {
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2878
|
+
if (layoutEventAbleMap[layoutId]) {
|
|
2879
|
+
layoutEventAbleMap[layoutId] = layoutEventAbleMap[layoutId].filter(function (item) {
|
|
2880
|
+
return item !== action;
|
|
2881
|
+
});
|
|
2882
|
+
}
|
|
2883
2883
|
return layoutId;
|
|
2884
2884
|
}
|
|
2885
2885
|
export function disconnectLayouts(layoutId) {
|
package/package.json
CHANGED
|
@@ -12,4 +12,5 @@ export interface CandlePlotLayoutMeta {
|
|
|
12
12
|
}
|
|
13
13
|
declare const candlePlotLayout: StageHandler;
|
|
14
14
|
export declare function optimalCandlestickWidth(barSpacing: number, pixelRatio: number): number;
|
|
15
|
+
export declare function getRenderIndexX(bandWidth: number, x: number): number;
|
|
15
16
|
export default candlePlotLayout;
|
|
@@ -21,6 +21,7 @@ export interface RoamEventParams {
|
|
|
21
21
|
originX: number;
|
|
22
22
|
originY: number;
|
|
23
23
|
inSitu?: boolean;
|
|
24
|
+
isPinch?: boolean;
|
|
24
25
|
isAvailableBehavior: Bind3<typeof isAvailableBehavior, null, RoamBehavior, ZRElementEvent>;
|
|
25
26
|
};
|
|
26
27
|
'scrollMove': {
|
|
@@ -63,6 +64,7 @@ declare class RoamController extends Eventful<{
|
|
|
63
64
|
private _opt;
|
|
64
65
|
private _dragging;
|
|
65
66
|
private _pinching;
|
|
67
|
+
private _lastPinchTime;
|
|
66
68
|
private _x;
|
|
67
69
|
private _y;
|
|
68
70
|
private _startX;
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Describes a weight of tick mark, i.e. a part of a time that changed since previous time.
|
|
3
|
-
* Note that you can use any timezone to calculate this value, it is unnecessary to use UTC.
|
|
4
|
-
*
|
|
5
|
-
* @example Between 2020-01-01 and 2020-01-02 there is a day of difference, i.e. for 2020-01-02 weight would be a day.
|
|
6
|
-
* @example Between 2020-01-01 and 2020-02-02 there is a month of difference, i.e. for 2020-02-02 weight would be a month.
|
|
7
|
-
*/
|
|
8
1
|
export declare const enum TickMarkWeight {
|
|
9
2
|
LessThanSecond = 0,
|
|
10
3
|
Second = 10,
|