@devexperts/dxcharts-lite 2.7.1 → 2.7.2
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/dist/chart/animation/canvas-animation.d.ts +19 -21
- package/dist/chart/animation/canvas-animation.js +19 -19
- package/dist/chart/animation/types/animation.d.ts +5 -17
- package/dist/chart/animation/types/animation.js +12 -17
- package/dist/chart/animation/types/color-alpha-animation.js +11 -21
- package/dist/chart/animation/types/viewport-movement-animation.d.ts +1 -1
- package/dist/chart/animation/viewport-model-animation.js +2 -2
- package/dist/chart/chart.config.d.ts +7 -0
- package/dist/chart/chart.config.js +4 -0
- package/dist/chart/components/chart/chart.component.d.ts +11 -0
- package/dist/chart/components/chart/chart.component.js +11 -0
- package/dist/chart/components/pane/pane.component.js +5 -1
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +4 -1
- package/dist/chart/components/y_axis/y-axis.component.d.ts +5 -1
- package/dist/chart/components/y_axis/y-axis.component.js +11 -5
- package/dist/chart/components/y_axis/y-axis.drawer.js +5 -3
- package/dist/chart/components/y_axis/y-axis.model.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +2 -2
- package/dist/chart/drawers/chart-type-drawers/area.drawer.js +5 -5
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +2 -2
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +6 -6
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +2 -2
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +8 -8
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +3 -3
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +20 -16
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +2 -2
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +5 -5
- package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +2 -2
- package/dist/chart/drawers/chart-type-drawers/line.drawer.js +5 -5
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +2 -2
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +4 -3
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +2 -2
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +4 -4
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +9 -9
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +3 -3
- package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/linear.drawer.js +3 -3
- package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/points.drawer.js +3 -3
- package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/text.drawer.js +2 -2
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +16 -13
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +2 -2
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +2 -2
- package/dist/chart/drawers/data-series.drawer.d.ts +5 -5
- package/dist/chart/drawers/data-series.drawer.js +3 -3
- package/dist/chart/drawers/ht-data-series.drawer.js +2 -2
- package/dist/chart/model/scale.model.js +4 -0
- package/dist/dxchart.min.js +4 -4
- package/package.json +1 -1
|
@@ -4,25 +4,26 @@
|
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
6
|
import { flat } from '../../utils/array.utils';
|
|
7
|
+
import { setLineWidth } from '../data-series.drawer';
|
|
7
8
|
export class TrendHistogramDrawer {
|
|
8
9
|
constructor() { }
|
|
9
|
-
draw(ctx, allPoints, model) {
|
|
10
|
+
draw(ctx, allPoints, model, hitTestDrawerConfig) {
|
|
10
11
|
const zero = model.view.toY(0);
|
|
11
12
|
// here I do flat, thinks that there is no more that 1 series
|
|
12
13
|
const allPointsFlat = flat(allPoints);
|
|
13
14
|
const config = model.getPaintConfig(0);
|
|
15
|
+
setLineWidth(ctx, config.lineWidth, model, hitTestDrawerConfig, config.hoveredLineWidth);
|
|
14
16
|
allPointsFlat.forEach((point, idx) => {
|
|
15
|
-
var _a, _b;
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
16
18
|
// odd width is crucial to draw histogram without antialiasing
|
|
17
19
|
// 2 colors: Negative and Positive
|
|
18
20
|
if (((_a = config.multiplyColors) === null || _a === void 0 ? void 0 : _a.length) === 2) {
|
|
19
21
|
ctx.strokeStyle =
|
|
20
|
-
(point.close < this.previousValue(allPointsFlat, idx)
|
|
22
|
+
(_b = hitTestDrawerConfig.color) !== null && _b !== void 0 ? _b : ((point.close < this.previousValue(allPointsFlat, idx)
|
|
21
23
|
? config.multiplyColors[1]
|
|
22
24
|
: config.multiplyColors[0]) ||
|
|
23
25
|
config.color ||
|
|
24
|
-
'#FF00FF';
|
|
25
|
-
ctx.lineWidth = config.lineWidth;
|
|
26
|
+
'#FF00FF');
|
|
26
27
|
ctx.beginPath();
|
|
27
28
|
const x = model.view.toX(point.centerUnit);
|
|
28
29
|
const y = model.view.toY(point.close);
|
|
@@ -32,21 +33,24 @@ export class TrendHistogramDrawer {
|
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
35
|
// 4 colors: Negative and Down, Negative and Up, Positive and Down, Positive and Up
|
|
35
|
-
if (((
|
|
36
|
+
if (((_c = config.multiplyColors) === null || _c === void 0 ? void 0 : _c.length) === 4) {
|
|
36
37
|
const prevPointClose = this.previousValue(allPointsFlat, idx);
|
|
37
38
|
if (point.close < prevPointClose && point.close < 0) {
|
|
38
|
-
ctx.strokeStyle =
|
|
39
|
+
ctx.strokeStyle =
|
|
40
|
+
(_d = hitTestDrawerConfig.color) !== null && _d !== void 0 ? _d : (config.multiplyColors[0] || config.color || '#FF00FF');
|
|
39
41
|
}
|
|
40
42
|
if (point.close > prevPointClose && point.close < 0) {
|
|
41
|
-
ctx.strokeStyle =
|
|
43
|
+
ctx.strokeStyle =
|
|
44
|
+
(_e = hitTestDrawerConfig.color) !== null && _e !== void 0 ? _e : (config.multiplyColors[1] || config.color || '#FF00FF');
|
|
42
45
|
}
|
|
43
46
|
if (point.close < prevPointClose && point.close > 0) {
|
|
44
|
-
ctx.strokeStyle =
|
|
47
|
+
ctx.strokeStyle =
|
|
48
|
+
(_f = hitTestDrawerConfig.color) !== null && _f !== void 0 ? _f : (config.multiplyColors[2] || config.color || '#FF00FF');
|
|
45
49
|
}
|
|
46
50
|
if (point.close > prevPointClose && point.close > 0) {
|
|
47
|
-
ctx.strokeStyle =
|
|
51
|
+
ctx.strokeStyle =
|
|
52
|
+
(_g = hitTestDrawerConfig.color) !== null && _g !== void 0 ? _g : (config.multiplyColors[3] || config.color || '#FF00FF');
|
|
48
53
|
}
|
|
49
|
-
ctx.lineWidth = config.lineWidth;
|
|
50
54
|
ctx.beginPath();
|
|
51
55
|
const x = model.view.toX(point.centerUnit);
|
|
52
56
|
const y = model.view.toY(point.close);
|
|
@@ -56,8 +60,7 @@ export class TrendHistogramDrawer {
|
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
58
62
|
// 1 color
|
|
59
|
-
ctx.strokeStyle = config.color || '#FF00FF';
|
|
60
|
-
ctx.lineWidth = config.lineWidth;
|
|
63
|
+
ctx.strokeStyle = (_h = hitTestDrawerConfig.color) !== null && _h !== void 0 ? _h : (config.color || '#FF00FF');
|
|
61
64
|
ctx.beginPath();
|
|
62
65
|
const x = model.view.toX(point.centerUnit);
|
|
63
66
|
const y = model.view.toY(point.close);
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
6
|
import { DataSeriesModel, VisualSeriesPoint } from '../../model/data-series.model';
|
|
7
|
-
import {
|
|
7
|
+
import { HTSeriesDrawerConfig, SeriesDrawer } from '../data-series.drawer';
|
|
8
8
|
export declare class TriangleDrawer implements SeriesDrawer {
|
|
9
9
|
constructor();
|
|
10
|
-
draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel,
|
|
10
|
+
draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig): void;
|
|
11
11
|
private drawCandleTriangle;
|
|
12
12
|
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export class TriangleDrawer {
|
|
7
7
|
constructor() { }
|
|
8
|
-
draw(ctx, allPoints, model,
|
|
8
|
+
draw(ctx, allPoints, model, hitTestDrawerConfig) {
|
|
9
9
|
allPoints.forEach((points, idx) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const config = model.getPaintConfig(idx);
|
|
12
|
-
ctx.fillStyle = (_a =
|
|
12
|
+
ctx.fillStyle = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : config.color;
|
|
13
13
|
points.forEach(p => {
|
|
14
14
|
const x = model.view.toX(p.centerUnit);
|
|
15
15
|
const y = model.view.toY(p.close);
|
|
@@ -7,16 +7,16 @@ import { DynamicModelDrawer } from '../components/dynamic-objects/dynamic-object
|
|
|
7
7
|
import { PaneManager } from '../components/pane/pane-manager.component';
|
|
8
8
|
import { CanvasModel } from '../model/canvas.model';
|
|
9
9
|
import { DataSeriesModel, VisualSeriesPoint } from '../model/data-series.model';
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export interface HTSeriesDrawerConfig {
|
|
11
|
+
color?: string;
|
|
12
|
+
hoverWidth?: number;
|
|
13
13
|
}
|
|
14
14
|
export interface SeriesDrawer {
|
|
15
15
|
draw: (ctx: CanvasRenderingContext2D,
|
|
16
16
|
/**
|
|
17
17
|
* You can pass two-dimension array to divide series into multiple parts
|
|
18
18
|
*/
|
|
19
|
-
points: VisualSeriesPoint[][], model: DataSeriesModel,
|
|
19
|
+
points: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig) => void;
|
|
20
20
|
}
|
|
21
21
|
export declare const transformToTwoDimension: (points: VisualSeriesPoint[] | VisualSeriesPoint[][]) => VisualSeriesPoint[][];
|
|
22
22
|
/**
|
|
@@ -32,4 +32,4 @@ export declare class DataSeriesDrawer implements DynamicModelDrawer<DataSeriesMo
|
|
|
32
32
|
draw(canvasModel: CanvasModel, model: DataSeriesModel, paneUUID?: string): void;
|
|
33
33
|
drawSeries(ctx: CanvasRenderingContext2D, series: DataSeriesModel): void;
|
|
34
34
|
}
|
|
35
|
-
export declare const setLineWidth: (ctx: CanvasRenderingContext2D, lineWidth: number, dataSeries: DataSeriesModel,
|
|
35
|
+
export declare const setLineWidth: (ctx: CanvasRenderingContext2D, lineWidth: number, dataSeries: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig, seriesSelectedWidth?: number) => void;
|
|
@@ -43,9 +43,9 @@ export class DataSeriesDrawer {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
export const setLineWidth = (ctx, lineWidth, dataSeries,
|
|
47
|
-
if (
|
|
48
|
-
ctx.lineWidth =
|
|
46
|
+
export const setLineWidth = (ctx, lineWidth, dataSeries, hitTestDrawerConfig, seriesSelectedWidth = lineWidth) => {
|
|
47
|
+
if (hitTestDrawerConfig.hoverWidth) {
|
|
48
|
+
ctx.lineWidth = hitTestDrawerConfig.hoverWidth;
|
|
49
49
|
}
|
|
50
50
|
else if (dataSeries.highlighted) {
|
|
51
51
|
ctx.lineWidth = lineWidth !== seriesSelectedWidth ? lineWidth + 1 : seriesSelectedWidth;
|
|
@@ -31,8 +31,8 @@ export class HTDataSeriesDrawer {
|
|
|
31
31
|
const drawer = this.seriesDrawers[paintTool];
|
|
32
32
|
if (drawer) {
|
|
33
33
|
const drawConfig = {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
color: this.canvasModel.idToColor(series.htId),
|
|
35
|
+
hoverWidth: 7,
|
|
36
36
|
};
|
|
37
37
|
// +- 1 to correctly draw points which are partly inside bounds
|
|
38
38
|
drawer.draw(ctx, series.getSeriesInViewport(series.scale.xStart - 1, series.scale.xEnd + 1), series, drawConfig);
|
|
@@ -125,6 +125,7 @@ export class ScaleModel extends ViewportModel {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
zoomXTo(state, zoomIn, forceNoAnimation) {
|
|
128
|
+
var _a;
|
|
128
129
|
const initialStateCopy = this.export();
|
|
129
130
|
const constrainedState = this.scalePostProcessor(initialStateCopy, state);
|
|
130
131
|
this.zoomReached = this.calculateZoomReached(constrainedState.zoomX, zoomIn);
|
|
@@ -141,6 +142,7 @@ export class ScaleModel extends ViewportModel {
|
|
|
141
142
|
this.apply(constrainedState);
|
|
142
143
|
}
|
|
143
144
|
else {
|
|
145
|
+
(_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.tick();
|
|
144
146
|
startViewportModelAnimation(this.canvasAnimation, this, constrainedState);
|
|
145
147
|
}
|
|
146
148
|
}
|
|
@@ -169,6 +171,7 @@ export class ScaleModel extends ViewportModel {
|
|
|
169
171
|
* @param forceNoAutoScale - force NOT apply auto-scaling (for lazy loading)
|
|
170
172
|
*/
|
|
171
173
|
setXScale(xStart, xEnd, forceNoAnimation = true) {
|
|
174
|
+
var _a;
|
|
172
175
|
const initialState = this.export();
|
|
173
176
|
const zoomX = this.calculateZoomX(xStart, xEnd);
|
|
174
177
|
if (initialState.xStart === xStart && initialState.xEnd === xEnd && initialState.zoomX > 0) {
|
|
@@ -192,6 +195,7 @@ export class ScaleModel extends ViewportModel {
|
|
|
192
195
|
this.apply(constrainedState);
|
|
193
196
|
}
|
|
194
197
|
else {
|
|
198
|
+
(_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.tick();
|
|
195
199
|
startViewportModelAnimation(this.canvasAnimation, this, constrainedState);
|
|
196
200
|
}
|
|
197
201
|
}
|