@pipsend/charts 1.2.1 → 1.2.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/typings.d.ts CHANGED
@@ -177,6 +177,10 @@ export declare class DraggablePriceLine {
177
177
  private _mouseDownPos;
178
178
  private _mouseDownOnLine;
179
179
  constructor(chart: IChartApi, series: ISeriesApi<SeriesType>, options: DraggablePriceLineOptions);
180
+ /**
181
+ * Resolve the effective title: formatTitle(price) wins over the static title.
182
+ */
183
+ private _resolveTitle;
180
184
  private _createPriceLine;
181
185
  private _setupInteractionHandlers;
182
186
  private _getPriceFromY;
@@ -197,15 +201,21 @@ export declare class DraggablePriceLine {
197
201
  private _setHoverState;
198
202
  private _updatePrice;
199
203
  /**
200
- * Update the price line options
204
+ * Update the price line options. Any subset of options can be passed.
205
+ * Title is recomputed from `formatTitle` if available, otherwise from `title`.
201
206
  */
202
207
  applyOptions(options: Partial<DraggablePriceLineOptions>): void;
208
+ /**
209
+ * Set the title directly. Use this for updates that don't depend on the
210
+ * line's price (e.g. live PnL on a fixed entry line). Bypasses formatTitle.
211
+ */
212
+ setTitle(text: string): void;
203
213
  /**
204
214
  * Get current price
205
215
  */
206
216
  getPrice(): number;
207
217
  /**
208
- * Set price programmatically
218
+ * Set price programmatically. Triggers formatTitle if configured.
209
219
  */
210
220
  setPrice(price: number): void;
211
221
  /**
@@ -2485,6 +2495,17 @@ export interface DraggablePriceLineOptions {
2485
2495
  * from the initial mousedown position. Works regardless of `draggable`.
2486
2496
  */
2487
2497
  onClick?: (price: number) => void;
2498
+ /**
2499
+ * If provided, the line's title is computed from the current price using
2500
+ * this formatter. Invoked automatically:
2501
+ * - At construction (initial title).
2502
+ * - On every internal price change (drag move, programmatic `setPrice`).
2503
+ * Use this for live PnL previews on draggable SL/TP lines.
2504
+ *
2505
+ * For title updates that are independent of price (e.g. ticking PnL on a
2506
+ * fixed entry line), use `setTitle(text)` instead.
2507
+ */
2508
+ formatTitle?: (price: number) => string;
2488
2509
  }
2489
2510
  /**
2490
2511
  * Context passed to drawing tools
@@ -5967,6 +5988,11 @@ export interface TradingLineOptions {
5967
5988
  onDragEnd?: (price: number) => void;
5968
5989
  /** Fires on a click that didn't drag (works for non-draggable lines too). */
5969
5990
  onClick?: (price: number) => void;
5991
+ /**
5992
+ * Dynamic title computed from the line's current price. Overrides `title`
5993
+ * during drag and on `setPrice()` calls. See `DraggablePriceLineOptions.formatTitle`.
5994
+ */
5995
+ formatTitle?: (price: number) => string;
5970
5996
  }
5971
5997
  /**
5972
5998
  * Representa una posición de trading con punto de entrada y salida opcional
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "private": false,
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "name": "@pipsend/charts",
5
5
  "author": "Pipsend",
6
6
  "license": "SEE LICENSE IN LICENSE",