scichart-engine 1.10.2 → 1.10.4

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.
@@ -8,10 +8,39 @@ export interface ChartLegendCallbacks {
8
8
  onInteractionEnd?: () => void;
9
9
  onHoverStart?: () => void;
10
10
  onHoverEnd?: () => void;
11
- onSeriesHoverStart?: (series: Series) => void;
12
- onSeriesHoverEnd?: (series: Series) => void;
11
+ /**
12
+ * Called when mouse enters a series item in legend
13
+ * @param series - The series being hovered
14
+ * @param highlightColor - Whether to apply color highlighting (from options)
15
+ */
16
+ onSeriesHoverStart?: (series: Series, highlightColor: boolean) => void;
17
+ /**
18
+ * Called when mouse leaves a series item in legend
19
+ * @param series - The series that was hovered
20
+ * @param highlightColor - Whether color highlighting was applied
21
+ */
22
+ onSeriesHoverEnd?: (series: Series, highlightColor: boolean) => void;
13
23
  onToggleVisibility?: (series: Series) => void;
14
24
  }
25
+ /** Options for ChartLegend component */
26
+ export interface ChartLegendOptions {
27
+ x?: number;
28
+ y?: number;
29
+ width?: number;
30
+ /**
31
+ * Highlight series color on hover (default: false)
32
+ * When false, series still comes to foreground but color doesn't change
33
+ */
34
+ highlightOnHover?: boolean;
35
+ /**
36
+ * Bring series to foreground (z-index) on hover (default: true)
37
+ */
38
+ bringToFrontOnHover?: boolean;
39
+ /** Allow dragging the legend (default: true) */
40
+ draggable?: boolean;
41
+ /** Allow resizing the legend (default: true) */
42
+ resizable?: boolean;
43
+ }
15
44
  export declare class ChartLegend {
16
45
  private container;
17
46
  private visualContainer;
@@ -21,15 +50,12 @@ export declare class ChartLegend {
21
50
  private series;
22
51
  private callbacks;
23
52
  private swatchCanvases;
53
+ private options;
24
54
  private isDragging;
25
55
  private isResizing;
26
56
  private dragOffsetX;
27
57
  private dragOffsetY;
28
- constructor(parent: HTMLElement, theme: ChartTheme, options: {
29
- x?: number;
30
- y?: number;
31
- width?: number;
32
- }, callbacks: ChartLegendCallbacks);
58
+ constructor(parent: HTMLElement, theme: ChartTheme, options: ChartLegendOptions, callbacks: ChartLegendCallbacks);
33
59
  private updateStyle;
34
60
  private initDragging;
35
61
  update(series: Series[]): void;
@@ -2,11 +2,21 @@ import { Scale } from '../scales';
2
2
  import { ChartTheme } from '../theme';
3
3
  import { Series } from './Series';
4
4
  import { PlotArea, CursorState, AxisOptions } from '../types';
5
+ import { ChartTitleOptions } from './layout/types';
5
6
 
6
7
  export declare class OverlayRenderer {
7
8
  private ctx;
8
9
  private theme;
10
+ private latexAPI;
9
11
  constructor(ctx: CanvasRenderingContext2D, theme: ChartTheme);
12
+ /**
13
+ * Set LaTeX API for rendering mathematical expressions
14
+ */
15
+ setLatexAPI(api: any): void;
16
+ /**
17
+ * Helper to draw text or LaTeX
18
+ */
19
+ private drawLatexOrText;
10
20
  /**
11
21
  * Update the theme
12
22
  */
@@ -14,7 +24,7 @@ export declare class OverlayRenderer {
14
24
  /**
15
25
  * Clear the overlay
16
26
  */
17
- clear(width: number, height: number): void;
27
+ clear(): void;
18
28
  /**
19
29
  * Draw the grid
20
30
  */
@@ -35,6 +45,10 @@ export declare class OverlayRenderer {
35
45
  * Draw plot area border
36
46
  */
37
47
  drawPlotBorder(plotArea: PlotArea): void;
48
+ /**
49
+ * Draw chart title
50
+ */
51
+ drawChartTitle(plotArea: PlotArea, options: ChartTitleOptions): void;
38
52
  /**
39
53
  * Draw legend
40
54
  */
@@ -46,11 +60,15 @@ export declare class OverlayRenderer {
46
60
  /**
47
61
  * Draw cursor/crosshair
48
62
  */
49
- drawCursor(plotArea: PlotArea, cursor: CursorState): void;
63
+ drawCursor(plotArea: PlotArea, cursor: CursorState, lineStyle?: 'solid' | 'dashed' | 'dotted'): void;
50
64
  /**
51
65
  * Draw tooltip
52
66
  */
53
67
  private drawTooltip;
68
+ /**
69
+ * Draw tooltip in a fixed corner position
70
+ */
71
+ private drawCornerTooltip;
54
72
  /**
55
73
  * Draw selection rectangle (Box Zoom)
56
74
  */
@@ -42,7 +42,11 @@ export declare class AnnotationManager {
42
42
  /**
43
43
  * Render all annotations
44
44
  */
45
- render(ctx: CanvasRenderingContext2D, plotArea: PlotArea, bounds: Bounds): void;
45
+ render(ctx: CanvasRenderingContext2D, plotArea: PlotArea, bounds: Bounds, latexAPI?: any): void;
46
+ /**
47
+ * Helper to draw text or LaTeX
48
+ */
49
+ private drawLatexOrText;
46
50
  private renderAnnotation;
47
51
  private dataToPixelX;
48
52
  private dataToPixelY;
@@ -17,6 +17,8 @@ export interface BaseAnnotation {
17
17
  zIndex?: number;
18
18
  /** Tooltip text or configuration */
19
19
  tooltip?: string | any;
20
+ /** Use LaTeX rendering for labels/text (default: auto-detect) */
21
+ latex?: boolean;
20
22
  }
21
23
  export interface HorizontalLineAnnotation extends BaseAnnotation {
22
24
  type: 'horizontal-line';
@@ -42,6 +42,7 @@ export declare class ChartImpl implements Chart {
42
42
  private showControls;
43
43
  private toolbarOptions?;
44
44
  private controls;
45
+ private layout;
45
46
  private _isDestroyed;
46
47
  private autoScroll;
47
48
  private showStatistics;
@@ -80,6 +81,7 @@ export declare class ChartImpl implements Chart {
80
81
  get sync(): any;
81
82
  get brokenAxis(): any;
82
83
  get forecasting(): any;
84
+ get latex(): any;
83
85
  private animationEngine;
84
86
  private animationConfig;
85
87
  get animations(): ChartAnimationConfig;
@@ -212,6 +214,7 @@ export declare class ChartImpl implements Chart {
212
214
  * Update X axis configuration
213
215
  */
214
216
  updateXAxis(options: Partial<AxisOptions>): void;
217
+ updateLayout(options: Partial<import('../layout').LayoutOptions>): void;
215
218
  /**
216
219
  * Get Y axis configuration by ID
217
220
  */
@@ -22,6 +22,7 @@ export declare class ChartPluginBridge {
22
22
  get sync(): any;
23
23
  get brokenAxis(): any;
24
24
  get forecasting(): any;
25
+ get latex(): any;
25
26
  /**
26
27
  * Get a plugin API by name
27
28
  */
@@ -23,8 +23,8 @@ export interface RenderLoopContext {
23
23
  overlay: OverlayRenderer;
24
24
  backgroundColor: [number, number, number, number];
25
25
  plotAreaBackground: [number, number, number, number];
26
- cursorOptions: CursorOptions | null;
27
- cursorPosition: {
26
+ getCursorOptions: () => CursorOptions | null;
27
+ getCursorPosition: () => {
28
28
  x: number;
29
29
  y: number;
30
30
  } | null;
@@ -38,6 +38,8 @@ export interface RenderLoopContext {
38
38
  selectionManager: SelectionManager;
39
39
  getHoveredSeriesId: () => string | null;
40
40
  pluginManager: PluginManagerImpl;
41
+ getLayout: () => import('../layout').LayoutOptions;
42
+ getLatex: () => any;
41
43
  updateSeriesBuffer: (s: Series) => void;
42
44
  getPlotArea: () => PlotArea;
43
45
  pixelToDataX: (px: number) => number;
@@ -39,6 +39,8 @@ export interface RenderContext {
39
39
  pixelToDataY: (py: number) => number;
40
40
  selectionManager: SelectionManager;
41
41
  hoveredSeriesId: string | null;
42
+ layout: import('../layout').LayoutOptions;
43
+ latexAPI?: any;
42
44
  }
43
45
  /**
44
46
  * Prepare series data for WebGL rendering
@@ -1,6 +1,7 @@
1
1
  import { ChartOptions, AxisOptions } from '../../types';
2
2
  import { Scale } from '../../scales';
3
3
  import { ChartTheme } from '../../theme';
4
+ import { LayoutOptions } from '../layout';
4
5
 
5
6
  export interface SetupResult {
6
7
  theme: ChartTheme;
@@ -19,6 +20,7 @@ export interface SetupResult {
19
20
  webglCanvas: HTMLCanvasElement;
20
21
  overlayCanvas: HTMLCanvasElement;
21
22
  overlayCtx: CanvasRenderingContext2D;
23
+ layout: LayoutOptions;
22
24
  }
23
25
  /**
24
26
  * Initialize chart configuration from options
@@ -31,7 +33,7 @@ export declare function createCanvas(type: "webgl" | "overlay"): HTMLCanvasEleme
31
33
  /**
32
34
  * Calculate the plot area based on container size and margins
33
35
  */
34
- export declare function getPlotArea(container: HTMLDivElement, yAxisOptionsMap: Map<string, AxisOptions>): {
36
+ export declare function getPlotArea(container: HTMLDivElement, yAxisOptionsMap: Map<string, AxisOptions>, layout?: LayoutOptions): {
35
37
  x: number;
36
38
  y: number;
37
39
  width: number;
@@ -11,6 +11,11 @@ export interface UIContext {
11
11
  showControls: boolean;
12
12
  toolbar?: import('../../types').ToolbarOptions;
13
13
  showLegend: boolean;
14
+ /** Legend behavior options */
15
+ legendOptions?: {
16
+ highlightOnHover?: boolean;
17
+ bringToFrontOnHover?: boolean;
18
+ };
14
19
  series: Map<string, Series>;
15
20
  autoScale: () => void;
16
21
  resetZoom: () => void;
@@ -25,8 +30,10 @@ export interface UIContext {
25
30
  onInteractionEnd?: () => void;
26
31
  onHoverStart?: () => void;
27
32
  onHoverEnd?: () => void;
28
- onSeriesHoverStart?: (series: Series) => void;
29
- onSeriesHoverEnd?: (series: Series) => void;
33
+ /** @param highlightColor - Whether to apply color highlighting */
34
+ onSeriesHoverStart?: (series: Series, highlightColor: boolean) => void;
35
+ /** @param highlightColor - Whether color highlighting was applied */
36
+ onSeriesHoverEnd?: (series: Series, highlightColor: boolean) => void;
30
37
  onToggleVisibility?: (series: Series) => void;
31
38
  }
32
39
  export declare function initControls(ctx: UIContext): ChartControls | null;
@@ -97,6 +97,8 @@ export interface Chart {
97
97
  getAllYAxes(): AxisOptions[];
98
98
  /** Get the primary Y axis ID */
99
99
  getPrimaryYAxisId(): string;
100
+ /** Update unified layout configuration */
101
+ updateLayout(options: Partial<import('../layout').LayoutOptions>): void;
100
102
  /** Select data points programmatically */
101
103
  selectPoints(points: Array<{
102
104
  seriesId: string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Layout Module - Chart Component Positioning and Spacing
3
+ *
4
+ * Provides detailed control over:
5
+ * - Legend positioning and hover behavior
6
+ * - Crosshair/cursor value display modes
7
+ * - Toolbar positioning
8
+ * - Chart title configuration
9
+ * - Margins and padding
10
+ * - Axis layout spacing
11
+ */
12
+ export * from './types';
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Layout Configuration Types
3
+ *
4
+ * Provides detailed control over chart component positioning and spacing.
5
+ */
6
+ /** Position presets for legend placement */
7
+ export type LegendPositionPreset = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
8
+ export interface LegendOptions {
9
+ /** Show the legend (default: from theme) */
10
+ visible?: boolean;
11
+ /** Position preset or custom coordinates */
12
+ position?: LegendPositionPreset | {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ /** Width of the legend in pixels */
17
+ width?: number;
18
+ /**
19
+ * Highlight series color on hover in legend (default: false)
20
+ * When false, series still comes to foreground but color doesn't change
21
+ */
22
+ highlightOnHover?: boolean;
23
+ /**
24
+ * Bring series to foreground (z-index) on hover in legend (default: true)
25
+ */
26
+ bringToFrontOnHover?: boolean;
27
+ /** Draggable legend (default: true) */
28
+ draggable?: boolean;
29
+ /** Resizable legend (default: true) */
30
+ resizable?: boolean;
31
+ }
32
+ /** Mode for displaying crosshair coordinate values */
33
+ export type CrosshairValueMode = 'disabled' | 'corner' | 'floating';
34
+ /** Corner positions for crosshair value display */
35
+ export type CornerPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
36
+ export interface CrosshairOptions {
37
+ /** Show crosshair lines (default: true) */
38
+ enabled?: boolean;
39
+ /** Show vertical line (default: true) */
40
+ showVertical?: boolean;
41
+ /** Show horizontal line (default: true) */
42
+ showHorizontal?: boolean;
43
+ /** Line color (default: from theme) */
44
+ color?: string;
45
+ /** Line style (default: 'dashed') */
46
+ lineStyle?: 'solid' | 'dashed' | 'dotted';
47
+ /** Line width in pixels (default: 1) */
48
+ lineWidth?: number;
49
+ /** Snap to nearest data point (default: false) */
50
+ snapToData?: boolean;
51
+ /**
52
+ * Display mode for X,Y coordinate values (default: 'disabled')
53
+ * - 'disabled': Never show coordinate values
54
+ * - 'corner': Show values in a fixed corner position
55
+ * - 'floating': Show values next to the cursor
56
+ */
57
+ valueDisplayMode?: CrosshairValueMode;
58
+ /**
59
+ * Corner position when valueDisplayMode is 'corner' (default: 'top-left')
60
+ */
61
+ cornerPosition?: CornerPosition;
62
+ /** Value display formatting options */
63
+ valueFormat?: {
64
+ /** X value precision (default: 4) */
65
+ xPrecision?: number;
66
+ /** Y value precision (default: 4) */
67
+ yPrecision?: number;
68
+ /** Use scientific notation for large/small values */
69
+ scientific?: boolean;
70
+ };
71
+ }
72
+ /** Position presets for toolbar placement */
73
+ export type ToolbarPositionPreset = 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center';
74
+ export interface ToolbarPosition {
75
+ /** Horizontal position: distance from left edge in pixels or preset */
76
+ horizontal?: number | 'left' | 'center' | 'right';
77
+ /** Vertical position: distance from top edge in pixels or preset */
78
+ vertical?: number | 'top' | 'bottom';
79
+ /** Offset from calculated position */
80
+ offset?: {
81
+ x?: number;
82
+ y?: number;
83
+ };
84
+ }
85
+ export interface ChartTitleOptions {
86
+ /** Title text */
87
+ text?: string;
88
+ /** Title visibility */
89
+ visible?: boolean;
90
+ /** Font size in pixels */
91
+ fontSize?: number;
92
+ /** Font family */
93
+ fontFamily?: string;
94
+ /** Font weight */
95
+ fontWeight?: string | number;
96
+ /** Text color */
97
+ color?: string;
98
+ /** Title position */
99
+ position?: 'top' | 'bottom';
100
+ /** Alignment within position */
101
+ align?: 'left' | 'center' | 'right';
102
+ /** Padding around title */
103
+ padding?: number | {
104
+ top?: number;
105
+ bottom?: number;
106
+ };
107
+ }
108
+ export interface AxisLayoutOptions {
109
+ /** Distance between axis line and axis title in pixels */
110
+ titleGap?: number;
111
+ /** Distance between tick labels and axis line in pixels */
112
+ labelGap?: number;
113
+ /** Distance between tick marks and axis line in pixels */
114
+ tickGap?: number;
115
+ /** Padding between axis area and plot area in pixels */
116
+ axisPadding?: number;
117
+ }
118
+ export interface ChartMargins {
119
+ /** Top margin in pixels */
120
+ top?: number;
121
+ /** Right margin in pixels */
122
+ right?: number;
123
+ /** Bottom margin in pixels */
124
+ bottom?: number;
125
+ /** Left margin in pixels */
126
+ left?: number;
127
+ }
128
+ export interface PlotAreaPadding {
129
+ /** Padding inside the plot area - top */
130
+ top?: number;
131
+ /** Padding inside the plot area - right */
132
+ right?: number;
133
+ /** Padding inside the plot area - bottom */
134
+ bottom?: number;
135
+ /** Padding inside the plot area - left */
136
+ left?: number;
137
+ }
138
+ export interface LayoutOptions {
139
+ /** Chart title configuration */
140
+ title?: ChartTitleOptions;
141
+ /** Legend positioning and behavior */
142
+ legend?: LegendOptions;
143
+ /** Toolbar positioning */
144
+ toolbarPosition?: ToolbarPositionPreset | ToolbarPosition;
145
+ /** Crosshair/cursor configuration */
146
+ crosshair?: CrosshairOptions;
147
+ /** Chart margins (space between container and chart) */
148
+ margins?: ChartMargins;
149
+ /** Plot area padding (space inside the chart border) */
150
+ plotPadding?: PlotAreaPadding;
151
+ /** X-axis layout options */
152
+ xAxisLayout?: AxisLayoutOptions;
153
+ /** Y-axis layout options */
154
+ yAxisLayout?: AxisLayoutOptions;
155
+ /** Auto-adjust margins based on axis content (default: true) */
156
+ autoMargins?: boolean;
157
+ }
158
+ /**
159
+ * Default layout values
160
+ */
161
+ export declare const DEFAULT_LAYOUT: Required<LayoutOptions>;
162
+ /**
163
+ * Merge user layout options with defaults
164
+ */
165
+ export declare function mergeLayoutOptions(userOptions?: Partial<LayoutOptions>): Required<LayoutOptions>;