@trdrs/quickcharts 5.6.1 → 5.7.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +10 -3
  3. package/dist/{ar-BBRV6CC4.js → ar-N6ZTWN65.js} +29 -2
  4. package/dist/ar-N6ZTWN65.js.map +1 -0
  5. package/dist/{assets-B_JlJaHF.d.ts → assets-BFaYQSN_.d.ts} +27 -0
  6. package/dist/{ca_ES-OF2NGA3A.js → ca_ES-VHYHWEYE.js} +29 -2
  7. package/dist/ca_ES-VHYHWEYE.js.map +1 -0
  8. package/dist/{de-D5WWQLT5.js → de-IYDL4R7X.js} +29 -2
  9. package/dist/de-IYDL4R7X.js.map +1 -0
  10. package/dist/drawings.d.ts +2 -2
  11. package/dist/{es-6TM3Z6CQ.js → es-LBKNPA3H.js} +29 -2
  12. package/dist/es-LBKNPA3H.js.map +1 -0
  13. package/dist/feature-manifest.json +21 -2
  14. package/dist/{fr-L5EPUMNA.js → fr-MHNDYCBF.js} +29 -2
  15. package/dist/fr-MHNDYCBF.js.map +1 -0
  16. package/dist/{he_IL-PXH4KNDC.js → he_IL-BMEFQ3ZN.js} +29 -2
  17. package/dist/he_IL-BMEFQ3ZN.js.map +1 -0
  18. package/dist/{id_ID-MMY4EQSL.js → id_ID-TXN53FZX.js} +29 -2
  19. package/dist/id_ID-TXN53FZX.js.map +1 -0
  20. package/dist/index.d.ts +33 -2
  21. package/dist/index.js +399 -46
  22. package/dist/index.js.map +1 -1
  23. package/dist/{it-TUILRXJ5.js → it-OGBC7TOS.js} +29 -2
  24. package/dist/it-OGBC7TOS.js.map +1 -0
  25. package/dist/{ja-7QY2FLXF.js → ja-53733PVE.js} +29 -2
  26. package/dist/ja-53733PVE.js.map +1 -0
  27. package/dist/{ko-RWI5JOO2.js → ko-3VKR42AF.js} +29 -2
  28. package/dist/ko-3VKR42AF.js.map +1 -0
  29. package/dist/{ms_MY-ABJSZCPH.js → ms_MY-MS365YCK.js} +29 -2
  30. package/dist/ms_MY-MS365YCK.js.map +1 -0
  31. package/dist/{pl-XLOQLQVW.js → pl-LW3WQV2B.js} +29 -2
  32. package/dist/pl-LW3WQV2B.js.map +1 -0
  33. package/dist/{pt-TZWQOZ5P.js → pt-ODOVBTAY.js} +29 -2
  34. package/dist/pt-ODOVBTAY.js.map +1 -0
  35. package/dist/quickcharts.css +76 -7
  36. package/dist/{ru-2KVG2H7U.js → ru-IPHJS4OI.js} +29 -2
  37. package/dist/ru-IPHJS4OI.js.map +1 -0
  38. package/dist/{sv-3JTSBHQN.js → sv-EPVCTIWY.js} +29 -2
  39. package/dist/sv-EPVCTIWY.js.map +1 -0
  40. package/dist/{th-O3CHCMEU.js → th-QONC4EYZ.js} +29 -2
  41. package/dist/th-QONC4EYZ.js.map +1 -0
  42. package/dist/{tr-RWKHFLUS.js → tr-JIO34LZJ.js} +29 -2
  43. package/dist/tr-JIO34LZJ.js.map +1 -0
  44. package/dist/{vi-D2CXSN5R.js → vi-6TAWAJKM.js} +29 -2
  45. package/dist/vi-6TAWAJKM.js.map +1 -0
  46. package/dist/{zh-KBHIBNWP.js → zh-2BABI2QN.js} +29 -2
  47. package/dist/zh-2BABI2QN.js.map +1 -0
  48. package/dist/{zh_TW-474AC5C4.js → zh_TW-L2X3VH4E.js} +29 -2
  49. package/dist/zh_TW-L2X3VH4E.js.map +1 -0
  50. package/package.json +2 -2
  51. package/dist/ar-BBRV6CC4.js.map +0 -1
  52. package/dist/ca_ES-OF2NGA3A.js.map +0 -1
  53. package/dist/de-D5WWQLT5.js.map +0 -1
  54. package/dist/es-6TM3Z6CQ.js.map +0 -1
  55. package/dist/fr-L5EPUMNA.js.map +0 -1
  56. package/dist/he_IL-PXH4KNDC.js.map +0 -1
  57. package/dist/id_ID-MMY4EQSL.js.map +0 -1
  58. package/dist/it-TUILRXJ5.js.map +0 -1
  59. package/dist/ja-7QY2FLXF.js.map +0 -1
  60. package/dist/ko-RWI5JOO2.js.map +0 -1
  61. package/dist/ms_MY-ABJSZCPH.js.map +0 -1
  62. package/dist/pl-XLOQLQVW.js.map +0 -1
  63. package/dist/pt-TZWQOZ5P.js.map +0 -1
  64. package/dist/ru-2KVG2H7U.js.map +0 -1
  65. package/dist/sv-3JTSBHQN.js.map +0 -1
  66. package/dist/th-O3CHCMEU.js.map +0 -1
  67. package/dist/tr-RWKHFLUS.js.map +0 -1
  68. package/dist/vi-D2CXSN5R.js.map +0 -1
  69. package/dist/zh-KBHIBNWP.js.map +0 -1
  70. package/dist/zh_TW-474AC5C4.js.map +0 -1
package/dist/index.js CHANGED
@@ -894,7 +894,33 @@ var menu = {
894
894
  "menu.removeIndicators": { one: "Remove {count} indicator", other: "Remove {count} indicators" },
895
895
  "menu.removeDrawings": { one: "Remove {count} drawing", other: "Remove {count} drawings" },
896
896
  "menu.settings": "Settings\u2026",
897
- "menu.drawHorizontalLine": "Draw horizontal line at {price}"
897
+ "menu.drawHorizontalLine": "Draw horizontal line at {price}",
898
+ "menu.resetPriceScale": "Reset price scale",
899
+ "menu.autoFitScale": "Auto (fits data to screen)",
900
+ "menu.scalePriceChartOnly": "Scale price chart only",
901
+ "menu.invertScale": "Invert scale",
902
+ "menu.scaleRegular": "Regular",
903
+ "menu.scalePercent": "Percent",
904
+ "menu.scaleIndexed": "Indexed to 100",
905
+ "menu.scaleLogarithmic": "Logarithmic",
906
+ "menu.moveScaleLeft": "Move scale to left",
907
+ "menu.moveScaleRight": "Move scale to right",
908
+ "menu.scaleLabels": "Labels",
909
+ "menu.scaleLines": "Lines",
910
+ "menu.moreSettings": "More settings\u2026",
911
+ "menu.labelSymbolName": "Symbol name label",
912
+ "menu.labelSymbolValue": "Symbol last price label",
913
+ "menu.labelPreviousClose": "Symbol previous day close price label",
914
+ "menu.labelExtendedHours": "Pre/post/night market price label",
915
+ "menu.labelHighLow": "High and low price labels",
916
+ "menu.labelBidAsk": "Bid and ask labels",
917
+ "menu.labelIndicatorName": "Indicators and financials name labels",
918
+ "menu.labelIndicatorValue": "Indicators and financials value labels",
919
+ "menu.linePrice": "Price line",
920
+ "menu.linePreviousClose": "Previous day close price line",
921
+ "menu.lineExtendedHours": "Pre/post/night market price line",
922
+ "menu.lineHighLow": "High and low price lines",
923
+ "menu.lineBidAsk": "Bid and ask lines"
898
924
  };
899
925
 
900
926
  // src/i18n/en/replay.ts
@@ -1508,6 +1534,7 @@ var chrome = {
1508
1534
  * letter is the button's whole face, so it is the mark the scale wears in the reader's language. */
1509
1535
  "chrome.scaleModes": "Scale modes",
1510
1536
  "chrome.autoScale": "Auto scale",
1537
+ "chrome.scaleMenu": "Scale settings",
1511
1538
  "chrome.autoScaleMark": "A",
1512
1539
  "chrome.logScale": "Logarithmic scale",
1513
1540
  "chrome.logScaleMark": "L",
@@ -1799,26 +1826,26 @@ function readingDirection(i18n) {
1799
1826
  return BUILT_IN_LOCALES.find((l) => l.code === i18n.locale())?.dir ?? "ltr";
1800
1827
  }
1801
1828
  var chartDictionaries = createDictionaryLoader(en, {
1802
- de: () => import("./de-D5WWQLT5.js"),
1803
- fr: () => import("./fr-L5EPUMNA.js"),
1804
- es: () => import("./es-6TM3Z6CQ.js"),
1805
- it: () => import("./it-TUILRXJ5.js"),
1806
- ca_ES: () => import("./ca_ES-OF2NGA3A.js"),
1807
- pl: () => import("./pl-XLOQLQVW.js"),
1808
- sv: () => import("./sv-3JTSBHQN.js"),
1809
- tr: () => import("./tr-RWKHFLUS.js"),
1810
- ru: () => import("./ru-2KVG2H7U.js"),
1811
- pt: () => import("./pt-TZWQOZ5P.js"),
1812
- id_ID: () => import("./id_ID-MMY4EQSL.js"),
1813
- ms_MY: () => import("./ms_MY-ABJSZCPH.js"),
1814
- th: () => import("./th-O3CHCMEU.js"),
1815
- vi: () => import("./vi-D2CXSN5R.js"),
1816
- ja: () => import("./ja-7QY2FLXF.js"),
1817
- ko: () => import("./ko-RWI5JOO2.js"),
1818
- zh: () => import("./zh-KBHIBNWP.js"),
1819
- zh_TW: () => import("./zh_TW-474AC5C4.js"),
1820
- ar: () => import("./ar-BBRV6CC4.js"),
1821
- he_IL: () => import("./he_IL-PXH4KNDC.js")
1829
+ de: () => import("./de-IYDL4R7X.js"),
1830
+ fr: () => import("./fr-MHNDYCBF.js"),
1831
+ es: () => import("./es-LBKNPA3H.js"),
1832
+ it: () => import("./it-OGBC7TOS.js"),
1833
+ ca_ES: () => import("./ca_ES-VHYHWEYE.js"),
1834
+ pl: () => import("./pl-LW3WQV2B.js"),
1835
+ sv: () => import("./sv-EPVCTIWY.js"),
1836
+ tr: () => import("./tr-JIO34LZJ.js"),
1837
+ ru: () => import("./ru-IPHJS4OI.js"),
1838
+ pt: () => import("./pt-ODOVBTAY.js"),
1839
+ id_ID: () => import("./id_ID-TXN53FZX.js"),
1840
+ ms_MY: () => import("./ms_MY-MS365YCK.js"),
1841
+ th: () => import("./th-QONC4EYZ.js"),
1842
+ vi: () => import("./vi-6TAWAJKM.js"),
1843
+ ja: () => import("./ja-53733PVE.js"),
1844
+ ko: () => import("./ko-3VKR42AF.js"),
1845
+ zh: () => import("./zh-2BABI2QN.js"),
1846
+ zh_TW: () => import("./zh_TW-L2X3VH4E.js"),
1847
+ ar: () => import("./ar-N6ZTWN65.js"),
1848
+ he_IL: () => import("./he_IL-BMEFQ3ZN.js")
1822
1849
  });
1823
1850
  var dynamic = (t) => t;
1824
1851
  var source = null;
@@ -5049,6 +5076,8 @@ function chartSettingsDefaults(theme) {
5049
5076
  currencyAndUnit: "hover",
5050
5077
  scaleModeButtons: "hover",
5051
5078
  lockPriceToBarRatio: false,
5079
+ scalePriceChartOnly: false,
5080
+ invertScale: false,
5052
5081
  priceToBarRatio: null,
5053
5082
  placement: "auto"
5054
5083
  },
@@ -10208,6 +10237,11 @@ var ICONS = {
10208
10237
  /** The currency and unit box's caret, on its native 7 by 5 grid: a 1.2 stroke bent down at its
10209
10238
  * middle, drawn at its own size after the box's words. */
10210
10239
  scaleUnitArrow: { viewBox: "0 0 7 5", body: '<path d="M1 1.5l2.5 2 2.5-2" stroke="currentColor" stroke-width="1.2"/>' },
10240
+ /** The price scale's corner button, on its native 15 by 13 grid: the settings nut and its ring in a
10241
+ * line one unit wide. */
10242
+ scaleCorner: { viewBox: "0 0 15 13", body: '<path d="M3.9.5h7.2l3.4 6-3.4 6H3.9L.5 6.5z" fill="none" stroke="currentColor"/><circle cx="7.5" cy="6.5" r="2" fill="none" stroke="currentColor"/>' },
10243
+ /** The arrow at the end of a menu row that opens a flyout, on its native 10 by 16 grid. */
10244
+ menuFlyoutArrow: { viewBox: "0 0 10 16", body: solid("M.6 1.4l1.4-1.4 8 8-8 8-1.4-1.4 6.389-6.532-6.389-6.668z") },
10211
10245
  // Hairline weight: these two sit beside a label rather than alone in a 38px cell. A tray taking an
10212
10246
  // arrow, and two sheets, the back one broken where the front lies over it.
10213
10247
  download: { viewBox: "0 0 28 28", body: solid(bend([[6.5, 17], [6.5, 22.5], [22.5, 22.5], [22.5, 17]], 1) + line2([14.5, 6], [14.5, 18]) + polyline([[10.5, 14.5], [14.5, 18.5], [18.5, 14.5]])) },
@@ -18192,7 +18226,7 @@ var CONTROL_ICONS = byMeaning({
18192
18226
  replay: [ICONS.replay],
18193
18227
  undo: [ICONS.undo],
18194
18228
  redo: [ICONS.redo],
18195
- settings: [ICONS.settings, ICONS.gear, ICONS.legendSettings],
18229
+ settings: [ICONS.settings, ICONS.gear, ICONS.legendSettings, ICONS.scaleCorner],
18196
18230
  fullscreen: [ICONS.fullscreen],
18197
18231
  fullscreenExit: [ICONS.exitFullscreen],
18198
18232
  image: [ICONS.camera],
@@ -18243,7 +18277,7 @@ var CONTROL_ICONS = byMeaning({
18243
18277
  chevronRight: [ICONS.chevronRight],
18244
18278
  // The drawing toolbar's arrow, pointing where the flyout it opens will stand.
18245
18279
  flyout: [ICONS.chevronRight16],
18246
- submenu: [ICONS.submenuArrow],
18280
+ submenu: [ICONS.submenuArrow, ICONS.menuFlyoutArrow],
18247
18281
  more: [ICONS.kebab],
18248
18282
  grip: [ICONS.grip],
18249
18283
  emptySearch: [SEARCH_EMPTY_MARK],
@@ -19461,6 +19495,30 @@ function mountMenu(container, run, strings, icons, shown2 = () => true) {
19461
19495
  let openCtx = null;
19462
19496
  let openExtra = [];
19463
19497
  let openPriceRows = null;
19498
+ let openScaleRows = null;
19499
+ let scaleExpanded = null;
19500
+ let scaleSide = "right";
19501
+ let flyoutRow = null;
19502
+ const flyout = document.createElement("div");
19503
+ flyout.className = "qc-overlay qc-menu qc-price-menu";
19504
+ flyout.addEventListener("contextmenu", (e) => e.preventDefault());
19505
+ for (const type of ["pointerdown", "pointerup", "pointermove"]) flyout.addEventListener(type, (e) => e.stopPropagation());
19506
+ const markFlyout = (row2, open2) => {
19507
+ row2.ariaExpanded = String(open2);
19508
+ row2.dataset.qcFlyout = open2 ? "open" : "shut";
19509
+ };
19510
+ const closeFlyout = () => {
19511
+ flyout.remove();
19512
+ flyout.replaceChildren();
19513
+ if (flyoutRow) markFlyout(flyoutRow, false);
19514
+ flyoutRow = null;
19515
+ };
19516
+ const closeScale = () => {
19517
+ closeFlyout();
19518
+ openScaleRows = null;
19519
+ scaleExpanded?.(false);
19520
+ scaleExpanded = null;
19521
+ };
19464
19522
  const close = () => {
19465
19523
  box2.hidden = true;
19466
19524
  backdrop.hidden = true;
@@ -19469,17 +19527,44 @@ function mountMenu(container, run, strings, icons, shown2 = () => true) {
19469
19527
  openCtx = null;
19470
19528
  openExtra = [];
19471
19529
  openPriceRows = null;
19530
+ closeScale();
19472
19531
  };
19473
19532
  backdrop.addEventListener("pointerdown", close);
19474
19533
  const onKey = (e) => {
19475
- if (e.key === "Escape" && !box2.hidden) close();
19534
+ if (box2.hidden) return;
19535
+ const active = box2.ownerDocument.activeElement;
19536
+ const inFlyout = active instanceof Node && flyout.contains(active);
19537
+ if (e.key === "Escape") {
19538
+ if (!inFlyout) return close();
19539
+ const row2 = flyoutRow;
19540
+ closeFlyout();
19541
+ row2?.focus();
19542
+ return;
19543
+ }
19544
+ if (openScaleRows === null || !(active instanceof HTMLElement)) return;
19545
+ const rows2 = Array.from((inFlyout ? flyout : box2).querySelectorAll(".qc-menu-row:not([disabled])"));
19546
+ const at2 = rows2.indexOf(active);
19547
+ if (at2 < 0) return;
19548
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
19549
+ e.preventDefault();
19550
+ rows2[(at2 + (e.key === "ArrowDown" ? 1 : rows2.length - 1)) % rows2.length]?.focus();
19551
+ } else if (e.key === "ArrowRight" && active.dataset.qcFlyout !== void 0) {
19552
+ e.preventDefault();
19553
+ active.click();
19554
+ } else if (e.key === "ArrowLeft" && inFlyout) {
19555
+ e.preventDefault();
19556
+ const row2 = flyoutRow;
19557
+ closeFlyout();
19558
+ row2?.focus();
19559
+ }
19476
19560
  };
19477
19561
  window.addEventListener("keydown", onKey);
19478
19562
  const view = container.ownerDocument.defaultView ?? window;
19479
19563
  let closing = null;
19480
19564
  const onPressOff = (e) => {
19481
19565
  closing = null;
19482
- if (openPriceRows === null || e.target instanceof Node && box2.contains(e.target)) return;
19566
+ if (openPriceRows === null && openScaleRows === null) return;
19567
+ if (e.target instanceof Node && (box2.contains(e.target) || flyout.contains(e.target))) return;
19483
19568
  close();
19484
19569
  closing = e.pointerId;
19485
19570
  e.preventDefault();
@@ -19506,7 +19591,7 @@ function mountMenu(container, run, strings, icons, shown2 = () => true) {
19506
19591
  sep.className = "qc-separator";
19507
19592
  return sep;
19508
19593
  };
19509
- const rowButton = (row2, act) => {
19594
+ const rowButton = (row2, act, closes2 = true) => {
19510
19595
  const b = document.createElement("button");
19511
19596
  b.type = "button";
19512
19597
  b.className = "qc-menu-row";
@@ -19525,9 +19610,10 @@ function mountMenu(container, run, strings, icons, shown2 = () => true) {
19525
19610
  sc.textContent = row2.shortcut;
19526
19611
  b.append(sc);
19527
19612
  }
19528
- b.addEventListener("click", () => {
19529
- close();
19530
- act();
19613
+ b.disabled = row2.disabled === true;
19614
+ b.addEventListener("click", (event) => {
19615
+ if (closes2) close();
19616
+ act(event);
19531
19617
  });
19532
19618
  return b;
19533
19619
  };
@@ -19562,13 +19648,60 @@ function mountMenu(container, run, strings, icons, shown2 = () => true) {
19562
19648
  for (const row2 of group) box2.append(rowButton(row2, () => row2.run()));
19563
19649
  }
19564
19650
  };
19651
+ const openFlyout = (row2, groups, focus) => {
19652
+ if (flyoutRow !== row2) {
19653
+ closeFlyout();
19654
+ flyoutRow = row2;
19655
+ markFlyout(row2, true);
19656
+ fillScale(flyout, groups);
19657
+ box2.after(flyout);
19658
+ flyout.style.left = "0px";
19659
+ flyout.style.top = "0px";
19660
+ const { width, height } = flyout.getBoundingClientRect();
19661
+ const menuBox = box2.getBoundingClientRect();
19662
+ const before = menuBox.left - width;
19663
+ const after = menuBox.right;
19664
+ const left = scaleSide === "right" ? before >= 0 ? before : after : after + width <= window.innerWidth ? after : before;
19665
+ flyout.style.left = `${Math.max(0, Math.min(left, window.innerWidth - width))}px`;
19666
+ flyout.style.top = `${Math.max(0, Math.min(row2.getBoundingClientRect().top, window.innerHeight - height))}px`;
19667
+ }
19668
+ if (focus) flyout.querySelector(".qc-menu-row:not([disabled])")?.focus();
19669
+ };
19670
+ const fillScale = (into, groups) => {
19671
+ into.replaceChildren();
19672
+ for (const group of groups.filter((rows2) => rows2.length > 0)) {
19673
+ if (into.childElementCount > 0) into.append(separator2());
19674
+ for (const row2 of group) {
19675
+ const held = row2.rows;
19676
+ const button3 = rowButton(row2, (event) => held ? openFlyout(button3, held, event.detail === 0) : row2.run?.(), held === void 0);
19677
+ if (held) {
19678
+ button3.ariaHasPopup = "menu";
19679
+ markFlyout(button3, false);
19680
+ button3.append(icons.glyph(ICONS.menuFlyoutArrow, { size: 10, height: 10, className: "qc-menu-flyout-arrow" }));
19681
+ }
19682
+ if (into === box2) {
19683
+ button3.addEventListener("pointerenter", (event) => {
19684
+ if (event.pointerType === "touch") return;
19685
+ if (held) openFlyout(button3, held, false);
19686
+ else closeFlyout();
19687
+ });
19688
+ }
19689
+ into.append(button3);
19690
+ }
19691
+ }
19692
+ };
19565
19693
  const rebuild = () => {
19566
19694
  if (openCtx) fill(openCtx, openExtra);
19567
19695
  else if (openPriceRows) fillPrice(openPriceRows());
19696
+ else if (openScaleRows) {
19697
+ closeFlyout();
19698
+ fillScale(box2, openScaleRows());
19699
+ }
19568
19700
  };
19569
19701
  const unsubscribe = strings.onChange(rebuild);
19570
19702
  return {
19571
19703
  openPrice(at2, rows2, focus) {
19704
+ closeScale();
19572
19705
  openCtx = null;
19573
19706
  openExtra = [];
19574
19707
  openPriceRows = rows2;
@@ -19589,7 +19722,26 @@ function mountMenu(container, run, strings, icons, shown2 = () => true) {
19589
19722
  box2.style.top = `${top}px`;
19590
19723
  if (focus) box2.querySelector(".qc-menu-row")?.focus();
19591
19724
  },
19725
+ openScale(at2, rows2, focus, expanded) {
19726
+ close();
19727
+ openScaleRows = rows2;
19728
+ scaleExpanded = expanded;
19729
+ scaleSide = at2.side;
19730
+ box2.classList.add("qc-price-menu");
19731
+ fillScale(box2, rows2());
19732
+ box2.hidden = false;
19733
+ box2.style.left = "0px";
19734
+ box2.style.top = "0px";
19735
+ const { width, height } = box2.getBoundingClientRect();
19736
+ const margin = 8;
19737
+ const left = at2.side === "right" ? at2.right - width : at2.left;
19738
+ box2.style.left = `${Math.max(margin, Math.min(left, window.innerWidth - width))}px`;
19739
+ box2.style.top = `${Math.max(margin, at2.top - height)}px`;
19740
+ expanded(true);
19741
+ if (focus) box2.querySelector(".qc-menu-row:not([disabled])")?.focus();
19742
+ },
19592
19743
  open(at2, ctx, extra = []) {
19744
+ closeScale();
19593
19745
  openPriceRows = null;
19594
19746
  box2.classList.remove("qc-price-menu");
19595
19747
  openCtx = ctx;
@@ -19614,6 +19766,7 @@ function mountMenu(container, run, strings, icons, shown2 = () => true) {
19614
19766
  for (const type of AFTER_PRESS) view.removeEventListener(type, onAfterPressOff, capturing);
19615
19767
  backdrop.remove();
19616
19768
  box2.remove();
19769
+ flyout.remove();
19617
19770
  }
19618
19771
  };
19619
19772
  }
@@ -19736,8 +19889,8 @@ function attachMenuPlane(deps) {
19736
19889
  const box2 = deps.gestures.getBoundingClientRect();
19737
19890
  return levelAt(deps.series(), clientY - box2.top - (deps.paneTop?.() ?? 0), deps.minMove());
19738
19891
  };
19739
- const lineShortcut = () => {
19740
- const shortcut = deps.commands.list().find((spec) => spec.id === PLACE_HORIZONTAL_LINE)?.shortcut;
19892
+ const commandShortcut = (command2) => {
19893
+ const shortcut = deps.commands.list().find((spec) => spec.id === command2)?.shortcut;
19741
19894
  const t = deps.i18n.t;
19742
19895
  return shortcut ? printedShortcut(shortcut, { ctrl: t(isApplePlatform() ? "drawing.modifierCommand" : "drawing.modifierControl"), meta: t("drawing.modifierCommand") }) : null;
19743
19896
  };
@@ -19789,7 +19942,7 @@ function attachMenuPlane(deps) {
19789
19942
  const contributed = (deps.extensions()?.menuGroups({ price, priceText, symbol: deps.symbol(), name: deps.symbolName(), timeframe: deps.timeframe(), clientX, clientY }) ?? []).map((rows2) => rows2.filter((row2) => row2.group !== "view")).filter((rows2) => rows2.length > 0);
19790
19943
  const own = [];
19791
19944
  if (deps.commands.available(PLACE_HORIZONTAL_LINE, price) && (deps.shown?.(PLACE_HORIZONTAL_LINE) ?? true)) {
19792
- const shortcut = lineShortcut();
19945
+ const shortcut = commandShortcut(PLACE_HORIZONTAL_LINE);
19793
19946
  own.push({
19794
19947
  label: deps.i18n.t("menu.drawHorizontalLine", { price: priceText }),
19795
19948
  ...shortcut ? { shortcut } : {},
@@ -19817,6 +19970,9 @@ function attachMenuPlane(deps) {
19817
19970
  );
19818
19971
  return true;
19819
19972
  };
19973
+ const raiseScaleMenu = (at2, keyboard, expanded) => {
19974
+ menu2.openScale(at2, () => deps.scaleRows(commandShortcut), keyboard, expanded);
19975
+ };
19820
19976
  const itemsAt = (clientX, clientY, table) => {
19821
19977
  const host2 = deps.extensions();
19822
19978
  if (!host2) return [];
@@ -19828,6 +19984,7 @@ function attachMenuPlane(deps) {
19828
19984
  return {
19829
19985
  raiseAt,
19830
19986
  raisePriceMenu,
19987
+ raiseScaleMenu,
19831
19988
  itemsAt,
19832
19989
  runShortcutAt,
19833
19990
  close: () => menu2.close(),
@@ -20460,6 +20617,22 @@ function mountScaleControls(deps) {
20460
20617
  });
20461
20618
  }
20462
20619
  deps.chrome.appendChild(unit);
20620
+ const scaleDoor = deps.openScaleMenu;
20621
+ const corner = scaleDoor ? h("button", { type: "button", class: "qc-scale-corner", "data-role": "scale-corner", "aria-haspopup": "menu", "aria-expanded": "false" }, deps.icons.glyph(ICONS.scaleCorner, { size: 15, height: 13 })) : null;
20622
+ if (corner && scaleDoor) {
20623
+ stopPointer(corner);
20624
+ corner.addEventListener("mousedown", (event) => event.preventDefault());
20625
+ const expanded = (open2) => corner.setAttribute("aria-expanded", String(open2 === true));
20626
+ corner.addEventListener("click", (event) => {
20627
+ const place = corner.getBoundingClientRect();
20628
+ const keyboard = event.detail === 0;
20629
+ scaleDoor({ left: place.left, top: place.top, right: place.right, bottom: place.bottom, side: deps.box()?.side ?? "right" }, keyboard, (open2) => {
20630
+ expanded(open2);
20631
+ if (!open2 && keyboard) corner.focus();
20632
+ });
20633
+ });
20634
+ deps.chrome.appendChild(corner);
20635
+ }
20463
20636
  const plus = h("button", { type: "button", class: "qc-scale-plus", "data-role": "scale-plus" });
20464
20637
  plus.hidden = true;
20465
20638
  deps.chrome.appendChild(plus);
@@ -20551,8 +20724,20 @@ function mountScaleControls(deps) {
20551
20724
  name(log, t("chrome.logScale"));
20552
20725
  name(plus, t("chrome.priceLevelMenu"));
20553
20726
  if (door) unit.title = t("settings.currencyAndUnit");
20727
+ if (corner) name(corner, t("chrome.scaleMenu"));
20728
+ };
20729
+ const syncCorner = () => {
20730
+ if (!corner) return;
20731
+ const at2 = deps.corner();
20732
+ corner.hidden = at2 === null;
20733
+ if (!at2) return;
20734
+ corner.style.left = `${at2.left}px`;
20735
+ corner.style.top = `${at2.top}px`;
20736
+ corner.style.width = `${at2.width}px`;
20737
+ corner.style.height = `${at2.height}px`;
20554
20738
  };
20555
20739
  const sync = () => {
20740
+ syncCorner();
20556
20741
  const box2 = deps.box();
20557
20742
  const visibility = deps.modeButtons();
20558
20743
  modes.dataset.qcVisibility = visibility;
@@ -20641,6 +20826,7 @@ function mountScaleControls(deps) {
20641
20826
  modes.remove();
20642
20827
  unit.remove();
20643
20828
  plus.remove();
20829
+ corner?.remove();
20644
20830
  }
20645
20831
  };
20646
20832
  }
@@ -20984,7 +21170,7 @@ function registerChartCommands(deps) {
20984
21170
  execute: () => deps.symbolSearchOpen()
20985
21171
  });
20986
21172
  add({ id: "chart.view.reset", scope: "chart", label: "command.viewReset", shortcut: "Alt+KeyR", available: always, execute: () => handle.reset() });
20987
- add({ id: "chart.view.goLive", scope: "chart", label: "command.viewGoLive", shortcut: "Alt+KeyL", available: always, execute: () => handle.goLive() });
21173
+ add({ id: "chart.view.goLive", scope: "chart", label: "command.viewGoLive", shortcut: "Alt+Shift+ArrowRight", available: always, execute: () => handle.goLive() });
20988
21174
  const navigable = () => features.navigation;
20989
21175
  add({ id: "chart.view.zoomIn", scope: "chart", label: "command.viewZoomIn", shortcut: "Equal", available: navigable, execute: () => deps.zoom("in") });
20990
21176
  add({ id: "chart.view.zoomOut", scope: "chart", label: "command.viewZoomOut", shortcut: "Minus", available: navigable, execute: () => deps.zoom("out") });
@@ -21054,6 +21240,21 @@ function registerChartCommands(deps) {
21054
21240
  execute: () => handle.setScaleMode(mode)
21055
21241
  });
21056
21242
  }
21243
+ add({ id: "chart.scale.toggleAuto", scope: "chart", label: "menu.autoFitScale", available: always, execute: () => deps.toggleAutoScale() });
21244
+ add({
21245
+ id: "chart.scale.toggleInvert",
21246
+ scope: "chart",
21247
+ label: "menu.invertScale",
21248
+ shortcut: "Alt+KeyI",
21249
+ available: always,
21250
+ execute: () => handle.applySettings({ priceScale: { invertScale: !handle.settings().priceScale.invertScale } })
21251
+ });
21252
+ for (const [id, mode, label3, shortcut] of [
21253
+ ["chart.scale.togglePercent", "percent", "menu.scalePercent", "Alt+KeyP"],
21254
+ ["chart.scale.toggleLog", "log", "menu.scaleLogarithmic", "Alt+KeyL"]
21255
+ ]) {
21256
+ add({ id, scope: "chart", label: label3, shortcut, available: always, execute: () => handle.setScaleMode(handle.scaleMode() === mode ? "normal" : mode) });
21257
+ }
21057
21258
  add({
21058
21259
  id: "chart.history.undo",
21059
21260
  scope: "chart",
@@ -21544,6 +21745,86 @@ function registerChartCommands(deps) {
21544
21745
  };
21545
21746
  }
21546
21747
 
21748
+ // src/widget/scaleMenu.ts
21749
+ function scaleMenuGroups(deps) {
21750
+ const { t, commands } = deps;
21751
+ const settings2 = deps.settings();
21752
+ const { priceScale: scale, priceLabels: labels } = settings2;
21753
+ const mode = deps.scaleMode();
21754
+ const side = deps.side();
21755
+ const door = (command2, row2, arg) => {
21756
+ if (!deps.shown(command2)) return [];
21757
+ return [{ ...row2, ...deps.permitted(command2) ? {} : { disabled: true }, run: () => void commands.execute(command2, arg) }];
21758
+ };
21759
+ const apply = (row2, next) => door("chart.settings.apply", row2, { settings: next });
21760
+ const hint = (command2) => {
21761
+ const shortcut = deps.shortcut(command2);
21762
+ return shortcut ? { shortcut } : {};
21763
+ };
21764
+ const label3 = (text2, on, next, disabled = false) => apply({ label: text2, checked: on, ...disabled ? { disabled } : {} }, { priceLabels: next(!on) });
21765
+ const modeRow = (id, text2, command2) => door(mode === id ? "chart.scale.normal" : `chart.scale.${id}`, { label: text2, checked: mode === id, ...command2 ? hint(command2) : {} });
21766
+ const flyout = (text2, rows2) => {
21767
+ const held = rows2.filter((group) => group.length > 0);
21768
+ return held.length > 0 ? [{ label: text2, rows: held }] : [];
21769
+ };
21770
+ const ratio = deps.ratio();
21771
+ const extended = deps.extendedHours();
21772
+ const locked = scale.lockPriceToBarRatio;
21773
+ return [
21774
+ door("chart.view.reset", { label: t("menu.resetPriceScale"), icon: "reset", ...hint("chart.view.reset") }),
21775
+ [
21776
+ ...door("chart.scale.toggleAuto", { label: t("menu.autoFitScale"), checked: deps.autoScale() }),
21777
+ ...apply(
21778
+ {
21779
+ label: t("settings.lockPriceToBarRatio"),
21780
+ checked: locked,
21781
+ // A ratio holds only on a regular scale.
21782
+ disabled: mode !== "normal",
21783
+ ...ratio !== null ? { shortcut: ratio.toFixed(4) } : {}
21784
+ },
21785
+ // The lock holds the ratio its row prints.
21786
+ { priceScale: { lockPriceToBarRatio: !locked, ...!locked && ratio !== null ? { priceToBarRatio: ratio } : {} } }
21787
+ ),
21788
+ ...apply({ label: t("menu.scalePriceChartOnly"), checked: scale.scalePriceChartOnly }, { priceScale: { scalePriceChartOnly: !scale.scalePriceChartOnly } }),
21789
+ ...door("chart.scale.toggleInvert", { label: t("menu.invertScale"), checked: scale.invertScale, ...hint("chart.scale.toggleInvert") })
21790
+ ],
21791
+ [
21792
+ ...modeRow("normal", t("menu.scaleRegular")),
21793
+ ...modeRow("percent", t("menu.scalePercent"), "chart.scale.togglePercent"),
21794
+ ...modeRow("indexed", t("menu.scaleIndexed")),
21795
+ ...modeRow("log", t("menu.scaleLogarithmic"), "chart.scale.toggleLog")
21796
+ ],
21797
+ apply({ label: t(side === "right" ? "menu.moveScaleLeft" : "menu.moveScaleRight") }, { priceScale: { placement: side === "right" ? "left" : "right" } }),
21798
+ [
21799
+ ...flyout(t("menu.scaleLabels"), [
21800
+ [
21801
+ ...label3(t("menu.labelSymbolName"), labels.symbolName, (symbolName) => ({ symbolName })),
21802
+ ...label3(t("menu.labelSymbolValue"), labels.symbolValue, (symbolValue) => ({ symbolValue })),
21803
+ ...label3(t("menu.labelPreviousClose"), labels.previousCloseValue, (previousCloseValue) => ({ previousCloseValue })),
21804
+ ...label3(t("menu.labelExtendedHours"), labels.extendedHoursValue, (extendedHoursValue) => ({ extendedHoursValue }), !extended),
21805
+ ...label3(t("menu.labelHighLow"), labels.highLowValue, (highLowValue) => ({ highLowValue })),
21806
+ ...label3(t("menu.labelBidAsk"), labels.bidAskValue, (bidAskValue) => ({ bidAskValue })),
21807
+ ...label3(t("menu.labelIndicatorName"), labels.indicatorLabelName, (indicatorLabelName) => ({ indicatorLabelName })),
21808
+ ...label3(t("menu.labelIndicatorValue"), labels.indicatorLabelValue, (indicatorLabelValue) => ({ indicatorLabelValue })),
21809
+ ...label3(t("settings.countdown"), labels.countdown, (countdown) => ({ countdown }))
21810
+ ],
21811
+ label3(t("settings.noOverlappingLabels"), labels.noOverlappingLabels, (noOverlappingLabels) => ({ noOverlappingLabels }))
21812
+ ]),
21813
+ ...flyout(t("menu.scaleLines"), [
21814
+ [
21815
+ ...label3(t("menu.linePrice"), labels.symbolLine, (symbolLine) => ({ symbolLine })),
21816
+ ...label3(t("menu.linePreviousClose"), labels.previousCloseLine, (previousCloseLine) => ({ previousCloseLine })),
21817
+ ...label3(t("menu.lineExtendedHours"), labels.extendedHoursLine, (extendedHoursLine) => ({ extendedHoursLine }), !extended),
21818
+ ...label3(t("menu.lineHighLow"), labels.highLowLine, (highLowLine) => ({ highLowLine })),
21819
+ ...label3(t("menu.lineBidAsk"), labels.bidAskLine, (bidAskLine) => ({ bidAskLine }))
21820
+ ]
21821
+ ]),
21822
+ ...label3(t("settings.plusButton"), labels.plusButton, (plusButton) => ({ plusButton }))
21823
+ ],
21824
+ deps.settingsDoor ? door("chart.settings.open", { label: t("menu.moreSettings"), icon: "settings" }, { page: "scales" }) : []
21825
+ ].filter((group) => group.length > 0);
21826
+ }
21827
+
21547
21828
  // src/widget/countdown.ts
21548
21829
  function addUtcMonths(epochSecs, count2) {
21549
21830
  const source3 = new Date(epochSecs * 1e3);
@@ -22124,13 +22405,20 @@ function createChartInstance(deps) {
22124
22405
  // A chart that holds its view takes no drag, wheel, pinch or scale gesture from the renderer.
22125
22406
  handleScroll: deps.features.navigation,
22126
22407
  handleScale: deps.features.navigation,
22127
- rightPriceScale: { ...look.rightPriceScale, visible: deps.ui.priceScale && scaleSide === "right" },
22128
- leftPriceScale: { ...look.leftPriceScale, visible: deps.ui.priceScale && scaleSide === "left" },
22408
+ rightPriceScale: { ...look.rightPriceScale, visible: deps.ui.priceScale && scaleSide === "right", invertScale: scaleSide === "right" && eff.priceScale.invertScale },
22409
+ leftPriceScale: { ...look.leftPriceScale, visible: deps.ui.priceScale && scaleSide === "left", invertScale: scaleSide === "left" && eff.priceScale.invertScale },
22129
22410
  // A series added without naming a scale stands on the main series' side.
22130
22411
  defaultVisiblePriceScaleId: scaleSide,
22131
22412
  timeScale: { ...look.timeScale, timeVisible: true, secondsVisible: false, rightOffset: appliedRightOffset, barSpacing: 8, minBarSpacing: 0.5 }
22132
22413
  });
22133
- const mainScale = () => chart.priceScale(scaleSide);
22414
+ const mainScale = () => chart.priceScale(scaleSide, mainPane());
22415
+ const scaleWidth = (side) => {
22416
+ try {
22417
+ return chart.priceScale(side).width();
22418
+ } catch {
22419
+ return 0;
22420
+ }
22421
+ };
22134
22422
  const anchor = chart.addSeries(LineSeries4, {
22135
22423
  visible: false,
22136
22424
  lastValueVisible: false,
@@ -22365,6 +22653,7 @@ function createChartInstance(deps) {
22365
22653
  onChips: () => {
22366
22654
  paneOps.settle();
22367
22655
  syncVolume();
22656
+ syncScaleSources();
22368
22657
  legend2.push();
22369
22658
  paneButtons?.sync();
22370
22659
  },
@@ -22427,6 +22716,7 @@ function createChartInstance(deps) {
22427
22716
  paneOps.settle();
22428
22717
  legend2.push();
22429
22718
  paneButtons?.sync();
22719
+ syncScaleSources();
22430
22720
  },
22431
22721
  onEvent: (entries) => events.emit("compare", entries)
22432
22722
  }) : null;
@@ -22544,7 +22834,7 @@ function createChartInstance(deps) {
22544
22834
  icons: deps.icons,
22545
22835
  gestures,
22546
22836
  overlay: chrome2,
22547
- paneLeft: () => chart.priceScale("left").width(),
22837
+ paneLeft: () => scaleWidth("left"),
22548
22838
  paneTop: mainPaneTop,
22549
22839
  fetchBarMarks: datafeed.marks ? (s, from, to, resolution) => datafeed.marks(s, from, to, resolution) : null,
22550
22840
  fetchTimescaleMarks: datafeed.timescaleMarks ? (s, from, to, resolution) => datafeed.timescaleMarks(s, from, to, resolution) : null,
@@ -22660,6 +22950,13 @@ function createChartInstance(deps) {
22660
22950
  },
22661
22951
  tags: () => ({ high: i18n.t("chrome.scaleHigh"), low: i18n.t("chrome.scaleLow"), bid: i18n.t("chrome.scaleBid"), ask: i18n.t("chrome.scaleAsk") })
22662
22952
  });
22953
+ chart.timeScale().subscribeSizeChange(() => scaleControls?.sync());
22954
+ const heightWatch = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
22955
+ requestAnimationFrame(() => {
22956
+ if (!disposed) scaleControls?.sync();
22957
+ });
22958
+ });
22959
+ heightWatch?.observe(gestures);
22663
22960
  chart.timeScale().subscribeVisibleLogicalRangeChange(() => {
22664
22961
  levels?.refresh();
22665
22962
  paneButtons?.sync();
@@ -22713,6 +23010,20 @@ function createChartInstance(deps) {
22713
23010
  series: () => anchor,
22714
23011
  gestures,
22715
23012
  paneTop: mainPaneTop,
23013
+ scaleRows: (shortcut) => scaleMenuGroups({
23014
+ t: i18n.t,
23015
+ commands: deps.commands,
23016
+ settings: () => eff,
23017
+ scaleMode: () => scaleMode,
23018
+ autoScale: () => priceAxisPolicy() === "auto",
23019
+ side: () => scaleSide,
23020
+ ratio: () => eff.priceScale.lockPriceToBarRatio ? eff.priceScale.priceToBarRatio : liveRatio(),
23021
+ extendedHours: () => session2.extended(),
23022
+ shortcut,
23023
+ shown: (id) => commandShown(deps.access, id),
23024
+ permitted: (id) => commandPermitted(deps.access, id),
23025
+ settingsDoor: deps.ui.settingsMenu
23026
+ }),
22716
23027
  host: deps.layer,
22717
23028
  i18n,
22718
23029
  icons: deps.icons,
@@ -22741,7 +23052,7 @@ function createChartInstance(deps) {
22741
23052
  // scale, so whatever lies outside it is a scale.
22742
23053
  plotArea: () => {
22743
23054
  const box2 = gestures.getBoundingClientRect();
22744
- const left = box2.left + chart.priceScale("left").width();
23055
+ const left = box2.left + scaleWidth("left");
22745
23056
  const time = chart.timeScale();
22746
23057
  return { left, right: left + time.width(), bottom: box2.bottom - time.height() };
22747
23058
  }
@@ -22763,32 +23074,45 @@ function createChartInstance(deps) {
22763
23074
  }) : null;
22764
23075
  const priceScaleBox = () => {
22765
23076
  if (!deps.ui.priceScale) return null;
22766
- const width = mainScale().width();
23077
+ const width = scaleWidth(scaleSide);
22767
23078
  const height = chart.panes()[mainPane()]?.getHeight() ?? 0;
22768
23079
  if (!(width > 0) || !(height > 0)) return null;
22769
23080
  return { left: scaleSide === "left" ? 0 : gestures.clientWidth - width, top: mainPaneTop(), width, height, side: scaleSide };
22770
23081
  };
23082
+ const scaleCornerBox = () => {
23083
+ if (!deps.ui.priceScale) return null;
23084
+ const width = scaleWidth(scaleSide);
23085
+ const height = chart.timeScale().height();
23086
+ if (!(width > 0) || !(height > 0)) return null;
23087
+ const panes = chart.panes();
23088
+ const last = panes.length - 1;
23089
+ const top = paneTopIn(chart, last, gestures) + (panes[last]?.getHeight() ?? 0);
23090
+ return { left: scaleSide === "left" ? 0 : gestures.clientWidth - width, top, width, height };
23091
+ };
23092
+ const toggleAutoScale = () => {
23093
+ applyPriceAxisPolicy(priceAxisPolicy() === "auto" ? "manual" : "auto");
23094
+ history2.changed();
23095
+ };
22771
23096
  scaleControls = deps.ui.priceScale ? mountScaleControls({
22772
23097
  chrome: chrome2,
22773
23098
  gestures,
22774
23099
  i18n,
22775
23100
  icons: deps.icons,
22776
23101
  box: priceScaleBox,
23102
+ corner: scaleCornerBox,
22777
23103
  modeButtons: () => eff.priceScale.scaleModeButtons,
22778
23104
  unitBox: () => eff.priceScale.currencyAndUnit,
22779
23105
  currencyAndUnit: () => symbolInfo ? { currency: symbolInfo.currencyCode, unit: symbolInfo.unitId } : null,
22780
23106
  autoScale: () => priceAxisPolicy() === "auto",
22781
23107
  logScale: () => scaleMode === "log",
22782
- toggleAutoScale: () => {
22783
- applyPriceAxisPolicy(priceAxisPolicy() === "auto" ? "manual" : "auto");
22784
- history2.changed();
22785
- },
23108
+ toggleAutoScale,
22786
23109
  toggleLogScale: () => {
22787
23110
  deps.commands.execute(scaleMode === "log" ? "chart.scale.normal" : "chart.scale.log");
22788
23111
  },
22789
23112
  openPriceMenu: (anchor2, keyboard) => {
22790
23113
  menu2?.raisePriceMenu(anchor2, keyboard);
22791
23114
  },
23115
+ ...menu2 ? { openScaleMenu: (anchor2, keyboard, expanded) => menu2.raiseScaleMenu(anchor2, keyboard, expanded) } : {},
22792
23116
  ...deps.scaleUnitMenu ? { openUnitMenu: (anchor2, keyboard, expanded) => deps.scaleUnitMenu?.({ chart: handle, anchor: anchor2, keyboard, expanded }) } : {}
22793
23117
  }) : null;
22794
23118
  scalePlus = scaleControls && menu2 ? attachScalePlus({
@@ -22820,7 +23144,7 @@ function createChartInstance(deps) {
22820
23144
  maximized: paneOps.maximized(index)
22821
23145
  }));
22822
23146
  },
22823
- insetEnd: () => chart.priceScale("right").width(),
23147
+ insetEnd: () => scaleWidth("right"),
22824
23148
  removable: (index) => {
22825
23149
  const contents = paneContents(index);
22826
23150
  if (contents.indicators.length === 0 && contents.compares.length === 0) return false;
@@ -22986,6 +23310,7 @@ function createChartInstance(deps) {
22986
23310
  const before = {
22987
23311
  locked: eff.priceScale.lockPriceToBarRatio,
22988
23312
  ratio: eff.priceScale.priceToBarRatio,
23313
+ inverted: eff.priceScale.invertScale,
22989
23314
  subsession: activeSubsession(),
22990
23315
  rightOffset: appliedRightOffset,
22991
23316
  indicatorLabels: `${eff.priceLabels.indicatorLabelName}:${eff.priceLabels.indicatorLabelValue}`
@@ -23001,12 +23326,15 @@ function createChartInstance(deps) {
23001
23326
  }
23002
23327
  const c = canvas();
23003
23328
  chart.applyOptions(lookOptions());
23004
- if (scaleSideOf(eff) !== scaleSide) moveScale(scaleSideOf(eff));
23329
+ const moved = scaleSideOf(eff) !== scaleSide;
23330
+ if (moved) moveScale(scaleSideOf(eff));
23331
+ if (moved || eff.priceScale.invertScale !== before.inverted) mainScale().applyOptions({ invertScale: eff.priceScale.invertScale });
23005
23332
  if (eff.canvas.marginRight !== before.rightOffset) {
23006
23333
  appliedRightOffset = eff.canvas.marginRight;
23007
23334
  chart.timeScale().applyOptions({ rightOffset: appliedRightOffset });
23008
23335
  }
23009
23336
  series2.applyOptions(styleOptions(style, paint()));
23337
+ syncScaleSources();
23010
23338
  if (formatKey() !== builtFormatKey) {
23011
23339
  setSymbolFormat(symbolFormat);
23012
23340
  indicators2.recompute();
@@ -23061,6 +23389,24 @@ function createChartInstance(deps) {
23061
23389
  mainScale().setVisibleRange({ from: middle - span / 2, to: middle + span / 2 });
23062
23390
  scaleControls?.sync();
23063
23391
  }
23392
+ function syncScaleSources() {
23393
+ const framing = eff.priceScale.scalePriceChartOnly ? () => null : (own) => own();
23394
+ for (const each of chart.panes()[mainPane()]?.getSeries() ?? []) {
23395
+ const id = each.options().priceScaleId;
23396
+ if (each !== series2 && (id === void 0 || id === scaleSide)) each.applyOptions({ autoscaleInfoProvider: framing });
23397
+ }
23398
+ uprightOtherPanes();
23399
+ }
23400
+ function uprightOtherPanes() {
23401
+ const main = mainPane();
23402
+ chart.panes().forEach((_, pane) => {
23403
+ if (pane === main) return;
23404
+ for (const side of ["left", "right"]) {
23405
+ const scale = chart.priceScale(side, pane);
23406
+ if (scale.options().invertScale) scale.applyOptions({ invertScale: false });
23407
+ }
23408
+ });
23409
+ }
23064
23410
  function pricesChanged() {
23065
23411
  if (disposed) return;
23066
23412
  legend2.push();
@@ -23078,13 +23424,18 @@ function createChartInstance(deps) {
23078
23424
  });
23079
23425
  mainScale().applyOptions({ mode: held.mode });
23080
23426
  if (!held.autoScale) mainScale().applyOptions({ autoScale: false });
23081
- chart.priceScale(previous).applyOptions({ mode: PriceScaleMode2.Normal, autoScale: true });
23427
+ chart.priceScale(previous, mainPane()).applyOptions({ mode: PriceScaleMode2.Normal, autoScale: true, invertScale: false });
23082
23428
  for (const each of chart.panes()[mainPane()]?.getSeries() ?? []) {
23083
23429
  const id = each.options().priceScaleId;
23084
23430
  if (id === void 0 || id === previous) each.applyOptions({ priceScaleId: next });
23085
23431
  }
23086
23432
  compare?.scaleMoved();
23087
23433
  countdown?.restyled();
23434
+ requestAnimationFrame(() => {
23435
+ if (disposed) return;
23436
+ scaleControls?.sync();
23437
+ legend2.push();
23438
+ });
23088
23439
  }
23089
23440
  function resetSettings() {
23090
23441
  if (disposed) return;
@@ -23780,6 +24131,7 @@ function createChartInstance(deps) {
23780
24131
  events.on(lane, () => history2.changed());
23781
24132
  }
23782
24133
  const unregisterCommands = registerChartCommands({
24134
+ toggleAutoScale,
23783
24135
  commands: deps.commands,
23784
24136
  handle,
23785
24137
  styles: deps.styles,
@@ -23930,6 +24282,7 @@ function createChartInstance(deps) {
23930
24282
  unsubscribe?.();
23931
24283
  unsubscribe = null;
23932
24284
  prices.destroy();
24285
+ heightWatch?.disconnect();
23933
24286
  unregisterCommands();
23934
24287
  baselineLevel.destroy();
23935
24288
  nav?.destroy();