@devexperts/dxcharts-lite 2.6.1 → 2.6.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.
@@ -241,10 +241,10 @@ export declare class CanvasBoundsContainer {
241
241
  /**
242
242
  * Gets hit-test fn for canvas element.
243
243
  * @param {string} el - CanvasElement.ELEMENT_NAME
244
- * @param {boolean} reverse - reverses the hit test condition
245
- * @param {number} extensionX - extended hitBoundsTest in horizontal direction
246
- * @param {number} extensionY - extended hitBoundsTest in vertical direction
247
- * @param wholePage
244
+ * @param {Object} options - An object containing options for the hit test.
245
+ * @param {number} [options.extensionX=0] - The amount of extension in the x-axis.
246
+ * @param {number} [options.extensionY=0] - The amount of extension in the y-axis.
247
+ * @param {boolean} [options.wholePage=false] - Whether to test against the whole page or just the bounds object.
248
248
  * @return {HitBoundsTest} hit-test fn
249
249
  */
250
250
  getBoundsHitTest(el: string, options?: AtLeastOne<HitBoundsTestOptions>): HitBoundsTest;
@@ -655,10 +655,10 @@ export class CanvasBoundsContainer {
655
655
  /**
656
656
  * Gets hit-test fn for canvas element.
657
657
  * @param {string} el - CanvasElement.ELEMENT_NAME
658
- * @param {boolean} reverse - reverses the hit test condition
659
- * @param {number} extensionX - extended hitBoundsTest in horizontal direction
660
- * @param {number} extensionY - extended hitBoundsTest in vertical direction
661
- * @param wholePage
658
+ * @param {Object} options - An object containing options for the hit test.
659
+ * @param {number} [options.extensionX=0] - The amount of extension in the x-axis.
660
+ * @param {number} [options.extensionY=0] - The amount of extension in the y-axis.
661
+ * @param {boolean} [options.wholePage=false] - Whether to test against the whole page or just the bounds object.
662
662
  * @return {HitBoundsTest} hit-test fn
663
663
  */
664
664
  getBoundsHitTest(el, options = DEFAULT_HIT_TEST_OPTIONS) {
@@ -15,6 +15,7 @@ import { DateTimeFormatter, TimeFormatterConfig } from './model/date-time.format
15
15
  import { MergeOptions } from './utils/merge.utils';
16
16
  import { DeepPartial } from './utils/object.utils';
17
17
  import { Candle } from './model/candle.model';
18
+ import { CustomIcon } from './components/events/events-custom-icons';
18
19
  export declare const MAIN_FONT = "Open Sans Semibold, sans-serif";
19
20
  export interface DateTimeFormatConfig {
20
21
  format: string;
@@ -123,12 +124,7 @@ export interface FullChartColors {
123
124
  labelBoxColor: string;
124
125
  labelTextColor: string;
125
126
  };
126
- events: {
127
- earnings: EventColors;
128
- dividends: EventColors;
129
- splits: EventColors;
130
- 'conference-calls': EventColors;
131
- };
127
+ events: ChartConfigComponentsEventsColors;
132
128
  navigationMap: {
133
129
  buttonColor: string;
134
130
  knotColor: string;
@@ -356,6 +352,16 @@ export interface ChartConfigComponentsEvents {
356
352
  * </svg>'
357
353
  */
358
354
  icons?: ChartConfigComponentsEventsIcons;
355
+ /**
356
+ * Configure the event type vertical line appearance
357
+ */
358
+ line?: ChartConfigComponentsEventsLine;
359
+ }
360
+ export interface ChartConfigComponentsEventsColors {
361
+ earnings: EventColors;
362
+ dividends: EventColors;
363
+ splits: EventColors;
364
+ 'conference-calls': EventColors;
359
365
  }
360
366
  export interface DateTimeFormatConfig {
361
367
  format: string;
@@ -668,9 +674,17 @@ export interface HighlightsColors {
668
674
  background: string;
669
675
  label: string;
670
676
  }
671
- export interface EventColors {
677
+ /**
678
+ * @deprecated use {normal}, {hover} instead, will be removed in v6
679
+ */
680
+ export interface EventColorsOld {
672
681
  color: string;
673
682
  }
683
+ export interface EventColors extends EventColorsOld {
684
+ line?: string;
685
+ normal?: string;
686
+ hover?: string;
687
+ }
674
688
  export interface HistogramColors {
675
689
  upCap: string;
676
690
  upBottom: string;
@@ -779,15 +793,29 @@ export interface YAxisLabelsColors extends Record<YAxisLabelType, Record<string,
779
793
  prePostMarket: YAxisPrePostMarketLabelColorConfig;
780
794
  prevDayClose: YAxisLabelColorConfig;
781
795
  }
782
- export interface CustomIcon {
783
- normal: string;
784
- hover: string;
785
- }
786
796
  export interface ChartConfigComponentsEventsIcons {
787
797
  earnings?: CustomIcon;
788
798
  dividends?: CustomIcon;
789
799
  splits?: CustomIcon;
790
- conferenceCalls?: CustomIcon;
800
+ 'conference-calls'?: CustomIcon;
801
+ }
802
+ export interface ChartConfigComponentsEventsLine {
803
+ earnings?: {
804
+ width: number;
805
+ dash: Array<number>;
806
+ };
807
+ dividends?: {
808
+ width: number;
809
+ dash: Array<number>;
810
+ };
811
+ splits?: {
812
+ width: number;
813
+ dash: Array<number>;
814
+ };
815
+ 'conference-calls'?: {
816
+ width: number;
817
+ dash: Array<number>;
818
+ };
791
819
  }
792
820
  export type CursorType = string;
793
821
  export declare const getFontFromConfig: (config: YAxisConfig) => string;
@@ -387,15 +387,35 @@ export const getDefaultConfig = () => ({
387
387
  highLowTheme: { highColor: 'rgba(223,222,223,1)', lowColor: 'rgba(223,222,223,1)' },
388
388
  instrumentInfo: { textColor: '#aeb1b3' },
389
389
  paneResizer: {
390
- lineColor: 'rgba(55,55,54,1)',
390
+ lineColor: 'rgba(61,61,61,1)',
391
391
  bgColor: 'rgba(20,20,19,1)',
392
392
  bgHoverColor: 'rgba(55,55,54,0.6)',
393
393
  },
394
394
  events: {
395
- earnings: { color: 'rgba(217,44,64,1)' },
396
- dividends: { color: 'rgba(169,38,251,1)' },
397
- splits: { color: 'rgba(244,187,63,1)' },
398
- 'conference-calls': { color: 'rgba(48,194,97,1)' },
395
+ earnings: {
396
+ color: 'rgba(217,44,64,1)',
397
+ normal: 'rgba(217,44,64,1)',
398
+ hover: 'rgba(217,44,64,1)',
399
+ line: 'rgba(217,44,64,1)',
400
+ },
401
+ dividends: {
402
+ color: 'rgba(169,38,251,1)',
403
+ normal: 'rgba(169,38,251,1)',
404
+ hover: 'rgba(169,38,251,1)',
405
+ line: 'rgba(169,38,251,1)',
406
+ },
407
+ splits: {
408
+ color: 'rgba(244,187,63,1)',
409
+ normal: 'rgba(244,187,63,1)',
410
+ hover: 'rgba(244,187,63,1)',
411
+ line: 'rgba(244,187,63,1)',
412
+ },
413
+ 'conference-calls': {
414
+ color: 'rgba(48,194,97,1)',
415
+ normal: 'rgba(48,194,97,1)',
416
+ hover: 'rgba(48,194,97,1)',
417
+ line: 'rgba(48,194,97,1)',
418
+ },
399
419
  },
400
420
  secondaryChartTheme: [
401
421
  {
@@ -37,7 +37,7 @@ interface ChartPanningOptions {
37
37
  * @param {CanvasBoundsContainer} canvasBoundsContainer - An instance of the CanvasBoundsContainer class.
38
38
  * @param {CanvasAnimation} canvasAnimation - An instance of the CanvasAnimation class.
39
39
  * @param {ChartPanComponent} chartPanComponent - An instance of the ChartPanComponent class.
40
-
40
+
41
41
  */
42
42
  export declare class ChartAreaPanHandler extends ChartBaseElement {
43
43
  private bus;
@@ -62,6 +62,7 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
62
62
  * If the zoomToCursor configuration is set to false, it calls the zoomXToEnd method of the scaleModel to zoom in or out based on the zoomIn parameter.
63
63
  * Finally, it fires the draw event of the bus to redraw the canvas.
64
64
  * @param {WheelEvent} e - Wheel event
65
+ * @param {number} zoomSensitivity - zoom sensitivity
65
66
  * @returns {void}
66
67
  */
67
68
  private zoomXHandler;
@@ -74,7 +75,7 @@ export declare class ChartAreaPanHandler extends ChartBaseElement {
74
75
  private calculateDynamicSesitivity;
75
76
  /**
76
77
  * Registers a handler for panning the chart along the Y-axis.
77
- * @param {ScaleModel} scaleModel - The scale model of the extent.
78
+ * @param {ScaleModel} scale - The scale model of the extent.
78
79
  * @param {HitBoundsTest} hitTest - The hit test of the pane.
79
80
  * @returns {DragNDropYComponent} - The drag and drop component for panning the chart along the Y-axis.
80
81
  */
@@ -29,7 +29,7 @@ import { DragNDropYComponent } from '../dran-n-drop_helper/drag-n-drop-y.compone
29
29
  * @param {CanvasBoundsContainer} canvasBoundsContainer - An instance of the CanvasBoundsContainer class.
30
30
  * @param {CanvasAnimation} canvasAnimation - An instance of the CanvasAnimation class.
31
31
  * @param {ChartPanComponent} chartPanComponent - An instance of the ChartPanComponent class.
32
-
32
+
33
33
  */
34
34
  export class ChartAreaPanHandler extends ChartBaseElement {
35
35
  constructor(bus, config, scale, canvasInputListener, canvasBoundsContainer, canvasAnimation, chartPanComponent, hitTestCanvasModel) {
@@ -56,6 +56,7 @@ export class ChartAreaPanHandler extends ChartBaseElement {
56
56
  * If the zoomToCursor configuration is set to false, it calls the zoomXToEnd method of the scaleModel to zoom in or out based on the zoomIn parameter.
57
57
  * Finally, it fires the draw event of the bus to redraw the canvas.
58
58
  * @param {WheelEvent} e - Wheel event
59
+ * @param {number} zoomSensitivity - zoom sensitivity
59
60
  * @returns {void}
60
61
  */
61
62
  this.zoomXHandler = (e, zoomSensitivity) => {
@@ -120,9 +121,9 @@ export class ChartAreaPanHandler extends ChartBaseElement {
120
121
  .pipe(filter(() => this.chartPanningOptions.horizontal && this.chartPanningOptions.vertical), throttleTime(this.wheelThrottleTime, animationFrameScheduler, { trailing: true, leading: true }))
121
122
  .subscribe(e => {
122
123
  const device = deviceDetector();
123
- const direction = device === 'apple' || device === 'mobile' ? 1 : -1;
124
+ const direction = device === 'apple' || device === 'mobile' ? -1 : 1;
124
125
  const deltaX = 0 + e.deltaX * direction;
125
- const deltaY = 0 + e.deltaY * -direction;
126
+ const deltaY = 0 + e.deltaY * direction;
126
127
  if (e.ctrlKey) {
127
128
  const zoomSensitivity = this.calculateDynamicSesitivity(e, this.config.scale.zoomSensitivity.wheel);
128
129
  this.zoomXHandler(e, zoomSensitivity);
@@ -162,7 +163,7 @@ export class ChartAreaPanHandler extends ChartBaseElement {
162
163
  }
163
164
  /**
164
165
  * Registers a handler for panning the chart along the Y-axis.
165
- * @param {ScaleModel} scaleModel - The scale model of the extent.
166
+ * @param {ScaleModel} scale - The scale model of the extent.
166
167
  * @param {HitBoundsTest} hitTest - The hit test of the pane.
167
168
  * @returns {DragNDropYComponent} - The drag and drop component for panning the chart along the Y-axis.
168
169
  */
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2024 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
+ import { Point } from '../../inputlisteners/canvas-input-listener.component';
7
+ export interface CustomIcon {
8
+ normal: string;
9
+ hover: string;
10
+ }
11
+ export interface CustomIconImage {
12
+ img: HTMLImageElement;
13
+ svgHeight: number;
14
+ }
15
+ export declare const getIconHash: (type: string, state: keyof CustomIcon) => string;
16
+ /**
17
+ * Creates a custom icon for a given event type.
18
+ * @param {string} type - The type of the event.
19
+ * @param {CustomIcon} [icon] - The custom icon object containing the normal and hover images.
20
+ * @returns {void}
21
+ */
22
+ export declare const createCustomIcon: (type: string, icon?: CustomIcon) => {
23
+ type: string;
24
+ normal: CustomIconImage;
25
+ hover: CustomIconImage;
26
+ } | undefined;
27
+ /**
28
+ * Creates an icon image from a string containing SVG data.
29
+ * @param {string} iconString - The string containing SVG data.
30
+ * @returns {CustomIconImage} An object containing an Image object and the height of the SVG element.
31
+ */
32
+ export declare const createIconImage: (iconString: string) => CustomIconImage;
33
+ export declare const drawCustomSvgIcon: (ctx: CanvasRenderingContext2D, icons: Record<string, CustomIconImage>, point: Point, type: string, isHovered: boolean) => void;
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Copyright (C) 2019 - 2024 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 getIconHash = (type, state) => `${type}_${state}`;
7
+ /**
8
+ * Creates a custom icon for a given event type.
9
+ * @param {string} type - The type of the event.
10
+ * @param {CustomIcon} [icon] - The custom icon object containing the normal and hover images.
11
+ * @returns {void}
12
+ */
13
+ export const createCustomIcon = (type, icon) => {
14
+ if (icon) {
15
+ const normal = createIconImage(icon.normal);
16
+ const hover = createIconImage(icon.hover);
17
+ return { type, normal, hover };
18
+ }
19
+ };
20
+ /**
21
+ * Creates an icon image from a string containing SVG data.
22
+ * @param {string} iconString - The string containing SVG data.
23
+ * @returns {CustomIconImage} An object containing an Image object and the height of the SVG element.
24
+ */
25
+ export const createIconImage = (iconString) => {
26
+ var _a;
27
+ const parser = new DOMParser();
28
+ const svgSelector = parser.parseFromString(iconString, 'text/html').querySelector('svg');
29
+ let svgHeight = 0;
30
+ if (svgSelector) {
31
+ svgHeight = parseInt((_a = svgSelector.getAttribute('height')) !== null && _a !== void 0 ? _a : '', 10);
32
+ }
33
+ const svg64 = btoa(iconString);
34
+ const b64Start = 'data:image/svg+xml;base64,';
35
+ const image64 = b64Start + svg64;
36
+ const img = new Image();
37
+ img.src = image64;
38
+ return {
39
+ img,
40
+ svgHeight,
41
+ };
42
+ };
43
+ export const drawCustomSvgIcon = (ctx, icons, point, type, isHovered) => {
44
+ if (isHovered) {
45
+ const hover = icons[getIconHash(type, 'hover')];
46
+ ctx.drawImage(hover.img, point.x - hover.svgHeight / 2, point.y - hover.svgHeight / 2);
47
+ }
48
+ else {
49
+ const normal = icons[getIconHash(type, 'normal')];
50
+ ctx.drawImage(normal.img, point.x - normal.svgHeight / 2, point.y - normal.svgHeight / 2);
51
+ }
52
+ };
@@ -5,12 +5,12 @@
5
5
  */
6
6
  import { Bounds } from '../../model/bounds.model';
7
7
  import { CanvasBoundsContainer } from '../../canvas/canvas-bounds-container';
8
- import { CustomIcon, FullChartConfig } from '../../chart.config';
8
+ import { FullChartConfig, EventColors } from '../../chart.config';
9
9
  import { CanvasModel } from '../../model/canvas.model';
10
10
  import { Drawer } from '../../drawers/drawing-manager';
11
11
  import { DateTimeFormatter } from '../../model/date-time.formatter';
12
12
  import { ChartModel } from '../chart/chart.model';
13
- import { EconomicEvent, EventsModel, EventType, EventWithId } from './events.model';
13
+ import { EconomicEvent, EventsModel, EventWithId } from './events.model';
14
14
  export declare class EventsDrawer implements Drawer {
15
15
  private canvasModel;
16
16
  private chartModel;
@@ -20,22 +20,6 @@ export declare class EventsDrawer implements Drawer {
20
20
  private formatterProvider;
21
21
  private customIcons;
22
22
  constructor(canvasModel: CanvasModel, chartModel: ChartModel, config: FullChartConfig, canvasBoundsContainer: CanvasBoundsContainer, model: EventsModel, formatterProvider: () => DateTimeFormatter);
23
- /**
24
- * Creates a custom icon for a given event type.
25
- * @param {EventType} type - The type of the event.
26
- * @param {CustomIcon} [icon] - The custom icon object containing the normal and hover images.
27
- * @returns {void}
28
- */
29
- createCustomIcon(type: EventType, icon?: CustomIcon): void;
30
- /**
31
- * Creates an icon image from a string containing SVG data.
32
- * @param {string} iconString - The string containing SVG data.
33
- * @returns {Object} An object containing an Image object and the height of the SVG element.
34
- */
35
- createIconImage(iconString: string): {
36
- img: HTMLImageElement;
37
- svgHeight: number;
38
- };
39
23
  /**
40
24
  * Draws events on the chart canvas if they are visible according to the configuration.
41
25
  * The events are filtered by type and then iterated over to draw them on the chart.
@@ -44,25 +28,16 @@ export declare class EventsDrawer implements Drawer {
44
28
  * @returns {void}
45
29
  */
46
30
  draw(): void;
47
- /**
48
- * Draws a custom SVG event on a canvas context.
49
- * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
50
- * @param {number} x - The x coordinate of the event.
51
- * @param {Bounds} bounds - The bounds of the event.
52
- * @param {EventWithId} event - The event to draw.
53
- * @returns {void}
54
- */
55
- drawCustomSvgEvent(ctx: CanvasRenderingContext2D, x: number, bounds: Bounds, event: EventWithId): void;
56
31
  /**
57
32
  * Draws a default event on a canvas context.
58
33
  * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
59
34
  * @param {number} x - The x coordinate of the event.
60
35
  * @param {Bounds} bounds - The bounds of the event.
61
36
  * @param {EventWithId} event - The event to draw.
62
- * @param {string} color - The color of the event.
37
+ * @param {EventColors} colors - The colors of the event.
63
38
  * @returns {void}
64
39
  */
65
- drawDefaultEvent(ctx: CanvasRenderingContext2D, x: number, bounds: Bounds, event: EventWithId, color: string): void;
40
+ drawDefaultEvent(ctx: CanvasRenderingContext2D, x: number, bounds: Bounds, event: EventWithId, colors: EventColors): void;
66
41
  /**
67
42
  * This function is responsible for drawing a label on the canvas at a given x coordinate. The label contains a formatted timestamp of a given event. The function takes two parameters: x, which is the x coordinate where the label will be drawn, and event, which is an object containing information about the event, including its timestamp and type.
68
43
  * The function first gets the canvas context and the bounds of the x-axis. It then retrieves the font family, font height, and top padding from the configuration object. The y coordinate of the label is calculated based on the font height, top padding, and the y coordinate of the x-axis bounds. The font is set using the retrieved font family and font height.
@@ -81,6 +56,6 @@ export declare class EventsDrawer implements Drawer {
81
56
  * Returns the size of an event based on its style
82
57
  * @param {EconomicEvent} event - The event to get the size of
83
58
  * @returns {number} - The size of the event
84
-
59
+
85
60
  */
86
61
  export declare function getEventSize(event: EconomicEvent): number;
@@ -4,12 +4,18 @@
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 { CanvasElement } from '../../canvas/canvas-bounds-container';
7
+ import { createCustomIcon, drawCustomSvgIcon, getIconHash } from './events-custom-icons';
7
8
  const eventsSizesDict = {
8
9
  'rhombus-small': 4,
9
10
  rhombus: 6,
10
11
  'rhombus-large': 8,
11
12
  };
12
- const getIconHash = (type, state) => `${type}_${state}`;
13
+ const iconTypes = [
14
+ 'earnings',
15
+ 'dividends',
16
+ 'splits',
17
+ 'conference-calls',
18
+ ];
13
19
  export class EventsDrawer {
14
20
  constructor(canvasModel, chartModel, config, canvasBoundsContainer, model, formatterProvider) {
15
21
  this.canvasModel = canvasModel;
@@ -22,48 +28,14 @@ export class EventsDrawer {
22
28
  this.customIcons = {};
23
29
  const iconsConfig = this.config.components.events.icons;
24
30
  if (iconsConfig) {
25
- this.createCustomIcon('earnings', iconsConfig.earnings);
26
- this.createCustomIcon('dividends', iconsConfig.dividends);
27
- this.createCustomIcon('splits', iconsConfig.splits);
28
- this.createCustomIcon('conference-calls', iconsConfig.conferenceCalls);
29
- }
30
- }
31
- /**
32
- * Creates a custom icon for a given event type.
33
- * @param {EventType} type - The type of the event.
34
- * @param {CustomIcon} [icon] - The custom icon object containing the normal and hover images.
35
- * @returns {void}
36
- */
37
- createCustomIcon(type, icon) {
38
- if (icon) {
39
- const normal = this.createIconImage(icon.normal);
40
- const hover = this.createIconImage(icon.hover);
41
- this.customIcons[getIconHash(type, 'normal')] = normal;
42
- this.customIcons[getIconHash(type, 'hover')] = hover;
43
- }
44
- }
45
- /**
46
- * Creates an icon image from a string containing SVG data.
47
- * @param {string} iconString - The string containing SVG data.
48
- * @returns {Object} An object containing an Image object and the height of the SVG element.
49
- */
50
- createIconImage(iconString) {
51
- var _a;
52
- const parser = new DOMParser();
53
- const svgSelector = parser.parseFromString(iconString, 'text/html').querySelector('svg');
54
- let svgHeight = 0;
55
- if (svgSelector) {
56
- svgHeight = parseInt((_a = svgSelector.getAttribute('height')) !== null && _a !== void 0 ? _a : '', 10);
31
+ iconTypes.forEach(type => {
32
+ const customIcon = createCustomIcon(type, iconsConfig[type]);
33
+ if (customIcon) {
34
+ this.customIcons[getIconHash(customIcon.type, 'normal')] = customIcon.normal;
35
+ this.customIcons[getIconHash(customIcon.type, 'hover')] = customIcon.hover;
36
+ }
37
+ });
57
38
  }
58
- const svg64 = btoa(iconString);
59
- const b64Start = 'data:image/svg+xml;base64,';
60
- const image64 = b64Start + svg64;
61
- const img = new Image();
62
- img.src = image64;
63
- return {
64
- img,
65
- svgHeight,
66
- };
67
39
  }
68
40
  /**
69
41
  * Draws events on the chart canvas if they are visible according to the configuration.
@@ -83,20 +55,28 @@ export class EventsDrawer {
83
55
  this.model.events
84
56
  .filter(e => this.config.components.events.eventsVisibility[e.type])
85
57
  .forEach(event => {
58
+ var _a, _b, _c, _d;
86
59
  const x = this.chartModel.candleFromTimestamp(event.timestamp).xCenter(this.chartModel.scale);
87
60
  if (x > chartBounds.x && x < chartBounds.x + chartBounds.width) {
88
- const color = this.config.colors.events[event.type].color;
89
- ctx.strokeStyle = color;
61
+ const colors = this.config.colors.events[event.type];
62
+ ctx.strokeStyle = (_b = (_a = colors.line) !== null && _a !== void 0 ? _a : colors.normal) !== null && _b !== void 0 ? _b : colors.color;
90
63
  // check custom icon in cache
91
64
  if (this.customIcons[getIconHash(event.type, 'hover')] !== undefined) {
92
- this.drawCustomSvgEvent(ctx, x, bounds, event);
65
+ const point = { x, y: bounds.y + bounds.height / 2 };
66
+ const isHovered = this.model.hoveredEvent.getValue() === event;
67
+ drawCustomSvgIcon(ctx, this.customIcons, point, event.type, isHovered);
93
68
  }
94
69
  else {
95
- this.drawDefaultEvent(ctx, x, bounds, event, color);
70
+ this.drawDefaultEvent(ctx, x, bounds, event, colors);
96
71
  }
97
72
  // draw vertical line and label for the hovered event
98
73
  if (this.model.hoveredEvent.getValue() === event) {
74
+ const line = this.config.components.events.line;
75
+ const width = line && line[event.type] && ((_c = line[event.type]) === null || _c === void 0 ? void 0 : _c.width);
76
+ const dash = line && line[event.type] && ((_d = line[event.type]) === null || _d === void 0 ? void 0 : _d.dash);
77
+ ctx.lineWidth = width !== null && width !== void 0 ? width : 1;
99
78
  ctx.beginPath();
79
+ ctx.setLineDash(dash !== null && dash !== void 0 ? dash : []);
100
80
  ctx.moveTo(x, chartBounds.y);
101
81
  ctx.lineTo(x, bounds.y + bounds.height / 2);
102
82
  ctx.stroke();
@@ -109,37 +89,19 @@ export class EventsDrawer {
109
89
  });
110
90
  ctx.restore();
111
91
  }
112
- /**
113
- * Draws a custom SVG event on a canvas context.
114
- * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
115
- * @param {number} x - The x coordinate of the event.
116
- * @param {Bounds} bounds - The bounds of the event.
117
- * @param {EventWithId} event - The event to draw.
118
- * @returns {void}
119
- */
120
- drawCustomSvgEvent(ctx, x, bounds, event) {
121
- const y = bounds.y + bounds.height / 2;
122
- const normal = this.customIcons[getIconHash(event.type, 'normal')];
123
- const hover = this.customIcons[getIconHash(event.type, 'hover')];
124
- if (this.model.hoveredEvent.getValue() === event) {
125
- ctx.drawImage(hover.img, x - hover.svgHeight / 2, y - hover.svgHeight / 2);
126
- }
127
- else {
128
- ctx.drawImage(normal.img, x - normal.svgHeight / 2, y - normal.svgHeight / 2);
129
- }
130
- }
131
92
  /**
132
93
  * Draws a default event on a canvas context.
133
94
  * @param {CanvasRenderingContext2D} ctx - The canvas context to draw on.
134
95
  * @param {number} x - The x coordinate of the event.
135
96
  * @param {Bounds} bounds - The bounds of the event.
136
97
  * @param {EventWithId} event - The event to draw.
137
- * @param {string} color - The color of the event.
98
+ * @param {EventColors} colors - The colors of the event.
138
99
  * @returns {void}
139
100
  */
140
- drawDefaultEvent(ctx, x, bounds, event, color) {
101
+ drawDefaultEvent(ctx, x, bounds, event, colors) {
102
+ var _a, _b, _c;
141
103
  const y = bounds.y + bounds.height / 2;
142
- ctx.fillStyle = color;
104
+ ctx.fillStyle = (_a = colors.normal) !== null && _a !== void 0 ? _a : colors.color;
143
105
  // draw figure
144
106
  ctx.lineWidth = 1.5; // 1.5 pixels
145
107
  const size = getEventSize(event);
@@ -150,9 +112,11 @@ export class EventsDrawer {
150
112
  ctx.lineTo(x, y + size);
151
113
  ctx.closePath();
152
114
  if (this.model.hoveredEvent.getValue() === event) {
115
+ ctx.fillStyle = (_b = colors.hover) !== null && _b !== void 0 ? _b : colors.color;
153
116
  ctx.fill();
154
117
  }
155
118
  else {
119
+ ctx.strokeStyle = (_c = colors.normal) !== null && _c !== void 0 ? _c : colors.color;
156
120
  ctx.stroke();
157
121
  }
158
122
  }
@@ -193,7 +157,7 @@ export class EventsDrawer {
193
157
  * Returns the size of an event based on its style
194
158
  * @param {EconomicEvent} event - The event to get the size of
195
159
  * @returns {number} - The size of the event
196
-
160
+
197
161
  */
198
162
  export function getEventSize(event) {
199
163
  return eventsSizesDict[event.style];
@@ -71,6 +71,7 @@ export declare class PaneManager extends ChartBaseElement {
71
71
  /**
72
72
  * Creates sub-plot on the chart with y-axis
73
73
  * @param uuid
74
+ * @param {AtLeastOne<YExtentCreationOptions>} options
74
75
  * @returns
75
76
  */
76
77
  createPane(uuid?: string, options?: AtLeastOne<YExtentCreationOptions>): PaneComponent;
@@ -111,7 +112,7 @@ export declare class PaneManager extends ChartBaseElement {
111
112
  /**
112
113
  * Move data series to a certain pane, or create a new one if no pane is found
113
114
  */
114
- moveDataSeriesToPane(dataSeries: DataSeriesModel[], initialPane: PaneComponent, initialExtent: YExtentComponent, paneUUID?: string, extent?: YExtentComponent, direction?: MoveDataSeriesToPaneDirection): void;
115
+ moveDataSeriesToPane(dataSeries: DataSeriesModel[], initialPane: PaneComponent, initialExtent: YExtentComponent, paneUUID?: string, extent?: YExtentComponent, direction?: MoveDataSeriesToPaneDirection, index?: number): void;
115
116
  /**
116
117
  * Adds cursors to the chart elements based on the provided uuid and cursor type.
117
118
  * @private
@@ -8,7 +8,7 @@ import { CHART_UUID, CanvasElement } from '../../canvas/canvas-bounds-container'
8
8
  import { ChartBaseElement } from '../../model/chart-base-element';
9
9
  import { uuid as generateUuid } from '../../utils/uuid.utils';
10
10
  import { createHighLowOffsetCalculator } from '../chart/data-series.high-low-provider';
11
- import { BarResizerComponent } from '../resizer/bar-resizer.component';
11
+ import { BarResizerComponent, RESIZER_HIT_TEST_EXTENSION } from '../resizer/bar-resizer.component';
12
12
  import { createDefaultYExtentHighLowProvider, } from './extent/y-extent-component';
13
13
  import { PaneHitTestController } from './pane-hit-test.controller';
14
14
  import { PaneComponent } from './pane.component';
@@ -63,7 +63,7 @@ export class PaneManager extends ChartBaseElement {
63
63
  */
64
64
  addResizer(uuid) {
65
65
  const resizerHT = this.canvasBoundsContainer.getBoundsHitTest(CanvasElement.PANE_UUID_RESIZER(uuid), {
66
- extensionY: this.config.components.paneResizer.dragZone,
66
+ extensionY: this.config.components.paneResizer.dragZone + RESIZER_HIT_TEST_EXTENSION,
67
67
  });
68
68
  const dragPredicate = () => this.chartBaseModel.mainVisualPoints.length !== 0;
69
69
  const dragTick = () => {
@@ -90,6 +90,7 @@ export class PaneManager extends ChartBaseElement {
90
90
  /**
91
91
  * Creates sub-plot on the chart with y-axis
92
92
  * @param uuid
93
+ * @param {AtLeastOne<YExtentCreationOptions>} options
93
94
  * @returns
94
95
  */
95
96
  createPane(uuid = generateUuid(), options) {
@@ -191,11 +192,11 @@ export class PaneManager extends ChartBaseElement {
191
192
  /**
192
193
  * Move data series to a certain pane, or create a new one if no pane is found
193
194
  */
194
- moveDataSeriesToPane(dataSeries, initialPane, initialExtent, paneUUID, extent, direction) {
195
+ moveDataSeriesToPane(dataSeries, initialPane, initialExtent, paneUUID, extent, direction, index = 0) {
195
196
  const pane = paneUUID && this.panes[paneUUID];
196
197
  if (!pane) {
197
- const order = direction && direction === 'above' ? 0 : this.panesOrder.length;
198
- const newPane = this.createPane(undefined, { order });
198
+ const order = direction && direction === 'above' ? index : this.panesOrder.length + index;
199
+ const newPane = this.createPane(paneUUID, { order });
199
200
  newPane.moveDataSeriesToExistingExtentComponent(dataSeries, initialPane, initialExtent, newPane.mainExtent);
200
201
  initialPane.yExtentComponents.length === 0 && this.removePane(initialPane.uuid);
201
202
  return;
@@ -204,7 +205,7 @@ export class PaneManager extends ChartBaseElement {
204
205
  pane.moveDataSeriesToExistingExtentComponent(dataSeries, initialPane, initialExtent, extent);
205
206
  }
206
207
  else {
207
- pane.moveDataSeriesToNewExtentComponent(dataSeries, initialPane, initialExtent);
208
+ pane.moveDataSeriesToNewExtentComponent(dataSeries, initialPane, initialExtent, initialExtent.yAxis.state.align);
208
209
  }
209
210
  initialPane.yExtentComponents.length === 0 && this.removePane(initialPane.uuid);
210
211
  }
@@ -220,7 +221,7 @@ export class PaneManager extends ChartBaseElement {
220
221
  const paneResizer = CanvasElement.PANE_UUID_RESIZER(uuid);
221
222
  this.cursorHandler.setCursorForCanvasEl(pane, cursor);
222
223
  this.config.components.paneResizer.visible &&
223
- this.cursorHandler.setCursorForCanvasEl(paneResizer, this.config.components.paneResizer.cursor, this.config.components.paneResizer.dragZone);
224
+ this.cursorHandler.setCursorForCanvasEl(paneResizer, this.config.components.paneResizer.cursor, this.config.components.paneResizer.dragZone + RESIZER_HIT_TEST_EXTENSION);
224
225
  return () => {
225
226
  this.cursorHandler.removeCursorForCanvasEl(pane);
226
227
  this.config.components.paneResizer.visible && this.cursorHandler.removeCursorForCanvasEl(paneResizer);