@barchart/chart-lib 2.389.1 → 2.391.0

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.
@@ -2010,6 +2010,14 @@ declare module "@barchart/chart-lib" {
2010
2010
  time: number;
2011
2011
  }
2012
2012
 
2013
+ /** A pixel coordinate relative to the chart, accepted by @see ChartAccessor.toMainAxisPoint and returned by @see ChartAccessor.fromMainAxisPoint. */
2014
+ export interface Point2d {
2015
+ /** Horizontal (x) pixel offset from the chart's left edge. */
2016
+ x: number;
2017
+ /** Vertical (y) pixel offset from the chart's top edge. */
2018
+ y: number;
2019
+ }
2020
+
2013
2021
  export interface Annotation {
2014
2022
  id: AnnotationId;
2015
2023
  axisIndex: number;
@@ -2151,7 +2159,9 @@ declare module "@barchart/chart-lib" {
2151
2159
  /** Replaces **all** annotations of the main axis — including any user-created ones — with the given models. Intended for fully programmatically-driven charts (strike/breakeven markers etc.) where users don't draw their own annotations. No-op for headless charts or before a main plot exists. */
2152
2160
  setMainAxisAnnotations(annotations: AnnotationModel[]): void;
2153
2161
  /** Converts pixel coordinates (relative to the chart) into the main axis' data coordinates; `time` is `undefined` when the x position cannot be mapped to the series. Returns `null` for headless charts or before a main plot exists. */
2154
- toMainAxisPoint(p: { x: number; y: number }): { price?: number; time?: Date } | null;
2162
+ toMainAxisPoint(p: Point2d): { price?: number; time?: Date } | null;
2163
+ /** Inverse of @see toMainAxisPoint: converts the main axis' data coordinates (time, price) into pixel coordinates relative to the chart. Returns `null` for headless charts, before a main plot exists, or when the point cannot be mapped to a pixel. */
2164
+ fromMainAxisPoint(p: AnnotationPoint): Point2d | null;
2155
2165
  /** Helper method to return back the default template, the same one you've provided during the feed's @see init call. */
2156
2166
  getDefaultTemplate(): string;
2157
2167
  /** Main API entry point. Please check out online documentation for details. */