openalgo-charts 1.0.2 → 1.0.3

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Library version string. Matches package.json (published npm release). */
2
- declare const VERSION = "1.0.2";
2
+ declare const VERSION = "1.0.3";
3
3
  /** Returns the current library version. */
4
4
  declare function version(): string;
5
5
 
@@ -365,6 +365,12 @@ interface SeriesStyle {
365
365
  volumeScaled?: boolean;
366
366
  /** Whether the series is drawn and counted in autoscale. Default true. */
367
367
  visible?: boolean;
368
+ /** Optional label carried with the series (for host-drawn legends). */
369
+ title?: string;
370
+ /** Show the dashed horizontal last-price line across the plot. Default true. */
371
+ priceLineVisible?: boolean;
372
+ /** Show the last-value tag on the price axis. Default true. */
373
+ lastValueVisible?: boolean;
368
374
  color?: string;
369
375
  lineWidth?: number;
370
376
  /** Line dash style for line/step/area/HLC series. Default 'solid'. */
@@ -405,6 +411,14 @@ interface ChartTheme {
405
411
  axisFontSize?: number;
406
412
  /** Grid line dash style (default 'solid'). */
407
413
  gridStyle?: 'solid' | 'dashed' | 'dotted';
414
+ /** Crosshair line dash style (default 'dashed'). */
415
+ crosshairStyle?: 'solid' | 'dashed' | 'dotted';
416
+ /** Crosshair line width in device px (default 1 = hairline). */
417
+ crosshairWidth?: number;
418
+ /** Background of the crosshair value tags (defaults to `crosshair`). */
419
+ crosshairLabelBackground?: string;
420
+ /** Show the crosshair price/time value tags (default true). */
421
+ crosshairLabelVisible?: boolean;
408
422
  upColor: string;
409
423
  downColor: string;
410
424
  wickUpColor: string;
@@ -578,6 +592,20 @@ interface SeriesApi {
578
592
  createMarkers(): SeriesMarkers;
579
593
  }
580
594
 
595
+ /**
596
+ * Axis label rendering (ARCHITECTURE.md §6, §5.3). Price axis (right strip) and
597
+ * time axis (bottom strip). Time labels switch from clock to date at IST day
598
+ * boundaries; gaps are already collapsed by the logical-index time scale.
599
+ */
600
+
601
+ /**
602
+ * Boundary class of a time-axis label, passed to a custom `timeFormatter` as a
603
+ * hint so a host can render adaptive labels (year at year boundaries, month at
604
+ * month boundaries, day otherwise, clock intraday) — parity with common
605
+ * `tickMarkFormatter(time, tickMarkType)` APIs.
606
+ */
607
+ type TickMarkType = 'year' | 'month' | 'day' | 'time' | 'timeWithSeconds';
608
+
581
609
  /**
582
610
  * A pane is one vertically-stacked drawing region (price pane, volume pane,
583
611
  * indicator pane). It owns a base + top canvas (ARCHITECTURE.md §3.1) and a
@@ -605,7 +633,7 @@ interface PaneRenderContext {
605
633
  /** Draw the horizontal (price) grid lines. */
606
634
  showHorzGrid: boolean;
607
635
  /** Optional custom time label formatter (UTC seconds -> string). Defaults to IST. */
608
- timeFormatter?: (utcSeconds: number) => string;
636
+ timeFormatter?: (utcSeconds: number, tickMark?: TickMarkType) => string;
609
637
  }
610
638
  declare class Pane {
611
639
  readonly element: HTMLElement;
@@ -1061,7 +1089,7 @@ interface ChartOptions {
1061
1089
  * omitted, labels use IST (Indian market default). e.g. for UTC:
1062
1090
  * `(s) => new Date(s * 1000).toISOString().slice(11, 16)`.
1063
1091
  */
1064
- timeFormatter?: (utcSeconds: number) => string;
1092
+ timeFormatter?: (utcSeconds: number, tickMark?: TickMarkType) => string;
1065
1093
  }
1066
1094
  interface AddSeriesOptions {
1067
1095
  /** Target pane index (0 = price). Higher panes are created on demand. */
@@ -1280,7 +1308,7 @@ declare class Chart {
1280
1308
  * Set a custom time-axis + crosshair label formatter (UTC seconds -> string)
1281
1309
  * at runtime. Pass undefined to restore the IST default.
1282
1310
  */
1283
- setTimeFormatter(fn: ((utcSeconds: number) => string) | undefined): void;
1311
+ setTimeFormatter(fn: ((utcSeconds: number, tickMark?: TickMarkType) => string) | undefined): void;
1284
1312
  /** Swap the palette at runtime (dark/light toggle) without recreating the chart. */
1285
1313
  setTheme(theme: ChartTheme): void;
1286
1314
  /**
@@ -1294,7 +1322,7 @@ declare class Chart {
1294
1322
  horzLines?: boolean;
1295
1323
  };
1296
1324
  priceFormatter?: ((price: number) => string) | null;
1297
- timeFormatter?: ((utcSeconds: number) => string) | undefined;
1325
+ timeFormatter?: ((utcSeconds: number, tickMark?: TickMarkType) => string) | undefined;
1298
1326
  crosshairMode?: CrosshairMode;
1299
1327
  }): void;
1300
1328
  panes(): readonly Pane[];
@@ -2126,4 +2154,4 @@ declare function lerp(a: number, b: number, t: number): number;
2126
2154
  */
2127
2155
  declare function roundToTick(value: number, step: number): number;
2128
2156
 
2129
- export { ALT_PRESET, type AddSeriesOptions, type AggTick, BUILTIN_COMMANDS, type Bar, type BarUpdate, type BarsRequest, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, Chart, type ChartEvent, type ChartOptions, type ChartTheme, type CrosshairMoveEvent, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, type DepthLevel, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type HistogramStyle, type IPrimitive, IST_OFFSET_SECONDS, InvalidationLevel, type KeymapEntry, type LateTickPolicy, type LinePoint, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, Pane, type PaneInvalidation, type PlaceOrder, type PositionSide, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PrimitiveHit, type PrimitiveHost, type PrimitiveRenderContext, type RendererEntry, type SeriesApi, type SeriesDataItem, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesStyle, type SeriesType, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, type Tick, TickBarAggregator, type TickTimeframe, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, type UnsubscribeFn, VERSION, type VolumeMode, type WatermarkPosition, type Whitespace, type WsControlMessage, type WsMode, type WsState, type ZOrder, atr, autoscaleRange, bestHit, bitmapSize, clamp, compactVolume, conflateBars, conflateItems, conflationGroupSize, createChart, darkTheme, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, formatCombo, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, generateBars, getChartType, intervalToSeconds, isNewIstDay, isReservedCombo, isValidCombo, isWhitespace, istStringToUtcSeconds, lerp, lightTheme, mapHistoryResponse, mapOrder, mapPosition, markerSizePx, mergeBars, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, precisionForStep, registerChartType, registeredChartTypes, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, snapToDevicePixel, supertrend, supertrendSeries, toBar, trueRange, utcSecondsToIstDateString, utcSecondsToIstParts, version, verticalGradient, watermarkRect };
2157
+ export { ALT_PRESET, type AddSeriesOptions, type AggTick, BUILTIN_COMMANDS, type Bar, type BarUpdate, type BarsRequest, CandleBuilder, type CandleBuilderOptions, type CandleStyle, type CandleUpdate, Chart, type ChartEvent, type ChartOptions, type ChartTheme, type CrosshairMoveEvent, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, type DataFeed, type DepthLevel, type DrawItem, EventMarkers, FakeDataFeed, type FeedScheduler, type HistogramStyle, type IPrimitive, IST_OFFSET_SECONDS, InvalidationLevel, type KeymapEntry, type LateTickPolicy, type LinePoint, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OriginalTime, Pane, type PaneInvalidation, type PlaceOrder, type PositionSide, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PrimitiveHit, type PrimitiveHost, type PrimitiveRenderContext, type RendererEntry, type SeriesApi, type SeriesDataItem, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesStyle, type SeriesType, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, type Tick, TickBarAggregator, type TickMarkType, type TickTimeframe, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, type UnsubscribeFn, VERSION, type VolumeMode, type WatermarkPosition, type Whitespace, type WsControlMessage, type WsMode, type WsState, type ZOrder, atr, autoscaleRange, bestHit, bitmapSize, clamp, compactVolume, conflateBars, conflateItems, conflationGroupSize, createChart, darkTheme, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, formatCombo, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, generateBars, getChartType, intervalToSeconds, isNewIstDay, isReservedCombo, isValidCombo, isWhitespace, istStringToUtcSeconds, lerp, lightTheme, mapHistoryResponse, mapOrder, mapPosition, markerSizePx, mergeBars, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, precisionForStep, registerChartType, registeredChartTypes, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, snapToDevicePixel, supertrend, supertrendSeries, toBar, trueRange, utcSecondsToIstDateString, utcSecondsToIstParts, version, verticalGradient, watermarkRect };