@pipsend/charts 2.3.12 → 2.3.14

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
@@ -37,6 +37,11 @@ declare abstract class DrawingToolBase implements IDrawingTool {
37
37
  isVisible(): boolean;
38
38
  /** Series the tool is attached to. */
39
39
  series(): ISeriesApi<SeriesType>;
40
+ /**
41
+ * Box the selection toolbar anchors to, in pane pixels. Null falls back to
42
+ * the serialized points, which cannot place a line across the whole pane.
43
+ */
44
+ selectionBox(): DrawingBounds | null;
40
45
  getState(): DrawingToolState;
41
46
  abstract remove(): void;
42
47
  protected abstract _update(): void;
@@ -292,7 +297,9 @@ export declare class CrossLineTool extends DrawingToolBase {
292
297
  private _grab;
293
298
  private _moveStartTime;
294
299
  private _moveStartPrice;
300
+ private _placement;
295
301
  constructor(context: DrawingContext, options: CrossLineToolOptions);
302
+ isComplete(): boolean;
296
303
  private _createPrimitive;
297
304
  private _requestUpdate;
298
305
  protected _update(): void;
@@ -464,11 +471,13 @@ export declare class DrawingToolsManager {
464
471
  * the chart is panned or zoomed.
465
472
  */
466
473
  selectionBounds(): DrawingBounds | null;
474
+ /** Relative to the chart element; the tool's box is relative to its pane. */
475
+ private _boundsOf;
467
476
  /**
468
477
  * Bounds come from the tool's own serialized points, so this works for every
469
478
  * tool without each one having to report a box.
470
479
  */
471
- private _boundsOf;
480
+ private _boxFromPoints;
472
481
  /** Panes below the first one are offset inside the chart element. */
473
482
  private _paneOffsetOf;
474
483
  private _emitSelection;
@@ -632,6 +641,7 @@ export declare class FibonacciExtensionTool extends DrawingToolBase {
632
641
  private _isHovered;
633
642
  private _isDragging;
634
643
  private _dragTarget;
644
+ private _placement;
635
645
  constructor(context: DrawingContext, options: FibonacciExtensionOptions);
636
646
  private _createPrimitive;
637
647
  private _createPaneView;
@@ -798,7 +808,11 @@ export declare class GanttTool extends DrawingToolBase {
798
808
  private _grab;
799
809
  private _moveStart;
800
810
  private _hoveredSegmentIndex;
811
+ private _placement;
801
812
  constructor(context: DrawingContext, options: GanttToolOptions);
813
+ private _placeAt;
814
+ isComplete(): boolean;
815
+ selectionBox(): DrawingBounds | null;
802
816
  private _createPrimitive;
803
817
  private _createPaneView;
804
818
  drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
@@ -845,7 +859,11 @@ export declare class HorizontalLineTool extends DrawingToolBase {
845
859
  private _isDragging;
846
860
  private _grab;
847
861
  private _moveStartPrice;
862
+ private _placement;
848
863
  constructor(context: DrawingContext, options: HorizontalLineToolOptions);
864
+ private _placeAt;
865
+ isComplete(): boolean;
866
+ selectionBox(): DrawingBounds | null;
849
867
  private _createPrimitive;
850
868
  private _createPaneView;
851
869
  /** Where the line starts, in CSS pixels. Zero unless it is a ray. */
@@ -1242,6 +1260,7 @@ export declare class PositionTool extends DrawingToolBase {
1242
1260
  private _paneView;
1243
1261
  private _isSelected;
1244
1262
  private _isHovered;
1263
+ private _placement;
1245
1264
  private _isDragging;
1246
1265
  private _dragTarget;
1247
1266
  private _grab;
@@ -1249,6 +1268,9 @@ export declare class PositionTool extends DrawingToolBase {
1249
1268
  private _profitRect;
1250
1269
  private _lossRect;
1251
1270
  constructor(context: DrawingContext, options: PositionToolOptions);
1271
+ private _placeAt;
1272
+ isComplete(): boolean;
1273
+ private _span;
1252
1274
  private _createPrimitive;
1253
1275
  private _createPaneView;
1254
1276
  drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
@@ -1482,6 +1504,7 @@ export declare class TextTool extends DrawingToolBase {
1482
1504
  private _moveStart;
1483
1505
  private _isEditing;
1484
1506
  private _clickOutsideHandler;
1507
+ private _placement;
1485
1508
  constructor(context: DrawingContext, options: TextToolOptions);
1486
1509
  private _setupClickOutsideHandler;
1487
1510
  private _createPrimitive;
@@ -1510,6 +1533,9 @@ export declare class TextTool extends DrawingToolBase {
1510
1533
  */
1511
1534
  private _hitTestPrimitive;
1512
1535
  hitTest(x: number, y: number): boolean;
1536
+ private _tailSize;
1537
+ private _boxOrigin;
1538
+ private _traceBox;
1513
1539
  hitTestEndpoint(x: number, y: number): "anchor" | null;
1514
1540
  startDrag(target: "anchor" | "body", grab: DragAnchor): void;
1515
1541
  stopDrag(): void;
@@ -1634,7 +1660,10 @@ export declare class VerticalLineTool extends DrawingToolBase {
1634
1660
  private _isDragging;
1635
1661
  private _grab;
1636
1662
  private _moveStartTime;
1663
+ private _placement;
1637
1664
  constructor(context: DrawingContext, options: VerticalLineToolOptions);
1665
+ isComplete(): boolean;
1666
+ selectionBox(): DrawingBounds | null;
1638
1667
  private _createPrimitive;
1639
1668
  private _createPaneView;
1640
1669
  drawToCanvas(ctx: CanvasRenderingContext2D, horizontalPixelRatio: number, verticalPixelRatio: number): void;
@@ -3321,6 +3350,8 @@ export interface ControllableLine {
3321
3350
  export interface CrossLineToolOptions extends DrawingToolOptions {
3322
3351
  time?: Time;
3323
3352
  price?: number;
3353
+ /** Waits for a click that sets the time and the price. */
3354
+ interactive?: boolean;
3324
3355
  lineColor?: string;
3325
3356
  lineWidth?: number;
3326
3357
  lineStyle?: "solid" | "dashed" | "dotted";
@@ -3505,8 +3536,7 @@ export interface DraggablePriceLineOptions {
3505
3536
  formatTitle?: (price: number) => string;
3506
3537
  }
3507
3538
  /**
3508
- * Where a tool sits on screen, in pixels relative to the chart element, so a
3509
- * floating UI can be anchored to it.
3539
+ * Where a tool sits on screen, in pixels, so a floating UI can be anchored to it.
3510
3540
  */
3511
3541
  export interface DrawingBounds {
3512
3542
  left: number;
@@ -3579,6 +3609,7 @@ export interface FibonacciExtensionOptions extends DrawingToolOptions {
3579
3609
  lineWidth?: number;
3580
3610
  showLabels?: boolean;
3581
3611
  extendLines?: boolean;
3612
+ /** Waits for three clicks that set its points in order. */
3582
3613
  interactive?: boolean;
3583
3614
  onUpdate?: () => void;
3584
3615
  onRemove?: () => void;
@@ -3660,6 +3691,8 @@ export interface GanttSegment {
3660
3691
  }
3661
3692
  export interface GanttToolOptions extends DrawingToolOptions {
3662
3693
  segments?: GanttSegment[];
3694
+ /** Waits for a click that sets where the segments start, and in which row. */
3695
+ interactive?: boolean;
3663
3696
  rowHeight?: number;
3664
3697
  rowSpacing?: number;
3665
3698
  fillOpacity?: number;
@@ -3817,6 +3850,7 @@ export interface HistogramStyleOptions {
3817
3850
  }
3818
3851
  export interface HorizontalLineToolOptions extends DrawingToolOptions {
3819
3852
  price?: number;
3853
+ /** Waits for a click that sets the level, and the start of a ray. */
3820
3854
  interactive?: boolean;
3821
3855
  /**
3822
3856
  * Where the line starts. Left undefined it spans the whole chart; set, the
@@ -6317,11 +6351,13 @@ export interface PositionMetrics {
6317
6351
  export interface PositionToolOptions extends DrawingToolOptions {
6318
6352
  entryPrice: number;
6319
6353
  entryTime: Time;
6354
+ /** Right edge of the box. Without it the box spans a fifth of the pane. */
6320
6355
  endTime?: Time;
6321
6356
  stopLoss?: number;
6322
6357
  takeProfit?: number;
6323
6358
  quantity?: number;
6324
6359
  pipConfig?: PipConfig;
6360
+ /** Waits for a click to place the entry; stop and target keep their distance from it. */
6325
6361
  interactive?: boolean;
6326
6362
  profitColor?: string;
6327
6363
  lossColor?: string;
@@ -6673,7 +6709,10 @@ export interface RectangleToolOptions extends DrawingToolOptions {
6673
6709
  borderStyle?: "solid" | "dashed" | "dotted";
6674
6710
  showLabel?: boolean;
6675
6711
  labelText?: string;
6676
- labelPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center";
6712
+ labelPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center" | "left" | "right";
6713
+ labelColor?: string;
6714
+ labelBackgroundColor?: string;
6715
+ labelFontSize?: number;
6677
6716
  onUpdate?: () => void;
6678
6717
  onRemove?: () => void;
6679
6718
  }
@@ -7259,9 +7298,16 @@ export interface TextToolOptions extends DrawingToolOptions {
7259
7298
  borderWidth?: number;
7260
7299
  textAlign?: "left" | "center" | "right";
7261
7300
  maxWidth?: number;
7301
+ anchor?: TextToolAnchor;
7302
+ pointer?: boolean;
7303
+ borderRadius?: number;
7304
+ /** Waits for a click that sets `time` and `price`. */
7305
+ interactive?: boolean;
7262
7306
  onUpdate?: () => void;
7263
7307
  onRemove?: () => void;
7264
7308
  onTextChange?: (text: string) => void;
7309
+ /** Called once an interactive text has been placed. */
7310
+ onComplete?: () => void;
7265
7311
  }
7266
7312
  export interface TextWatermarkLineOptions {
7267
7313
  /**
@@ -7595,6 +7641,7 @@ export interface VerticalGradientColor {
7595
7641
  }
7596
7642
  export interface VerticalLineToolOptions extends DrawingToolOptions {
7597
7643
  time?: Time;
7644
+ /** Waits for a click that sets the time. */
7598
7645
  interactive?: boolean;
7599
7646
  lineColor?: string;
7600
7647
  lineWidth?: number;
@@ -8040,9 +8087,10 @@ export type SeriesMarkerPricePosition = "atPriceTop" | "atPriceBottom" | "atPric
8040
8087
  *
8041
8088
  * `tag` draws the text inside a rounded bubble with a pointer aimed at the
8042
8089
  * anchor, which is what trading platforms use for BUY/SELL callouts. The other
8043
- * shapes draw the text next to the shape instead.
8090
+ * shapes draw the text next to the shape instead. `xcross` is a thin ×, the
8091
+ * usual mark for a signal that was cancelled or expired.
8044
8092
  */
8045
- export type SeriesMarkerShape = "circle" | "square" | "arrowUp" | "arrowDown" | "tag";
8093
+ export type SeriesMarkerShape = "circle" | "square" | "arrowUp" | "arrowDown" | "tag" | "xcross";
8046
8094
  /**
8047
8095
  * The visual stacking order for the markers within the chart.
8048
8096
  *
@@ -8073,6 +8121,12 @@ export type SessionPeriod = "daily" | "weekly" | "monthly";
8073
8121
  * A custom function used to handle changes to the time scale's size.
8074
8122
  */
8075
8123
  export type SizeChangeEventHandler = (width: number, height: number) => void;
8124
+ /**
8125
+ * Where the `time`/`price` point sits on the label. `top-left` hangs the box below and to the
8126
+ * right of the point; `left`, `right` and `center` centre it on the price, the way a price label
8127
+ * at the end of a line reads. `pointer` adds a tail from the box to the point for `left`/`right`.
8128
+ */
8129
+ export type TextToolAnchor = "top-left" | "left" | "right" | "center";
8076
8130
  /**
8077
8131
  * The `TickMarkFormatter` is used to customize tick mark labels on the time scale.
8078
8132
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "private": false,
3
- "version": "2.3.12",
3
+ "version": "2.3.14",
4
4
  "name": "@pipsend/charts",
5
5
  "author": "Pipsend",
6
6
  "license": "SEE LICENSE IN LICENSE",