tslab-widgets 0.1.0 → 1.1.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.
Files changed (45) hide show
  1. package/LICENSE +170 -197
  2. package/dist/chart/chart.d.ts +10 -9
  3. package/dist/chart/chart.d.ts.map +1 -0
  4. package/dist/chart/chart.js +223 -85
  5. package/dist/chart/chart.js.map +1 -0
  6. package/dist/chart/plugins/tooltip.d.ts +32 -17
  7. package/dist/chart/plugins/tooltip.d.ts.map +1 -0
  8. package/dist/chart/plugins/tooltip.js +235 -64
  9. package/dist/chart/plugins/tooltip.js.map +1 -0
  10. package/dist/chart/plugins/trendLine.d.ts +5 -4
  11. package/dist/chart/plugins/trendLine.d.ts.map +1 -0
  12. package/dist/chart/plugins/trendLine.js +10 -4
  13. package/dist/chart/plugins/trendLine.js.map +1 -0
  14. package/dist/chart/plugins/verticalLine.d.ts +5 -4
  15. package/dist/chart/plugins/verticalLine.d.ts.map +1 -0
  16. package/dist/chart/plugins/verticalLine.js +43 -13
  17. package/dist/chart/plugins/verticalLine.js.map +1 -0
  18. package/dist/chart/plugins/volumeProfile.d.ts +31 -11
  19. package/dist/chart/plugins/volumeProfile.d.ts.map +1 -0
  20. package/dist/chart/plugins/volumeProfile.js +162 -24
  21. package/dist/chart/plugins/volumeProfile.js.map +1 -0
  22. package/dist/config/versions.d.ts +28 -0
  23. package/dist/config/versions.d.ts.map +1 -0
  24. package/dist/config/versions.js +41 -0
  25. package/dist/config/versions.js.map +1 -0
  26. package/dist/gauge/gauge.d.ts +9 -6
  27. package/dist/gauge/gauge.d.ts.map +1 -0
  28. package/dist/gauge/gauge.js +379 -40
  29. package/dist/gauge/gauge.js.map +1 -0
  30. package/dist/index.d.ts +8 -7
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +4 -3
  33. package/dist/index.js.map +1 -0
  34. package/dist/json/json.d.ts +1 -0
  35. package/dist/json/json.d.ts.map +1 -0
  36. package/dist/json/json.js +10 -6
  37. package/dist/json/json.js.map +1 -0
  38. package/dist/table/table.d.ts +9 -0
  39. package/dist/table/table.d.ts.map +1 -0
  40. package/dist/table/table.js +49 -0
  41. package/dist/table/table.js.map +1 -0
  42. package/package.json +49 -30
  43. package/readme.md +43 -7
  44. package/dist/csv/csv.d.ts +0 -5
  45. package/dist/csv/csv.js +0 -83
@@ -7,14 +7,17 @@ class VertLinePaneRenderer {
7
7
  this._options = _options;
8
8
  }
9
9
  draw(target) {
10
- target.useBitmapCoordinateSpace(scope => {
10
+ target.useBitmapCoordinateSpace((scope) => {
11
11
  if (this._x === null)
12
12
  return;
13
13
  const ctx = scope.context;
14
14
  const scaledPosition = Math.round(scope.horizontalPixelRatio * this._x);
15
15
  const lineBitmapWidth = Math.round(this._options.width * scope.horizontalPixelRatio);
16
16
  const offset = Math.floor(lineBitmapWidth * 0.5);
17
- const position = { length: lineBitmapWidth, position: scaledPosition - offset };
17
+ const position = {
18
+ length: lineBitmapWidth,
19
+ position: scaledPosition - offset,
20
+ };
18
21
  ctx.fillStyle = this._options.color;
19
22
  ctx.fillRect(position.position, 0, position.length, scope.bitmapSize.height);
20
23
  });
@@ -42,22 +45,40 @@ class VertLineTimeAxisView {
42
45
  this._options = _options;
43
46
  this._x = null;
44
47
  }
45
- backColor() { return this._options.labelBackgroundColor; }
46
- coordinate() { var _a; return (_a = this._x) !== null && _a !== void 0 ? _a : 0; }
47
- text() { return this._options.labelText; }
48
- textColor() { return this._options.labelTextColor; }
49
- tickVisible() { return this._options.showLabel; }
48
+ backColor() {
49
+ return this._options.labelBackgroundColor;
50
+ }
51
+ coordinate() {
52
+ var _a;
53
+ return (_a = this._x) !== null && _a !== void 0 ? _a : 0;
54
+ }
55
+ text() {
56
+ return this._options.labelText;
57
+ }
58
+ textColor() {
59
+ return this._options.labelTextColor;
60
+ }
61
+ tickVisible() {
62
+ return this._options.showLabel;
63
+ }
50
64
  update() {
51
65
  const timeScale = this._source._chart.timeScale();
52
66
  this._x = timeScale.timeToCoordinate(this._source._time);
53
67
  }
54
- visible() { return this._options.showLabel; }
68
+ visible() {
69
+ return this._options.showLabel;
70
+ }
55
71
  }
56
72
  exports.VertLineTimeAxisView = VertLineTimeAxisView;
57
73
  class VertLine {
58
74
  constructor(chart, series, time, options) {
59
75
  const defaultOptions = {
60
- color: 'green', labelBackgroundColor: 'green', labelText: '', labelTextColor: 'white', showLabel: false, width: 2,
76
+ color: "green",
77
+ labelBackgroundColor: "green",
78
+ labelText: "",
79
+ labelTextColor: "white",
80
+ showLabel: false,
81
+ width: 2,
61
82
  };
62
83
  const vertLineOptions = Object.assign(Object.assign({}, defaultOptions), options);
63
84
  this._chart = chart;
@@ -66,11 +87,20 @@ class VertLine {
66
87
  this._paneViews = [new VertLinePaneView(this, vertLineOptions)];
67
88
  this._timeAxisViews = [new VertLineTimeAxisView(this, vertLineOptions)];
68
89
  }
69
- paneViews() { return this._paneViews; }
70
- timeAxisViews() { return this._timeAxisViews; }
90
+ paneViews() {
91
+ return this._paneViews;
92
+ }
93
+ timeAxisViews() {
94
+ return this._timeAxisViews;
95
+ }
71
96
  updateAllViews() {
72
- this._paneViews.forEach(pw => { pw.update(); });
73
- this._timeAxisViews.forEach(tw => { tw.update(); });
97
+ this._paneViews.forEach((pw) => {
98
+ pw.update();
99
+ });
100
+ this._timeAxisViews.forEach((tw) => {
101
+ tw.update();
102
+ });
74
103
  }
75
104
  }
76
105
  exports.VertLine = VertLine;
106
+ //# sourceMappingURL=verticalLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verticalLine.js","sourceRoot":"","sources":["../../../src/chart/plugins/verticalLine.ts"],"names":[],"mappings":";;;AAsBA,MAAa,oBAAoB;IAChC,YACS,EAAqB,EACrB,QAA0B;QAD1B,OAAE,GAAF,EAAE,CAAmB;QACrB,aAAQ,GAAR,QAAQ,CAAkB;IAChC,CAAC;IACJ,IAAI,CAAC,MAAqD;QACzD,MAAM,CAAC,wBAAwB,CAAC,CAAC,KAAK,EAAE,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G,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,gBAAgB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,oBAAoB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,SAAS;QACR,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IACD,aAAa;QACZ,OAAO,IAAI,CAAC,cAAc,CAAC;IAC5B,CAAC;IACD,cAAc;QACb,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAC9B,EAAE,CAAC,MAAM,EAAE,CAAC;QACb,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAClC,EAAE,CAAC,MAAM,EAAE,CAAC;QACb,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AA1CD,4BA0CC"}
@@ -1,4 +1,4 @@
1
- import type { Coordinate, IChartApi, ISeriesApi, ISeriesPrimitive, ISeriesPrimitivePaneRenderer, ISeriesPrimitivePaneView, SeriesType, Time } from 'lightweight-charts';
1
+ import type { CandlestickData, Coordinate, IChartApi, IPrimitivePaneRenderer, IPrimitivePaneView, ISeriesApi, ISeriesPrimitive, SeriesType, Time } from "lightweight-charts";
2
2
  type IVolumeProfileDataPoint = {
3
3
  negativeVolume: number;
4
4
  positiveVolume: number;
@@ -6,31 +6,31 @@ type IVolumeProfileDataPoint = {
6
6
  };
7
7
  export type IVolumeProfileData = {
8
8
  fromTime: Time;
9
- position: 'left' | 'right';
9
+ toTime?: Time;
10
+ position: "left" | "right";
10
11
  profile: IVolumeProfileDataPoint[];
11
12
  };
12
13
  type IVolumeProfileItem = {
13
14
  widthNegative: number;
14
15
  widthPositive: number;
15
16
  y: Coordinate | null;
17
+ height: number;
16
18
  };
17
19
  type IVolumeProfileRendererData = {
18
- columnHeight: number;
19
20
  items: IVolumeProfileItem[];
20
- position: 'left' | 'right';
21
+ position: "left" | "right";
21
22
  top: Coordinate | null;
22
23
  widthNegative: number;
23
24
  widthPositive: number;
24
25
  };
25
- export declare class VolumeProfileRenderer implements ISeriesPrimitivePaneRenderer {
26
+ export declare class VolumeProfileRenderer implements IPrimitivePaneRenderer {
26
27
  private _data;
27
28
  constructor(_data: IVolumeProfileRendererData);
28
29
  private positionsBox;
29
- draw(target: Parameters<ISeriesPrimitivePaneRenderer['draw']>[0]): void;
30
+ draw(target: Parameters<IPrimitivePaneRenderer["draw"]>[0]): void;
30
31
  }
31
- export declare class VolumeProfilePaneView implements ISeriesPrimitivePaneView {
32
+ export declare class VolumeProfilePaneView implements IPrimitivePaneView {
32
33
  private _source;
33
- private _columnHeight;
34
34
  private _items;
35
35
  private _top;
36
36
  private _widthNegative;
@@ -45,16 +45,36 @@ export declare class VolumeProfilePaneView implements ISeriesPrimitivePaneView {
45
45
  export declare class VolumeProfileSeries implements ISeriesPrimitive {
46
46
  private _chart;
47
47
  private _series;
48
- private _vpData;
49
48
  private _paneViews;
49
+ private _vpData;
50
50
  _vpIndex: null | number;
51
- constructor(_chart: IChartApi, _series: ISeriesApi<SeriesType>, _vpData: IVolumeProfileData);
51
+ constructor(_chart: IChartApi, _series: ISeriesApi<SeriesType>, _vpSettings: VolumeProfileConfig, ohlcv: (CandlestickData & {
52
+ volume: number;
53
+ })[]);
52
54
  getContext(): {
53
55
  chart: IChartApi;
54
- series: ISeriesApi<keyof import("lightweight-charts").SeriesOptionsMap, Time, import("lightweight-charts").BarData<Time> | import("lightweight-charts").WhitespaceData<Time> | import("lightweight-charts").CandlestickData<Time> | import("lightweight-charts").AreaData<Time> | import("lightweight-charts").BaselineData<Time> | import("lightweight-charts").LineData<Time> | import("lightweight-charts").HistogramData<Time> | import("lightweight-charts").CustomData<Time> | import("lightweight-charts").CustomSeriesWhitespaceData<Time>, import("lightweight-charts").BarSeriesOptions | import("lightweight-charts").CandlestickSeriesOptions | import("lightweight-charts").AreaSeriesOptions | import("lightweight-charts").BaselineSeriesOptions | import("lightweight-charts").LineSeriesOptions | import("lightweight-charts").HistogramSeriesOptions | import("lightweight-charts").CustomSeriesOptions, import("lightweight-charts").DeepPartial<import("lightweight-charts").AreaStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").BaselineStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").BarStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").CandlestickStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").HistogramStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").LineStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").CustomStyleOptions & import("lightweight-charts").SeriesOptionsCommon>>;
56
+ series: ISeriesApi<keyof import("lightweight-charts").SeriesOptionsMap, Time, import("lightweight-charts").WhitespaceData<Time> | import("lightweight-charts").LineData<Time> | CandlestickData<Time> | import("lightweight-charts").BarData<Time> | import("lightweight-charts").AreaData<Time> | import("lightweight-charts").BaselineData<Time> | import("lightweight-charts").HistogramData<Time> | import("lightweight-charts").CustomData<Time> | import("lightweight-charts").CustomSeriesWhitespaceData<Time>, import("lightweight-charts").BarSeriesOptions | import("lightweight-charts").CandlestickSeriesOptions | import("lightweight-charts").AreaSeriesOptions | import("lightweight-charts").BaselineSeriesOptions | import("lightweight-charts").LineSeriesOptions | import("lightweight-charts").HistogramSeriesOptions | import("lightweight-charts").CustomSeriesOptions, import("lightweight-charts").DeepPartial<import("lightweight-charts").BarStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").CandlestickStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").AreaStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").BaselineStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").LineStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").HistogramStyleOptions & import("lightweight-charts").SeriesOptionsCommon> | import("lightweight-charts").DeepPartial<import("lightweight-charts").CustomStyleOptions & import("lightweight-charts").SeriesOptionsCommon>>;
55
57
  vpData: IVolumeProfileData;
56
58
  };
57
59
  paneViews(): VolumeProfilePaneView[];
58
60
  updateAllViews(): void;
61
+ createVolumeProfileFromOHLCV(ohlcvData: OHLCVDataPoint[], config?: VolumeProfileConfig): IVolumeProfileData;
59
62
  }
63
+ type OHLCVDataPoint = {
64
+ time: Time;
65
+ open: number;
66
+ high: number;
67
+ low: number;
68
+ close: number;
69
+ volume: number;
70
+ };
71
+ export type VolumeProfileConfig = {
72
+ priceBins?: number;
73
+ usePercentageBins?: boolean;
74
+ priceStep?: number;
75
+ fromTime?: Time;
76
+ toTime?: Time;
77
+ position?: "left" | "right";
78
+ };
60
79
  export {};
80
+ //# sourceMappingURL=volumeProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"volumeProfile.d.ts","sourceRoot":"","sources":["../../../src/chart/plugins/volumeProfile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,UAAU,EACV,SAAS,EACT,sBAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,MAAM,oBAAoB,CAAC;AAE5B,KAAK,uBAAuB,GAAG;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACd,CA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AM,CAAQ;gBAEtB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,EACvC,WAAW,EAAE,mBAAmB,EAChC,KAAK,EAAE,CAAC,eAAe,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE;IAOhD,UAAU;;;;;IAIV,SAAS;IAGT,cAAc;IAMd,4BAA4B,CAC3B,SAAS,EAAE,cAAc,EAAE,EAC3B,MAAM,GAAE,mBAAwB,GAC9B,kBAAkB;CAmHrB;AAKD,KAAK,cAAc,GAAG;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B,CAAC"}
@@ -14,19 +14,26 @@ class VolumeProfileRenderer {
14
14
  };
15
15
  }
16
16
  draw(target) {
17
- target.useBitmapCoordinateSpace(scope => {
17
+ target.useBitmapCoordinateSpace((scope) => {
18
18
  if (this._data.top === null)
19
19
  return;
20
- this._data.items.forEach(row => {
20
+ this._data.items.forEach((row) => {
21
21
  if (row.y === null)
22
22
  return;
23
- const itemVerticalPos = this.positionsBox(row.y, row.y - this._data.columnHeight, scope.verticalPixelRatio);
24
- scope.context.fillStyle = 'rgba(40, 98, 255, 0.55)';
25
- const itemHorizontalPosP = this.positionsBox(this._data.position === 'left' ? 0 : scope.mediaSize.width, this._data.position === 'left' ? row.widthPositive : (scope.mediaSize.width - row.widthPositive), scope.horizontalPixelRatio);
26
- scope.context.fillRect(itemHorizontalPosP.position, itemVerticalPos.position, itemHorizontalPosP.length, itemVerticalPos.length - 2);
27
- scope.context.fillStyle = 'rgba(251, 191, 44, 0.55)';
28
- const itemHorizontalPosN = this.positionsBox(this._data.position === 'left' ? row.widthPositive : (scope.mediaSize.width - row.widthPositive), this._data.position === 'left' ? (row.widthNegative + row.widthPositive) : (scope.mediaSize.width - (row.widthNegative + row.widthPositive)), scope.horizontalPixelRatio);
29
- scope.context.fillRect(itemHorizontalPosN.position, itemVerticalPos.position, itemHorizontalPosN.length, itemVerticalPos.length - 2);
23
+ const itemVerticalPos = this.positionsBox(row.y, row.y - row.height, // Use individual bar height
24
+ scope.verticalPixelRatio);
25
+ scope.context.fillStyle = "rgba(40, 98, 255, 0.55)";
26
+ const itemHorizontalPosP = this.positionsBox(this._data.position === "left" ? 0 : scope.mediaSize.width, this._data.position === "left"
27
+ ? row.widthPositive
28
+ : scope.mediaSize.width - row.widthPositive, scope.horizontalPixelRatio);
29
+ scope.context.fillRect(itemHorizontalPosP.position, itemVerticalPos.position, itemHorizontalPosP.length, itemVerticalPos.length);
30
+ scope.context.fillStyle = "rgba(251, 191, 44, 0.55)";
31
+ const itemHorizontalPosN = this.positionsBox(this._data.position === "left"
32
+ ? row.widthPositive
33
+ : scope.mediaSize.width - row.widthPositive, this._data.position === "left"
34
+ ? row.widthNegative + row.widthPositive
35
+ : scope.mediaSize.width - (row.widthNegative + row.widthPositive), scope.horizontalPixelRatio);
36
+ scope.context.fillRect(itemHorizontalPosN.position, itemVerticalPos.position, itemHorizontalPosN.length, itemVerticalPos.length);
30
37
  });
31
38
  });
32
39
  }
@@ -35,7 +42,6 @@ exports.VolumeProfileRenderer = VolumeProfileRenderer;
35
42
  class VolumeProfilePaneView {
36
43
  constructor(_source) {
37
44
  this._source = _source;
38
- this._columnHeight = 0;
39
45
  this._items = [];
40
46
  this._top = null;
41
47
  this._widthNegative = 0;
@@ -43,7 +49,6 @@ class VolumeProfilePaneView {
43
49
  }
44
50
  renderer() {
45
51
  return new VolumeProfileRenderer({
46
- columnHeight: this._columnHeight,
47
52
  items: this._items,
48
53
  position: this._source.getContext().vpData.position,
49
54
  top: this._top,
@@ -52,42 +57,175 @@ class VolumeProfilePaneView {
52
57
  });
53
58
  }
54
59
  update() {
55
- var _a, _b;
56
60
  const ctx = this._source.getContext();
57
61
  const data = ctx.vpData;
58
62
  const series = ctx.series;
59
63
  const timeScale = ctx.chart.timeScale();
60
64
  const vr = timeScale.getVisibleRange();
61
- if (!vr || data.fromTime > vr.to) { // hide visible range when context initial time is after chart visible time
65
+ if (!vr || data.fromTime > vr.to) {
66
+ // hide visible range when context initial time is after chart visible time
62
67
  this._items = [];
63
68
  return { widthNegative: 0, widthPositive: 0 };
64
69
  }
65
70
  const _width = timeScale.width() * 0.33;
66
- const y1 = (_a = series.priceToCoordinate(data.profile[0].price)) !== null && _a !== void 0 ? _a : 0;
67
- const y2 = (_b = series.priceToCoordinate(data.profile[1].price)) !== null && _b !== void 0 ? _b : timeScale.height();
68
- this._columnHeight = Math.max(1, y1 - y2);
71
+ // Get all y-coordinates for the price levels
72
+ const yCoordinates = data.profile.map((row) => series.priceToCoordinate(row.price));
73
+ // Calculate the maximum volume for scaling
69
74
  const maxVolume = data.profile.reduce((acc, item) => Math.max(acc, item.positiveVolume + item.negativeVolume), 0);
70
- this._top = y1;
71
- this._items = data.profile.map(row => {
75
+ // Set the top coordinate (highest price)
76
+ this._top = yCoordinates[0];
77
+ // Create items with proper height calculation
78
+ this._items = data.profile.map((row, index) => {
79
+ let height = 1; // Minimum height
80
+ // Calculate height based on the distance to the next price level
81
+ if (index < data.profile.length - 1) {
82
+ const currentY = yCoordinates[index];
83
+ const nextY = yCoordinates[index + 1];
84
+ if (currentY !== null && nextY !== null) {
85
+ // Calculate the gap to the next bar
86
+ height = Math.abs(currentY - nextY);
87
+ // Adjust for the last bar - make it a bit shorter
88
+ if (index === data.profile.length - 2) {
89
+ height = Math.max(1, height * 0.8);
90
+ }
91
+ }
92
+ }
93
+ else {
94
+ // For the last bar, use the same height as the previous bar
95
+ const prevY = yCoordinates[index - 1];
96
+ const currentY = yCoordinates[index];
97
+ if (prevY !== null && currentY !== null) {
98
+ height = Math.max(1, Math.abs(prevY - currentY) * 0.8);
99
+ }
100
+ }
101
+ // Ensure minimum height
102
+ height = Math.max(1, height);
72
103
  return {
73
104
  widthNegative: (_width * row.positiveVolume) / maxVolume,
74
105
  widthPositive: (_width * row.negativeVolume) / maxVolume,
75
- y: series.priceToCoordinate(row.price),
106
+ y: yCoordinates[index],
107
+ height: height, // Add calculated height to each item
76
108
  };
77
109
  });
78
110
  }
79
111
  }
80
112
  exports.VolumeProfilePaneView = VolumeProfilePaneView;
81
113
  class VolumeProfileSeries {
82
- constructor(_chart, _series, _vpData) {
114
+ constructor(_chart, _series, _vpSettings, ohlcv) {
83
115
  this._chart = _chart;
84
116
  this._series = _series;
85
- this._vpData = _vpData;
86
117
  this._vpIndex = null;
118
+ this._vpData = this.createVolumeProfileFromOHLCV(ohlcv, _vpSettings);
119
+ // window.alert(JSON.stringify(this._vpData));
87
120
  this._paneViews = [new VolumeProfilePaneView(this)];
88
121
  }
89
- getContext() { return { chart: this._chart, series: this._series, vpData: this._vpData }; }
90
- paneViews() { return this._paneViews; }
91
- updateAllViews() { this._paneViews.forEach(pw => { pw.update(); }); }
122
+ getContext() {
123
+ // window.alert(JSON.stringify(this._vpData));
124
+ return { chart: this._chart, series: this._series, vpData: this._vpData };
125
+ }
126
+ paneViews() {
127
+ return this._paneViews;
128
+ }
129
+ updateAllViews() {
130
+ this._paneViews.forEach((pw) => {
131
+ pw.update();
132
+ });
133
+ }
134
+ createVolumeProfileFromOHLCV(ohlcvData, config = {}) {
135
+ var _a, _b;
136
+ const { priceBins = 20, usePercentageBins = true, priceStep, fromTime = (_a = ohlcvData[0]) === null || _a === void 0 ? void 0 : _a.time, toTime = (_b = ohlcvData[ohlcvData.length - 1]) === null || _b === void 0 ? void 0 : _b.time, position = "right", } = config;
137
+ // Filter data within the time range
138
+ const filteredData = ohlcvData.filter((point) => {
139
+ const isAfterFrom = !fromTime || point.time >= fromTime;
140
+ const isBeforeTo = !toTime || point.time <= toTime;
141
+ return isAfterFrom && isBeforeTo;
142
+ });
143
+ if (filteredData.length === 0) {
144
+ throw new Error("No data in the specified time range");
145
+ }
146
+ // Find min and max prices in the filtered data
147
+ const minPrice = Math.min(...filteredData.map((d) => d.low));
148
+ const maxPrice = Math.max(...filteredData.map((d) => d.high));
149
+ // Calculate price bins
150
+ let priceLevels;
151
+ if (usePercentageBins) {
152
+ // Create price levels based on percentage distribution
153
+ const priceRange = maxPrice - minPrice;
154
+ priceLevels = Array.from({ length: priceBins + 1 }, (_, i) => {
155
+ return minPrice + (priceRange * i) / priceBins;
156
+ });
157
+ }
158
+ else if (priceStep) {
159
+ // Create price levels with fixed step
160
+ const numBins = Math.ceil((maxPrice - minPrice) / priceStep);
161
+ priceLevels = Array.from({ length: numBins + 1 }, (_, i) => {
162
+ return minPrice + priceStep * i;
163
+ });
164
+ }
165
+ else {
166
+ // Default to percentage bins if no step specified
167
+ const priceRange = maxPrice - minPrice;
168
+ priceLevels = Array.from({ length: priceBins + 1 }, (_, i) => {
169
+ return minPrice + (priceRange * i) / priceBins;
170
+ });
171
+ }
172
+ // Initialize volume profile with zero volumes
173
+ const profile = priceLevels.map((price) => ({
174
+ price,
175
+ positiveVolume: 0,
176
+ negativeVolume: 0,
177
+ }));
178
+ // Distribute volume to price bins
179
+ filteredData.forEach((dataPoint) => {
180
+ const { open, close, volume } = dataPoint;
181
+ const isUpBar = close >= open;
182
+ // Find the appropriate price bin for this data point
183
+ // For simplicity, we can distribute volume to the price level closest to the VWAP
184
+ // or you can distribute based on the high-low range
185
+ // Method 1: Simple - distribute to price levels within high-low range
186
+ const relevantLevels = priceLevels.filter((price) => price >= dataPoint.low && price <= dataPoint.high);
187
+ if (relevantLevels.length > 0) {
188
+ const volumePerLevel = volume / relevantLevels.length;
189
+ relevantLevels.forEach((price) => {
190
+ const index = profile.findIndex((p) => p.price === price);
191
+ if (index !== -1) {
192
+ if (isUpBar) {
193
+ profile[index].positiveVolume += volumePerLevel;
194
+ }
195
+ else {
196
+ profile[index].negativeVolume += volumePerLevel;
197
+ }
198
+ }
199
+ });
200
+ }
201
+ else {
202
+ // Fallback: find the closest price level
203
+ const closestPrice = priceLevels.reduce((prev, curr) => {
204
+ const prevDiff = Math.abs(prev - dataPoint.close);
205
+ const currDiff = Math.abs(curr - dataPoint.close);
206
+ return currDiff < prevDiff ? curr : prev;
207
+ });
208
+ const index = profile.findIndex((p) => p.price === closestPrice);
209
+ if (index !== -1) {
210
+ if (isUpBar) {
211
+ profile[index].positiveVolume += volume;
212
+ }
213
+ else {
214
+ profile[index].negativeVolume += volume;
215
+ }
216
+ }
217
+ }
218
+ });
219
+ // Filter out bins with zero volume (optional)
220
+ const filteredProfile = profile.filter((item) => item.positiveVolume > 0 || item.negativeVolume > 0);
221
+ // Sort by price descending (highest price first)
222
+ filteredProfile.sort((a, b) => b.price - a.price);
223
+ return {
224
+ fromTime: fromTime || filteredData[0].time,
225
+ position,
226
+ profile: filteredProfile,
227
+ };
228
+ }
92
229
  }
93
230
  exports.VolumeProfileSeries = VolumeProfileSeries;
231
+ //# sourceMappingURL=volumeProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"volumeProfile.js","sourceRoot":"","sources":["../../../src/chart/plugins/volumeProfile.ts"],"names":[],"mappings":";;;AAsCA,MAAa,qBAAqB;IACjC,YAAoB,KAAiC;QAAjC,UAAK,GAAL,KAAK,CAA4B;IAAG,CAAC;IAEjD,YAAY,CACnB,cAAsB,EACtB,cAAsB,EACtB,UAAkB;QAElB,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,cAAc,CAAC,CAAC;QAChE,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAA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,IAAI,IAAI,CAAC,cAAc,GAAG,CAAC,CAC5D,CAAC;QAEF,iDAAiD;QACjD,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAElD,OAAO;YACN,QAAQ,EAAE,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI;YAC1C,QAAQ;YACR,OAAO,EAAE,eAAe;SACxB,CAAC;IACH,CAAC;CACD;AAlJD,kDAkJC"}
@@ -0,0 +1,28 @@
1
+ export declare const CDN_VERSIONS: {
2
+ readonly react: "19.2.3";
3
+ readonly reactDom: "19.2.3";
4
+ readonly lightweightCharts: "5.1.0";
5
+ readonly reactJsonTree: "0.20.0";
6
+ readonly recharts: "3.6.0";
7
+ readonly agChartsReact: "13.0.0";
8
+ readonly agGridReact: "35.0.0";
9
+ readonly agGridCommunity: "35.0.0";
10
+ };
11
+ export declare const CDN_PROVIDER = "https://esm.sh";
12
+ /**
13
+ * Constructs a CDN URL for a given package and version
14
+ */
15
+ export declare function getCdnUrl(pkg: string, version: string): string;
16
+ export declare const CDN_URLS: {
17
+ readonly react: string;
18
+ readonly reactDom: `${string}/client`;
19
+ readonly lightweightCharts: string;
20
+ readonly reactJsonTree: string;
21
+ readonly recharts: string;
22
+ readonly agGridReact: string;
23
+ readonly agGridCommunity: string;
24
+ readonly agGridStyles: `${string}/styles/ag-grid.css`;
25
+ readonly agGridThemeAlpine: `${string}/styles/ag-theme-alpine.css`;
26
+ readonly agChartsReact: string;
27
+ };
28
+ //# sourceMappingURL=versions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/config/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC;AAEX,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAE7C;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D;AAWD,eAAO,MAAM,QAAQ;;;;;;;;;;;CAkBX,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDN_URLS = exports.getCdnUrl = exports.CDN_PROVIDER = exports.CDN_VERSIONS = void 0;
4
+ exports.CDN_VERSIONS = {
5
+ react: "19.2.3",
6
+ reactDom: "19.2.3",
7
+ lightweightCharts: "5.1.0",
8
+ reactJsonTree: "0.20.0",
9
+ recharts: "3.6.0",
10
+ agChartsReact: "13.0.0",
11
+ agGridReact: "35.0.0",
12
+ agGridCommunity: "35.0.0",
13
+ };
14
+ exports.CDN_PROVIDER = "https://esm.sh";
15
+ /**
16
+ * Constructs a CDN URL for a given package and version
17
+ */
18
+ function getCdnUrl(pkg, version) {
19
+ return `${exports.CDN_PROVIDER}/${pkg}@${version}`;
20
+ }
21
+ exports.getCdnUrl = getCdnUrl;
22
+ /**
23
+ * Pre-built CDN URLs for all dependencies
24
+ * Use these constants in widget HTML generation
25
+ */
26
+ const agGridCommunity = getCdnUrl("ag-grid-community", exports.CDN_VERSIONS.agGridCommunity);
27
+ exports.CDN_URLS = {
28
+ react: getCdnUrl("react", exports.CDN_VERSIONS.react),
29
+ reactDom: `${getCdnUrl("react-dom", exports.CDN_VERSIONS.reactDom)}/client`,
30
+ lightweightCharts: getCdnUrl("lightweight-charts", exports.CDN_VERSIONS.lightweightCharts),
31
+ reactJsonTree: getCdnUrl("react-json-tree", exports.CDN_VERSIONS.reactJsonTree),
32
+ recharts: getCdnUrl("recharts", exports.CDN_VERSIONS.recharts),
33
+ // AG Grid dependencies
34
+ agGridReact: getCdnUrl("ag-grid-react", exports.CDN_VERSIONS.agGridReact),
35
+ agGridCommunity,
36
+ agGridStyles: `${agGridCommunity}/styles/ag-grid.css`,
37
+ agGridThemeAlpine: `${agGridCommunity}/styles/ag-theme-alpine.css`,
38
+ // AG Charts dependencies
39
+ agChartsReact: getCdnUrl("ag-charts-react", exports.CDN_VERSIONS.agChartsReact),
40
+ };
41
+ //# sourceMappingURL=versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/config/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC3B,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,QAAQ;IAClB,iBAAiB,EAAE,OAAO;IAC1B,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,OAAO;IACjB,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,QAAQ;CAChB,CAAC;AAEE,QAAA,YAAY,GAAG,gBAAgB,CAAC;AAE7C;;GAEG;AACH,SAAgB,SAAS,CAAC,GAAW,EAAE,OAAe;IACrD,OAAO,GAAG,oBAAY,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;AAC5C,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,MAAM,eAAe,GAAG,SAAS,CAChC,mBAAmB,EACnB,oBAAY,CAAC,eAAe,CAC5B,CAAC;AAEW,QAAA,QAAQ,GAAG;IACvB,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,oBAAY,CAAC,KAAK,CAAC;IAC7C,QAAQ,EAAE,GAAG,SAAS,CAAC,WAAW,EAAE,oBAAY,CAAC,QAAQ,CAAC,SAAS;IACnE,iBAAiB,EAAE,SAAS,CAC3B,oBAAoB,EACpB,oBAAY,CAAC,iBAAiB,CAC9B;IACD,aAAa,EAAE,SAAS,CAAC,iBAAiB,EAAE,oBAAY,CAAC,aAAa,CAAC;IACvE,QAAQ,EAAE,SAAS,CAAC,UAAU,EAAE,oBAAY,CAAC,QAAQ,CAAC;IAEtD,uBAAuB;IACvB,WAAW,EAAE,SAAS,CAAC,eAAe,EAAE,oBAAY,CAAC,WAAW,CAAC;IACjE,eAAe;IACf,YAAY,EAAE,GAAG,eAAe,qBAAqB;IACrD,iBAAiB,EAAE,GAAG,eAAe,6BAA6B;IAElE,yBAAyB;IACzB,aAAa,EAAE,SAAS,CAAC,iBAAiB,EAAE,oBAAY,CAAC,aAAa,CAAC;CAC9D,CAAC"}
@@ -1,9 +1,12 @@
1
- declare function gauge(width: number | undefined, props: {
2
- colors?: string[];
3
- legend?: string;
4
- nrOfLevels?: number;
5
- percent: number;
6
- score?: string;
1
+ declare function gauge(params: {
2
+ sections?: {
3
+ value: number;
4
+ fill: string;
5
+ }[];
6
+ value?: number;
7
+ unit?: string;
7
8
  title?: string;
9
+ size?: "S" | "M" | "L";
8
10
  }): void;
9
11
  export { gauge };
12
+ //# sourceMappingURL=gauge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gauge.d.ts","sourceRoot":"","sources":["../../src/gauge/gauge.ts"],"names":[],"mappings":"AAGA,iBAAS,KAAK,CAAC,MAAM,EAAE;IACtB,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CACvB,QAqYA;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}