lightweight-charts-drawing 0.5.1 → 0.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.1 (15/10/2026)
4
+
5
+ ### Added
6
+
7
+ - `makeCoords(..., getFuture)` (optional 6th argument, `FutureAxis`): bars
8
+ after the last bar on the symbol's trading calendar, given by the host
9
+ (`slots(time, lastTime)`, `time(k, lastTime)`). With it a point placed after
10
+ the last bar takes the open time of its nearest future bar, a future time is
11
+ drawn on the future bar that holds it (`timeToX`, `xToTime`,
12
+ `timeToBarIndex`, `barIndexToTime`, `timeToXFallback`). Without it, calendar
13
+ time with the median bar interval as before.
14
+
15
+ ## 0.6.0 (13/10/2026)
16
+
17
+ ### Added
18
+
19
+ - `Coords.lowerTimeframe` (optional): bars of the chart symbol on a lower
20
+ timeframe (`bars(resolution, from)`, `barEnd(time)`, `seconds`). The fixed
21
+ range and anchored volume profiles are built from them (timeframe by the
22
+ span of the range: the first of 1, 5, 15, 30, 60, 240 minutes or 1 day
23
+ giving fewer than 5000 bars) and fall back to the chart bars without it.
24
+ - Core `kinds/vbp-engine`: the volume profile engine (rows, allocation,
25
+ direction, POC, value area, lower-timeframe choice) shared with the
26
+ OpenTrader profile studies.
27
+
28
+ ### Changed
29
+
30
+ - Volume profiles follow the reference rules: high / low rounded to the tick,
31
+ "Number Of Rows" picks the ticks per row whose row count is closest to the
32
+ input (rows may pass the high), "Ticks Per Row" rows sit on multiples of the
33
+ row size, a doji's direction comes from the previous close, the value area
34
+ adds the larger neighbour row only while it fits in the value area volume,
35
+ and the POC of equal rows is the one closest to the middle.
36
+
3
37
  ## 0.5.1 (08/10/2026)
4
38
 
5
39
  ### Added
package/dist/index.d.ts CHANGED
@@ -114,6 +114,8 @@ export declare type Coords = {
114
114
  timeZone: string;
115
115
  intraday: boolean;
116
116
  };
117
+ /** Lower-timeframe bars of the chart symbol (volume profile drawings); optional. */
118
+ lowerTimeframe?: LowerTimeframe;
117
119
  };
118
120
 
119
121
  declare type Ctx = CanvasRenderingContext2D;
@@ -690,6 +692,16 @@ declare type FourPoint = {
690
692
  * finalized with a double-click (the spec carries `variableLength: true`). */
691
693
  declare type FreehandKind = "polyline" | "path" | "brush" | "highlighter";
692
694
 
695
+ /** Bars after the last bar on the symbol's trading calendar (the host knows the sessions). The time scale continues
696
+ * after the last bar with the bars the symbol would open: the rest of the session, then the next sessions (nights,
697
+ * weekends and holidays skipped). Times are epoch seconds. */
698
+ declare type FutureAxis = {
699
+ /** Future bars that open after `lastTime` and at or before `time` (0 = still on the last bar). */
700
+ slots: (time: number, lastTime: number) => number;
701
+ /** Open time of the k-th future bar (k >= 1), null past the host's range. */
702
+ time: (k: number, lastTime: number) => number | null;
703
+ };
704
+
693
705
  /** One regression trend line (TV study plot style). */
694
706
  /** Gann level line (TV levels.N: color, width, visible). */
695
707
  declare type GannLine = {
@@ -795,6 +807,18 @@ export declare type LoadedImage = {
795
807
  height: number;
796
808
  };
797
809
 
810
+ /** Bars of the chart symbol on a lower timeframe (the volume profiles are built from them, as the reference
811
+ * app's volume profile study). Optional: without it the profiles use the chart bars. */
812
+ declare type LowerTimeframe = {
813
+ /** Bars on `resolution` ("1", "5", "15", "30", "60", "240", "1D", "1S") from `from` (epoch seconds) on;
814
+ * undefined while they load (the host redraws the drawings when they arrive). */
815
+ bars: (resolution: string, from: number) => OHLC[] | undefined;
816
+ /** End (epoch seconds) of the chart bar starting at `time`: its interval, a daily bar's session close. */
817
+ barEnd: (time: number) => number;
818
+ /** The chart interval is in seconds (its profiles use 1-second bars). */
819
+ seconds: boolean;
820
+ };
821
+
798
822
  export declare type MagnetMode = "off" | "weak" | "strong";
799
823
 
800
824
  export declare function makeCoords(chart: IChartApi, series: ISeriesApi<SeriesType>, getRaw: () => OHLC[],
@@ -803,7 +827,9 @@ export declare function makeCoords(chart: IChartApi, series: ISeriesApi<SeriesTy
803
827
  getIndicatorValues?: (sec: number | null) => number[], getTimeInfo?: () => {
804
828
  timeZone: string;
805
829
  intraday: boolean;
806
- }): Coords;
830
+ },
831
+ /** Future bars on the trading calendar; null (or absent) = calendar time extrapolated with the bar interval. */
832
+ getFuture?: () => FutureAxis | null): Coords;
807
833
 
808
834
  /** Point-count migration (10/07/2026): several kinds moved to TV's point
809
835
  * models. Old saved drawings are padded/synthesized best-effort so they keep
@@ -1273,8 +1299,9 @@ export declare type TimeAxisLabel = {
1273
1299
  /** Shared time→x with the off-bar fallback, for non-drawing renderers (event
1274
1300
  * markers, etc.) that paint at arbitrary times. Mirrors the `timeToX` method:
1275
1301
  * try lightweight-charts' exact mapping first, then the gap-aware logical
1276
- * interpolation. `sec` is UNIX seconds. Returns null with no data. */
1277
- export declare function timeToXFallback(chart: IChartApi, sec: number, bars: OHLC[]): number | null;
1302
+ * interpolation (future bars on `future` when given). `sec` is UNIX seconds.
1303
+ * Returns null with no data. */
1304
+ export declare function timeToXFallback(chart: IChartApi, sec: number, bars: OHLC[], future?: FutureAxis | null): number | null;
1278
1305
 
1279
1306
  /** TV _onAnchoredChange: anchoring stores the current screen point as pane
1280
1307
  * fractions; unanchoring turns the fixed point back into a data point (bar