@devexperts/dxcharts-lite 2.7.0 → 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/chart/chart.model.js +1 -1
- package/dist/chart/components/pane/pane-manager.component.d.ts +3 -1
- package/dist/chart/components/pane/pane-manager.component.js +7 -5
- package/dist/chart/components/pane/pane.component.d.ts +1 -1
- package/dist/chart/components/pane/pane.component.js +12 -6
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +2 -0
- package/dist/chart/components/resizer/bar-resizer.component.js +11 -9
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +4 -1
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +0 -5
- 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/data-series-view.js +3 -1
- package/dist/chart/model/data-series.model.js +1 -1
- package/dist/chart/model/scale.model.js +4 -0
- package/dist/dxchart.min.js +4 -4
- package/package.json +1 -1
|
@@ -9,14 +9,14 @@ import { firstOf, lastOf } from '../../utils/array.utils';
|
|
|
9
9
|
import { toRGBA } from '../../utils/color.utils';
|
|
10
10
|
export class DifferenceCloudDrawer {
|
|
11
11
|
constructor() { }
|
|
12
|
-
draw(ctx, allPoints, model,
|
|
12
|
+
draw(ctx, allPoints, model, hitTestDrawerConfig) {
|
|
13
13
|
if (model.config.visible) {
|
|
14
14
|
// draw main line
|
|
15
15
|
allPoints.forEach((points, idx) => {
|
|
16
16
|
var _a;
|
|
17
17
|
const config = model.getPaintConfig(idx);
|
|
18
|
-
setLineWidth(ctx, config.lineWidth, model,
|
|
19
|
-
const lineColor = (_a =
|
|
18
|
+
setLineWidth(ctx, config.lineWidth, model, hitTestDrawerConfig, config.hoveredLineWidth);
|
|
19
|
+
const lineColor = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : config.color;
|
|
20
20
|
ctx.strokeStyle = lineColor;
|
|
21
21
|
this.drawLine(ctx, points, model.view);
|
|
22
22
|
});
|
|
@@ -42,7 +42,7 @@ export class DifferenceCloudDrawer {
|
|
|
42
42
|
}
|
|
43
43
|
const curSeriesColor = mainSeries.getPaintConfig(idx).color;
|
|
44
44
|
const nextSeriesColor = linkedSeries.getPaintConfig(linkedSeriesIdx).color;
|
|
45
|
-
this.drawDifference(ctx, curSeriesColor, nextSeriesColor, differencePoints, mainSeries, linkedSeries,
|
|
45
|
+
this.drawDifference(ctx, curSeriesColor, nextSeriesColor, differencePoints, mainSeries, linkedSeries, hitTestDrawerConfig);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -53,7 +53,7 @@ export class DifferenceCloudDrawer {
|
|
|
53
53
|
buildLinePath(points, ctx, view);
|
|
54
54
|
ctx.stroke();
|
|
55
55
|
}
|
|
56
|
-
drawDifference(ctx, lineColor, nextLineColor, diffPoints, curSeries, nextSeries,
|
|
56
|
+
drawDifference(ctx, lineColor, nextLineColor, diffPoints, curSeries, nextSeries, hitTestDrawerConfig) {
|
|
57
57
|
const [linePoints, nextLinePoints] = [[], []];
|
|
58
58
|
diffPoints.forEach(points => {
|
|
59
59
|
const [point, nextPoint] = points.diffPoints;
|
|
@@ -62,10 +62,10 @@ export class DifferenceCloudDrawer {
|
|
|
62
62
|
});
|
|
63
63
|
const curSeriesPoints = mapDataSeriesDiffPointsIntoPoints(linePoints, curSeries.view);
|
|
64
64
|
const nextSeriesPoints = mapDataSeriesDiffPointsIntoPoints(nextLinePoints, nextSeries.view);
|
|
65
|
-
this.fillCloud(ctx, nextLineColor, curSeriesPoints, nextSeriesPoints,
|
|
66
|
-
this.fillCloud(ctx, lineColor, nextSeriesPoints, curSeriesPoints,
|
|
65
|
+
this.fillCloud(ctx, nextLineColor, curSeriesPoints, nextSeriesPoints, hitTestDrawerConfig);
|
|
66
|
+
this.fillCloud(ctx, lineColor, nextSeriesPoints, curSeriesPoints, hitTestDrawerConfig);
|
|
67
67
|
}
|
|
68
|
-
fillCloud(ctx, color, linePoints, nextLinePoints,
|
|
68
|
+
fillCloud(ctx, color, linePoints, nextLinePoints, hitTestDrawerConfig) {
|
|
69
69
|
var _a, _b, _c, _d;
|
|
70
70
|
ctx.save();
|
|
71
71
|
// clip above lowerLine
|
|
@@ -95,7 +95,7 @@ export class DifferenceCloudDrawer {
|
|
|
95
95
|
ctx.lineTo(p.x, p.y);
|
|
96
96
|
});
|
|
97
97
|
ctx.closePath();
|
|
98
|
-
ctx.fillStyle =
|
|
98
|
+
ctx.fillStyle = hitTestDrawerConfig.color ? hitTestDrawerConfig.color : toRGBA(color ? color : '#383838', 0.3);
|
|
99
99
|
ctx.fill();
|
|
100
100
|
ctx.restore();
|
|
101
101
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
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 HistogramDrawer 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
|
}
|
|
@@ -7,14 +7,14 @@ import { floor } from '../../utils/math.utils';
|
|
|
7
7
|
import { setLineWidth } from '../data-series.drawer';
|
|
8
8
|
export class HistogramDrawer {
|
|
9
9
|
constructor() { }
|
|
10
|
-
draw(ctx, allPoints, model,
|
|
10
|
+
draw(ctx, allPoints, model, hitTestDrawerConfig) {
|
|
11
11
|
const zero = model.view.toY(0);
|
|
12
12
|
allPoints.forEach((points, idx) => {
|
|
13
13
|
var _a;
|
|
14
14
|
// odd width is crucial to draw histogram without antialiasing
|
|
15
15
|
const config = model.getPaintConfig(idx);
|
|
16
|
-
setLineWidth(ctx, config.lineWidth, model,
|
|
17
|
-
ctx.strokeStyle = (_a =
|
|
16
|
+
setLineWidth(ctx, config.lineWidth, model, hitTestDrawerConfig, config.hoveredLineWidth);
|
|
17
|
+
ctx.strokeStyle = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : config.color;
|
|
18
18
|
ctx.beginPath();
|
|
19
19
|
points.forEach(p => {
|
|
20
20
|
const x = model.view.toX(p.centerUnit);
|
|
@@ -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 LinearDrawer 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 drawLinePath;
|
|
12
12
|
}
|
|
@@ -7,12 +7,12 @@ import { setLineWidth } from '../data-series.drawer';
|
|
|
7
7
|
import { buildLinePath } from './data-series-drawers.utils';
|
|
8
8
|
export class LinearDrawer {
|
|
9
9
|
constructor() { }
|
|
10
|
-
draw(ctx, allPoints, model,
|
|
10
|
+
draw(ctx, allPoints, model, hitTestDrawerConfig) {
|
|
11
11
|
allPoints.forEach((points, idx) => {
|
|
12
12
|
var _a;
|
|
13
13
|
const config = model.getPaintConfig(idx);
|
|
14
|
-
setLineWidth(ctx, config.lineWidth, model,
|
|
15
|
-
ctx.strokeStyle = (_a =
|
|
14
|
+
setLineWidth(ctx, config.lineWidth, model, hitTestDrawerConfig, config.hoveredLineWidth);
|
|
15
|
+
ctx.strokeStyle = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : config.color;
|
|
16
16
|
this.drawLinePath(ctx, points, model.view);
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
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 PointsDrawer 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
|
}
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export class PointsDrawer {
|
|
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
|
-
const radius = config.lineWidth;
|
|
13
|
-
ctx.fillStyle = (_a =
|
|
12
|
+
const radius = hitTestDrawerConfig.hoverWidth ? hitTestDrawerConfig.hoverWidth / 2 : config.lineWidth;
|
|
13
|
+
ctx.fillStyle = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : config.color;
|
|
14
14
|
ctx.lineWidth = 1;
|
|
15
15
|
points.forEach(p => {
|
|
16
16
|
ctx.beginPath();
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { FullChartConfig } from '../../chart.config';
|
|
7
7
|
import { DataSeriesModel, VisualSeriesPoint } from '../../model/data-series.model';
|
|
8
|
-
import {
|
|
8
|
+
import { HTSeriesDrawerConfig, SeriesDrawer } from '../data-series.drawer';
|
|
9
9
|
export declare class TextDrawer implements SeriesDrawer {
|
|
10
10
|
private config;
|
|
11
11
|
constructor(config: FullChartConfig);
|
|
12
|
-
draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel,
|
|
12
|
+
draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig): void;
|
|
13
13
|
}
|
|
@@ -8,12 +8,12 @@ export class TextDrawer {
|
|
|
8
8
|
constructor(config) {
|
|
9
9
|
this.config = config;
|
|
10
10
|
}
|
|
11
|
-
draw(ctx, allPoints, model,
|
|
11
|
+
draw(ctx, allPoints, model, hitTestDrawerConfig) {
|
|
12
12
|
ctx.save();
|
|
13
13
|
allPoints.forEach((points, idx) => {
|
|
14
14
|
var _a;
|
|
15
15
|
const config = model.getPaintConfig(idx);
|
|
16
|
-
ctx.fillStyle = (_a =
|
|
16
|
+
ctx.fillStyle = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : config.color;
|
|
17
17
|
const font = config.lineWidth + 'px ' + this.config.components.yAxis.fontFamily;
|
|
18
18
|
ctx.font = font;
|
|
19
19
|
points.forEach(p => {
|
|
@@ -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 { VisualSeriesPoint, DataSeriesModel } from '../../model/data-series.model';
|
|
7
|
-
import { SeriesDrawer } from '../data-series.drawer';
|
|
7
|
+
import { HTSeriesDrawerConfig, SeriesDrawer } from '../data-series.drawer';
|
|
8
8
|
export declare class TrendHistogramDrawer implements SeriesDrawer {
|
|
9
9
|
constructor();
|
|
10
|
-
draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel): void;
|
|
10
|
+
draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig): void;
|
|
11
11
|
private previousValue;
|
|
12
12
|
}
|
|
@@ -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);
|
|
@@ -85,7 +85,9 @@ export class DataSeriesView {
|
|
|
85
85
|
const baseline = this.percentAnimationHandler.getBaselineForPercent(getBaseline);
|
|
86
86
|
return unitToPercent(value, baseline);
|
|
87
87
|
case 'logarithmic':
|
|
88
|
-
|
|
88
|
+
// TODO: temporary fix for dataseries with negative values, think about the requirements for these cases
|
|
89
|
+
// should probably not allow to switch to log values at all, or just keep it as it is
|
|
90
|
+
return value <= 0 ? value : calcLogValue(value);
|
|
89
91
|
case 'regular':
|
|
90
92
|
return value;
|
|
91
93
|
}
|
|
@@ -105,7 +105,7 @@ export class DataSeriesModel extends ChartBaseElement {
|
|
|
105
105
|
* @param {number} [idx=this.dataIdxStart] - The index of the visual point to retrieve the close value for.
|
|
106
106
|
* @returns {Unit} The close value of the visual point at the given index, or 1 if the visual point is not defined.
|
|
107
107
|
*/
|
|
108
|
-
this.getBaseline = (idx = this.dataIdxStart) => { var _a, _b; return (
|
|
108
|
+
this.getBaseline = (idx = this.dataIdxStart) => { var _a, _b, _c; return ((_a = this.visualPoints[idx]) === null || _a === void 0 ? void 0 : _a.close) && ((_b = this.visualPoints[idx]) === null || _b === void 0 ? void 0 : _b.close) >= 0 ? (_c = this.visualPoints[idx]) === null || _c === void 0 ? void 0 : _c.close : 1; };
|
|
109
109
|
/**
|
|
110
110
|
* Returns the string representation of the close value of the given visual point.
|
|
111
111
|
*
|
|
@@ -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
|
}
|