@devexperts/dxcharts-lite 2.7.1 → 2.7.3

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.
Files changed (68) hide show
  1. package/dist/chart/animation/canvas-animation.d.ts +19 -21
  2. package/dist/chart/animation/canvas-animation.js +19 -19
  3. package/dist/chart/animation/types/animation.d.ts +5 -17
  4. package/dist/chart/animation/types/animation.js +12 -17
  5. package/dist/chart/animation/types/color-alpha-animation.js +11 -21
  6. package/dist/chart/animation/types/viewport-movement-animation.d.ts +1 -1
  7. package/dist/chart/animation/viewport-model-animation.js +2 -2
  8. package/dist/chart/bootstrap.js +7 -4
  9. package/dist/chart/canvas/canvas-chart-html.js +1 -0
  10. package/dist/chart/canvas/chart-elements.d.ts +1 -0
  11. package/dist/chart/chart.config.d.ts +7 -0
  12. package/dist/chart/chart.config.js +4 -0
  13. package/dist/chart/components/chart/chart.component.d.ts +19 -6
  14. package/dist/chart/components/chart/chart.component.js +27 -8
  15. package/dist/chart/components/pane/pane.component.js +5 -1
  16. package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +4 -1
  17. package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +1 -1
  18. package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +3 -2
  19. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +2 -1
  20. package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +5 -3
  21. package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +5 -0
  22. package/dist/chart/components/y_axis/y-axis-base-labels.model.js +9 -0
  23. package/dist/chart/components/y_axis/y-axis.component.d.ts +6 -1
  24. package/dist/chart/components/y_axis/y-axis.component.js +14 -5
  25. package/dist/chart/components/y_axis/y-axis.drawer.js +5 -3
  26. package/dist/chart/components/y_axis/y-axis.model.d.ts +1 -1
  27. package/dist/chart/drawers/chart-background.drawer.d.ts +1 -0
  28. package/dist/chart/drawers/chart-background.drawer.js +2 -1
  29. package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +2 -2
  30. package/dist/chart/drawers/chart-type-drawers/area.drawer.js +5 -5
  31. package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +2 -2
  32. package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +6 -6
  33. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +2 -2
  34. package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +8 -8
  35. package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +3 -3
  36. package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +20 -16
  37. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +2 -2
  38. package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +5 -5
  39. package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +2 -2
  40. package/dist/chart/drawers/chart-type-drawers/line.drawer.js +5 -5
  41. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +2 -2
  42. package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +4 -3
  43. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +2 -2
  44. package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +2 -2
  45. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +2 -2
  46. package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +4 -4
  47. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +2 -2
  48. package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +9 -9
  49. package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +2 -2
  50. package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +3 -3
  51. package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +2 -2
  52. package/dist/chart/drawers/data-series-drawers/linear.drawer.js +3 -3
  53. package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +2 -2
  54. package/dist/chart/drawers/data-series-drawers/points.drawer.js +3 -3
  55. package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +2 -2
  56. package/dist/chart/drawers/data-series-drawers/text.drawer.js +2 -2
  57. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +2 -2
  58. package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +16 -13
  59. package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +2 -2
  60. package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +2 -2
  61. package/dist/chart/drawers/data-series.drawer.d.ts +5 -5
  62. package/dist/chart/drawers/data-series.drawer.js +3 -3
  63. package/dist/chart/drawers/ht-data-series.drawer.js +2 -2
  64. package/dist/chart/model/scale.model.js +4 -0
  65. package/dist/chart/utils/numeric-constants.utils.d.ts +6 -0
  66. package/dist/chart/utils/numeric-constants.utils.js +6 -0
  67. package/dist/dxchart.min.js +5 -4
  68. package/package.json +1 -1
@@ -5,9 +5,9 @@
5
5
  */
6
6
  import { ScatterPlotStyle } from '../../chart.config';
7
7
  import { DataSeriesModel, VisualSeriesPoint } from '../../model/data-series.model';
8
- import { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
8
+ import { HTSeriesDrawerConfig, SeriesDrawer } from '../data-series.drawer';
9
9
  export declare class ScatterPlotDrawer implements SeriesDrawer {
10
10
  private config;
11
11
  constructor(config: ScatterPlotStyle);
12
- draw(ctx: CanvasRenderingContext2D, points: VisualSeriesPoint[][], model: DataSeriesModel, drawerConfig: ChartDrawerConfig): void;
12
+ draw(ctx: CanvasRenderingContext2D, points: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig): void;
13
13
  }
@@ -9,14 +9,15 @@ export class ScatterPlotDrawer {
9
9
  constructor(config) {
10
10
  this.config = config;
11
11
  }
12
- draw(ctx, points, model, drawerConfig) {
12
+ draw(ctx, points, model, hitTestDrawerConfig) {
13
13
  var _a;
14
- ctx.fillStyle = (_a = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : this.config.mainColor;
14
+ const radius = hitTestDrawerConfig.hoverWidth ? hitTestDrawerConfig.hoverWidth / 2 : SCATTER_PLOT_RADIUS;
15
+ ctx.fillStyle = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : this.config.mainColor;
15
16
  for (const visualCandle of flat(points)) {
16
17
  ctx.beginPath();
17
18
  const lineX = model.view.toX(visualCandle.centerUnit);
18
19
  const closeY = model.view.toY(visualCandle.close);
19
- ctx.arc(lineX, closeY, SCATTER_PLOT_RADIUS, 0, Math.PI * 2, true);
20
+ ctx.arc(lineX, closeY, radius, 0, Math.PI * 2, true);
20
21
  ctx.fill();
21
22
  }
22
23
  }
@@ -6,7 +6,7 @@
6
6
  import { BarType, FullChartConfig } from '../../chart.config';
7
7
  import { BoundsProvider } from '../../model/bounds.model';
8
8
  import { DataSeriesModel, VisualSeriesPoint } from '../../model/data-series.model';
9
- import { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
9
+ import { HTSeriesDrawerConfig, SeriesDrawer } from '../data-series.drawer';
10
10
  export declare const candleTypesList: BarType[];
11
11
  /**
12
12
  * A decorator for drawers, that draw something depending on visual candles
@@ -16,7 +16,7 @@ export declare class CandleSeriesWrapper implements SeriesDrawer {
16
16
  private config;
17
17
  private chartBounds;
18
18
  constructor(drawer: SeriesDrawer, config: FullChartConfig, chartBounds: BoundsProvider);
19
- draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, config: ChartDrawerConfig): void;
19
+ draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig): void;
20
20
  private beforeDraw;
21
21
  private isChartTypeAllowed;
22
22
  private afterDraw;
@@ -24,10 +24,10 @@ export class CandleSeriesWrapper {
24
24
  this.config = config;
25
25
  this.chartBounds = chartBounds;
26
26
  }
27
- draw(ctx, allPoints, model, config) {
27
+ draw(ctx, allPoints, model, hitTestDrawerConfig) {
28
28
  if (this.isChartTypeAllowed()) {
29
29
  this.beforeDraw(ctx);
30
- this.drawer.draw(ctx, allPoints, model, config);
30
+ this.drawer.draw(ctx, allPoints, model, hitTestDrawerConfig);
31
31
  this.afterDraw(ctx, model);
32
32
  }
33
33
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { ChartModel } from '../../components/chart/chart.model';
7
7
  import { DataSeriesModel, VisualSeriesPoint } from '../../model/data-series.model';
8
- import { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
8
+ import { HTSeriesDrawerConfig, SeriesDrawer } from '../data-series.drawer';
9
9
  /**
10
10
  * Some series have candles which are highlighted.
11
11
  * This drawer draws the candle box on top of original candles.
@@ -13,5 +13,5 @@ import { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
13
13
  export declare class ColorCandleDrawer implements SeriesDrawer {
14
14
  private chartModel;
15
15
  constructor(chartModel: ChartModel);
16
- draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, drawerConfig: ChartDrawerConfig): void;
16
+ draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig): void;
17
17
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { unitToPixels } from '../../model/scaling/viewport.model';
7
7
  import { floorToDPR } from '../../utils/device/device-pixel-ratio.utils';
8
- import { round } from '../../utils/math.utils';
8
+ import { floor } from '../../utils/math.utils';
9
9
  /**
10
10
  * Some series have candles which are highlighted.
11
11
  * This drawer draws the candle box on top of original candles.
@@ -14,13 +14,13 @@ export class ColorCandleDrawer {
14
14
  constructor(chartModel) {
15
15
  this.chartModel = chartModel;
16
16
  }
17
- draw(ctx, allPoints, model, drawerConfig) {
17
+ draw(ctx, allPoints, model, hitTestDrawerConfig) {
18
18
  allPoints.forEach((points, idx) => {
19
19
  var _a;
20
20
  const config = model.getPaintConfig(idx);
21
- ctx.fillStyle = (_a = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : config.color;
21
+ ctx.fillStyle = (_a = hitTestDrawerConfig.color) !== null && _a !== void 0 ? _a : config.color;
22
22
  points.forEach(p => {
23
- const visualCandle = this.chartModel.getVisualCandle(round(p.centerUnit));
23
+ const visualCandle = this.chartModel.getVisualCandle(floor(p.centerUnit));
24
24
  const value = p.close;
25
25
  if (visualCandle && value === 1) {
26
26
  const zoomX = this.chartModel.scale.zoomX;
@@ -4,7 +4,7 @@
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 { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
7
+ import { HTSeriesDrawerConfig, SeriesDrawer } from '../data-series.drawer';
8
8
  /**
9
9
  * Point used to draw difference type indicator (clouds) (e.g. Ichimoku indicator)
10
10
  */
@@ -13,7 +13,7 @@ export interface DifferencePoint {
13
13
  }
14
14
  export declare class DifferenceCloudDrawer implements SeriesDrawer {
15
15
  constructor();
16
- draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, drawerConfig: ChartDrawerConfig): void;
16
+ draw(ctx: CanvasRenderingContext2D, allPoints: VisualSeriesPoint[][], model: DataSeriesModel, hitTestDrawerConfig: HTSeriesDrawerConfig): void;
17
17
  private drawLine;
18
18
  private drawDifference;
19
19
  private fillCloud;
@@ -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, drawerConfig) {
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, drawerConfig, config.hoveredLineWidth);
19
- const lineColor = (_a = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : config.color;
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, drawerConfig);
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, drawerConfig) {
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, drawerConfig);
66
- this.fillCloud(ctx, lineColor, nextSeriesPoints, curSeriesPoints, drawerConfig);
65
+ this.fillCloud(ctx, nextLineColor, curSeriesPoints, nextSeriesPoints, hitTestDrawerConfig);
66
+ this.fillCloud(ctx, lineColor, nextSeriesPoints, curSeriesPoints, hitTestDrawerConfig);
67
67
  }
68
- fillCloud(ctx, color, linePoints, nextLinePoints, drawerConfig) {
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 = drawerConfig.singleColor ? drawerConfig.singleColor : toRGBA(color ? color : '#383838', 0.3);
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 { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
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, drawerConfig: ChartDrawerConfig): void;
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, drawerConfig) {
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, drawerConfig, config.hoveredLineWidth);
17
- ctx.strokeStyle = (_a = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : config.color;
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 { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
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, drawerConfig: ChartDrawerConfig): void;
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, drawerConfig) {
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, drawerConfig, config.hoveredLineWidth);
15
- ctx.strokeStyle = (_a = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : config.color;
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 { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
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, drawerConfig: ChartDrawerConfig): void;
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, drawerConfig) {
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 = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : config.color;
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 { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
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, drawerConfig: ChartDrawerConfig): void;
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, drawerConfig) {
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 = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : config.color;
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 (((_b = config.multiplyColors) === null || _b === void 0 ? void 0 : _b.length) === 4) {
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 = config.multiplyColors[0] || config.color || '#FF00FF';
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 = config.multiplyColors[1] || config.color || '#FF00FF';
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 = config.multiplyColors[2] || config.color || '#FF00FF';
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 = config.multiplyColors[3] || config.color || '#FF00FF';
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 { ChartDrawerConfig, SeriesDrawer } from '../data-series.drawer';
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, drawerConfig: ChartDrawerConfig): void;
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, drawerConfig) {
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 = drawerConfig.singleColor) !== null && _a !== void 0 ? _a : config.color;
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 ChartDrawerConfig {
11
- singleColor?: string;
12
- forceBold?: number;
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, drawerConfig: ChartDrawerConfig) => void;
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, drawerConfig: ChartDrawerConfig, seriesSelectedWidth?: number) => void;
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, drawerConfig, seriesSelectedWidth = lineWidth) => {
47
- if (drawerConfig.forceBold) {
48
- ctx.lineWidth = drawerConfig.forceBold;
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
- singleColor: this.canvasModel.idToColor(series.htId),
35
- forceBold: 7,
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
  }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
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
+ */
6
+ export declare const ONE_FRAME_MS = 16;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited
3
+ * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
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
+ */
6
+ export const ONE_FRAME_MS = 16; // 60 frames per second is ~16ms