@trdrs/quickcharts 5.6.1 → 5.7.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.
- package/CHANGELOG.md +4 -0
- package/README.md +10 -3
- package/dist/{ar-BBRV6CC4.js → ar-N6ZTWN65.js} +29 -2
- package/dist/ar-N6ZTWN65.js.map +1 -0
- package/dist/{assets-B_JlJaHF.d.ts → assets-BFaYQSN_.d.ts} +27 -0
- package/dist/{ca_ES-OF2NGA3A.js → ca_ES-VHYHWEYE.js} +29 -2
- package/dist/ca_ES-VHYHWEYE.js.map +1 -0
- package/dist/{de-D5WWQLT5.js → de-IYDL4R7X.js} +29 -2
- package/dist/de-IYDL4R7X.js.map +1 -0
- package/dist/drawings.d.ts +2 -2
- package/dist/{es-6TM3Z6CQ.js → es-LBKNPA3H.js} +29 -2
- package/dist/es-LBKNPA3H.js.map +1 -0
- package/dist/feature-manifest.json +21 -2
- package/dist/{fr-L5EPUMNA.js → fr-MHNDYCBF.js} +29 -2
- package/dist/fr-MHNDYCBF.js.map +1 -0
- package/dist/{he_IL-PXH4KNDC.js → he_IL-BMEFQ3ZN.js} +29 -2
- package/dist/he_IL-BMEFQ3ZN.js.map +1 -0
- package/dist/{id_ID-MMY4EQSL.js → id_ID-TXN53FZX.js} +29 -2
- package/dist/id_ID-TXN53FZX.js.map +1 -0
- package/dist/index.d.ts +33 -2
- package/dist/index.js +398 -46
- package/dist/index.js.map +1 -1
- package/dist/{it-TUILRXJ5.js → it-OGBC7TOS.js} +29 -2
- package/dist/it-OGBC7TOS.js.map +1 -0
- package/dist/{ja-7QY2FLXF.js → ja-53733PVE.js} +29 -2
- package/dist/ja-53733PVE.js.map +1 -0
- package/dist/{ko-RWI5JOO2.js → ko-3VKR42AF.js} +29 -2
- package/dist/ko-3VKR42AF.js.map +1 -0
- package/dist/{ms_MY-ABJSZCPH.js → ms_MY-MS365YCK.js} +29 -2
- package/dist/ms_MY-MS365YCK.js.map +1 -0
- package/dist/{pl-XLOQLQVW.js → pl-LW3WQV2B.js} +29 -2
- package/dist/pl-LW3WQV2B.js.map +1 -0
- package/dist/{pt-TZWQOZ5P.js → pt-ODOVBTAY.js} +29 -2
- package/dist/pt-ODOVBTAY.js.map +1 -0
- package/dist/quickcharts.css +76 -7
- package/dist/{ru-2KVG2H7U.js → ru-IPHJS4OI.js} +29 -2
- package/dist/ru-IPHJS4OI.js.map +1 -0
- package/dist/{sv-3JTSBHQN.js → sv-EPVCTIWY.js} +29 -2
- package/dist/sv-EPVCTIWY.js.map +1 -0
- package/dist/{th-O3CHCMEU.js → th-QONC4EYZ.js} +29 -2
- package/dist/th-QONC4EYZ.js.map +1 -0
- package/dist/{tr-RWKHFLUS.js → tr-JIO34LZJ.js} +29 -2
- package/dist/tr-JIO34LZJ.js.map +1 -0
- package/dist/{vi-D2CXSN5R.js → vi-6TAWAJKM.js} +29 -2
- package/dist/vi-6TAWAJKM.js.map +1 -0
- package/dist/{zh-KBHIBNWP.js → zh-2BABI2QN.js} +29 -2
- package/dist/zh-2BABI2QN.js.map +1 -0
- package/dist/{zh_TW-474AC5C4.js → zh_TW-L2X3VH4E.js} +29 -2
- package/dist/zh_TW-L2X3VH4E.js.map +1 -0
- package/package.json +2 -2
- package/dist/ar-BBRV6CC4.js.map +0 -1
- package/dist/ca_ES-OF2NGA3A.js.map +0 -1
- package/dist/de-D5WWQLT5.js.map +0 -1
- package/dist/es-6TM3Z6CQ.js.map +0 -1
- package/dist/fr-L5EPUMNA.js.map +0 -1
- package/dist/he_IL-PXH4KNDC.js.map +0 -1
- package/dist/id_ID-MMY4EQSL.js.map +0 -1
- package/dist/it-TUILRXJ5.js.map +0 -1
- package/dist/ja-7QY2FLXF.js.map +0 -1
- package/dist/ko-RWI5JOO2.js.map +0 -1
- package/dist/ms_MY-ABJSZCPH.js.map +0 -1
- package/dist/pl-XLOQLQVW.js.map +0 -1
- package/dist/pt-TZWQOZ5P.js.map +0 -1
- package/dist/ru-2KVG2H7U.js.map +0 -1
- package/dist/sv-3JTSBHQN.js.map +0 -1
- package/dist/th-O3CHCMEU.js.map +0 -1
- package/dist/tr-RWKHFLUS.js.map +0 -1
- package/dist/vi-D2CXSN5R.js.map +0 -1
- package/dist/zh-KBHIBNWP.js.map +0 -1
- 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-
|
|
1803
|
-
fr: () => import("./fr-
|
|
1804
|
-
es: () => import("./es-
|
|
1805
|
-
it: () => import("./it-
|
|
1806
|
-
ca_ES: () => import("./ca_ES-
|
|
1807
|
-
pl: () => import("./pl-
|
|
1808
|
-
sv: () => import("./sv-
|
|
1809
|
-
tr: () => import("./tr-
|
|
1810
|
-
ru: () => import("./ru-
|
|
1811
|
-
pt: () => import("./pt-
|
|
1812
|
-
id_ID: () => import("./id_ID-
|
|
1813
|
-
ms_MY: () => import("./ms_MY-
|
|
1814
|
-
th: () => import("./th-
|
|
1815
|
-
vi: () => import("./vi-
|
|
1816
|
-
ja: () => import("./ja-
|
|
1817
|
-
ko: () => import("./ko-
|
|
1818
|
-
zh: () => import("./zh-
|
|
1819
|
-
zh_TW: () => import("./zh_TW-
|
|
1820
|
-
ar: () => import("./ar-
|
|
1821
|
-
he_IL: () => import("./he_IL-
|
|
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 (
|
|
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
|
|
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.
|
|
19529
|
-
|
|
19530
|
-
|
|
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
|
|
19740
|
-
const shortcut = deps.commands.list().find((spec) => spec.id ===
|
|
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 =
|
|
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,21 @@ 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
|
+
const expanded = (open2) => corner.setAttribute("aria-expanded", String(open2 === true));
|
|
20625
|
+
corner.addEventListener("click", (event) => {
|
|
20626
|
+
const place = corner.getBoundingClientRect();
|
|
20627
|
+
const keyboard = event.detail === 0;
|
|
20628
|
+
scaleDoor({ left: place.left, top: place.top, right: place.right, bottom: place.bottom, side: deps.box()?.side ?? "right" }, keyboard, (open2) => {
|
|
20629
|
+
expanded(open2);
|
|
20630
|
+
if (!open2 && keyboard) corner.focus();
|
|
20631
|
+
});
|
|
20632
|
+
});
|
|
20633
|
+
deps.chrome.appendChild(corner);
|
|
20634
|
+
}
|
|
20463
20635
|
const plus = h("button", { type: "button", class: "qc-scale-plus", "data-role": "scale-plus" });
|
|
20464
20636
|
plus.hidden = true;
|
|
20465
20637
|
deps.chrome.appendChild(plus);
|
|
@@ -20551,8 +20723,20 @@ function mountScaleControls(deps) {
|
|
|
20551
20723
|
name(log, t("chrome.logScale"));
|
|
20552
20724
|
name(plus, t("chrome.priceLevelMenu"));
|
|
20553
20725
|
if (door) unit.title = t("settings.currencyAndUnit");
|
|
20726
|
+
if (corner) name(corner, t("chrome.scaleMenu"));
|
|
20727
|
+
};
|
|
20728
|
+
const syncCorner = () => {
|
|
20729
|
+
if (!corner) return;
|
|
20730
|
+
const at2 = deps.corner();
|
|
20731
|
+
corner.hidden = at2 === null;
|
|
20732
|
+
if (!at2) return;
|
|
20733
|
+
corner.style.left = `${at2.left}px`;
|
|
20734
|
+
corner.style.top = `${at2.top}px`;
|
|
20735
|
+
corner.style.width = `${at2.width}px`;
|
|
20736
|
+
corner.style.height = `${at2.height}px`;
|
|
20554
20737
|
};
|
|
20555
20738
|
const sync = () => {
|
|
20739
|
+
syncCorner();
|
|
20556
20740
|
const box2 = deps.box();
|
|
20557
20741
|
const visibility = deps.modeButtons();
|
|
20558
20742
|
modes.dataset.qcVisibility = visibility;
|
|
@@ -20641,6 +20825,7 @@ function mountScaleControls(deps) {
|
|
|
20641
20825
|
modes.remove();
|
|
20642
20826
|
unit.remove();
|
|
20643
20827
|
plus.remove();
|
|
20828
|
+
corner?.remove();
|
|
20644
20829
|
}
|
|
20645
20830
|
};
|
|
20646
20831
|
}
|
|
@@ -20984,7 +21169,7 @@ function registerChartCommands(deps) {
|
|
|
20984
21169
|
execute: () => deps.symbolSearchOpen()
|
|
20985
21170
|
});
|
|
20986
21171
|
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+
|
|
21172
|
+
add({ id: "chart.view.goLive", scope: "chart", label: "command.viewGoLive", shortcut: "Alt+Shift+ArrowRight", available: always, execute: () => handle.goLive() });
|
|
20988
21173
|
const navigable = () => features.navigation;
|
|
20989
21174
|
add({ id: "chart.view.zoomIn", scope: "chart", label: "command.viewZoomIn", shortcut: "Equal", available: navigable, execute: () => deps.zoom("in") });
|
|
20990
21175
|
add({ id: "chart.view.zoomOut", scope: "chart", label: "command.viewZoomOut", shortcut: "Minus", available: navigable, execute: () => deps.zoom("out") });
|
|
@@ -21054,6 +21239,21 @@ function registerChartCommands(deps) {
|
|
|
21054
21239
|
execute: () => handle.setScaleMode(mode)
|
|
21055
21240
|
});
|
|
21056
21241
|
}
|
|
21242
|
+
add({ id: "chart.scale.toggleAuto", scope: "chart", label: "menu.autoFitScale", available: always, execute: () => deps.toggleAutoScale() });
|
|
21243
|
+
add({
|
|
21244
|
+
id: "chart.scale.toggleInvert",
|
|
21245
|
+
scope: "chart",
|
|
21246
|
+
label: "menu.invertScale",
|
|
21247
|
+
shortcut: "Alt+KeyI",
|
|
21248
|
+
available: always,
|
|
21249
|
+
execute: () => handle.applySettings({ priceScale: { invertScale: !handle.settings().priceScale.invertScale } })
|
|
21250
|
+
});
|
|
21251
|
+
for (const [id, mode, label3, shortcut] of [
|
|
21252
|
+
["chart.scale.togglePercent", "percent", "menu.scalePercent", "Alt+KeyP"],
|
|
21253
|
+
["chart.scale.toggleLog", "log", "menu.scaleLogarithmic", "Alt+KeyL"]
|
|
21254
|
+
]) {
|
|
21255
|
+
add({ id, scope: "chart", label: label3, shortcut, available: always, execute: () => handle.setScaleMode(handle.scaleMode() === mode ? "normal" : mode) });
|
|
21256
|
+
}
|
|
21057
21257
|
add({
|
|
21058
21258
|
id: "chart.history.undo",
|
|
21059
21259
|
scope: "chart",
|
|
@@ -21544,6 +21744,86 @@ function registerChartCommands(deps) {
|
|
|
21544
21744
|
};
|
|
21545
21745
|
}
|
|
21546
21746
|
|
|
21747
|
+
// src/widget/scaleMenu.ts
|
|
21748
|
+
function scaleMenuGroups(deps) {
|
|
21749
|
+
const { t, commands } = deps;
|
|
21750
|
+
const settings2 = deps.settings();
|
|
21751
|
+
const { priceScale: scale, priceLabels: labels } = settings2;
|
|
21752
|
+
const mode = deps.scaleMode();
|
|
21753
|
+
const side = deps.side();
|
|
21754
|
+
const door = (command2, row2, arg) => {
|
|
21755
|
+
if (!deps.shown(command2)) return [];
|
|
21756
|
+
return [{ ...row2, ...deps.permitted(command2) ? {} : { disabled: true }, run: () => void commands.execute(command2, arg) }];
|
|
21757
|
+
};
|
|
21758
|
+
const apply = (row2, next) => door("chart.settings.apply", row2, { settings: next });
|
|
21759
|
+
const hint = (command2) => {
|
|
21760
|
+
const shortcut = deps.shortcut(command2);
|
|
21761
|
+
return shortcut ? { shortcut } : {};
|
|
21762
|
+
};
|
|
21763
|
+
const label3 = (text2, on, next, disabled = false) => apply({ label: text2, checked: on, ...disabled ? { disabled } : {} }, { priceLabels: next(!on) });
|
|
21764
|
+
const modeRow = (id, text2, command2) => door(mode === id ? "chart.scale.normal" : `chart.scale.${id}`, { label: text2, checked: mode === id, ...command2 ? hint(command2) : {} });
|
|
21765
|
+
const flyout = (text2, rows2) => {
|
|
21766
|
+
const held = rows2.filter((group) => group.length > 0);
|
|
21767
|
+
return held.length > 0 ? [{ label: text2, rows: held }] : [];
|
|
21768
|
+
};
|
|
21769
|
+
const ratio = deps.ratio();
|
|
21770
|
+
const extended = deps.extendedHours();
|
|
21771
|
+
const locked = scale.lockPriceToBarRatio;
|
|
21772
|
+
return [
|
|
21773
|
+
door("chart.view.reset", { label: t("menu.resetPriceScale"), icon: "reset", ...hint("chart.view.reset") }),
|
|
21774
|
+
[
|
|
21775
|
+
...door("chart.scale.toggleAuto", { label: t("menu.autoFitScale"), checked: deps.autoScale() }),
|
|
21776
|
+
...apply(
|
|
21777
|
+
{
|
|
21778
|
+
label: t("settings.lockPriceToBarRatio"),
|
|
21779
|
+
checked: locked,
|
|
21780
|
+
// A ratio holds only on a regular scale.
|
|
21781
|
+
disabled: mode !== "normal",
|
|
21782
|
+
...ratio !== null ? { shortcut: ratio.toFixed(4) } : {}
|
|
21783
|
+
},
|
|
21784
|
+
// The lock holds the ratio its row prints.
|
|
21785
|
+
{ priceScale: { lockPriceToBarRatio: !locked, ...!locked && ratio !== null ? { priceToBarRatio: ratio } : {} } }
|
|
21786
|
+
),
|
|
21787
|
+
...apply({ label: t("menu.scalePriceChartOnly"), checked: scale.scalePriceChartOnly }, { priceScale: { scalePriceChartOnly: !scale.scalePriceChartOnly } }),
|
|
21788
|
+
...door("chart.scale.toggleInvert", { label: t("menu.invertScale"), checked: scale.invertScale, ...hint("chart.scale.toggleInvert") })
|
|
21789
|
+
],
|
|
21790
|
+
[
|
|
21791
|
+
...modeRow("normal", t("menu.scaleRegular")),
|
|
21792
|
+
...modeRow("percent", t("menu.scalePercent"), "chart.scale.togglePercent"),
|
|
21793
|
+
...modeRow("indexed", t("menu.scaleIndexed")),
|
|
21794
|
+
...modeRow("log", t("menu.scaleLogarithmic"), "chart.scale.toggleLog")
|
|
21795
|
+
],
|
|
21796
|
+
apply({ label: t(side === "right" ? "menu.moveScaleLeft" : "menu.moveScaleRight") }, { priceScale: { placement: side === "right" ? "left" : "right" } }),
|
|
21797
|
+
[
|
|
21798
|
+
...flyout(t("menu.scaleLabels"), [
|
|
21799
|
+
[
|
|
21800
|
+
...label3(t("menu.labelSymbolName"), labels.symbolName, (symbolName) => ({ symbolName })),
|
|
21801
|
+
...label3(t("menu.labelSymbolValue"), labels.symbolValue, (symbolValue) => ({ symbolValue })),
|
|
21802
|
+
...label3(t("menu.labelPreviousClose"), labels.previousCloseValue, (previousCloseValue) => ({ previousCloseValue })),
|
|
21803
|
+
...label3(t("menu.labelExtendedHours"), labels.extendedHoursValue, (extendedHoursValue) => ({ extendedHoursValue }), !extended),
|
|
21804
|
+
...label3(t("menu.labelHighLow"), labels.highLowValue, (highLowValue) => ({ highLowValue })),
|
|
21805
|
+
...label3(t("menu.labelBidAsk"), labels.bidAskValue, (bidAskValue) => ({ bidAskValue })),
|
|
21806
|
+
...label3(t("menu.labelIndicatorName"), labels.indicatorLabelName, (indicatorLabelName) => ({ indicatorLabelName })),
|
|
21807
|
+
...label3(t("menu.labelIndicatorValue"), labels.indicatorLabelValue, (indicatorLabelValue) => ({ indicatorLabelValue })),
|
|
21808
|
+
...label3(t("settings.countdown"), labels.countdown, (countdown) => ({ countdown }))
|
|
21809
|
+
],
|
|
21810
|
+
label3(t("settings.noOverlappingLabels"), labels.noOverlappingLabels, (noOverlappingLabels) => ({ noOverlappingLabels }))
|
|
21811
|
+
]),
|
|
21812
|
+
...flyout(t("menu.scaleLines"), [
|
|
21813
|
+
[
|
|
21814
|
+
...label3(t("menu.linePrice"), labels.symbolLine, (symbolLine) => ({ symbolLine })),
|
|
21815
|
+
...label3(t("menu.linePreviousClose"), labels.previousCloseLine, (previousCloseLine) => ({ previousCloseLine })),
|
|
21816
|
+
...label3(t("menu.lineExtendedHours"), labels.extendedHoursLine, (extendedHoursLine) => ({ extendedHoursLine }), !extended),
|
|
21817
|
+
...label3(t("menu.lineHighLow"), labels.highLowLine, (highLowLine) => ({ highLowLine })),
|
|
21818
|
+
...label3(t("menu.lineBidAsk"), labels.bidAskLine, (bidAskLine) => ({ bidAskLine }))
|
|
21819
|
+
]
|
|
21820
|
+
]),
|
|
21821
|
+
...label3(t("settings.plusButton"), labels.plusButton, (plusButton) => ({ plusButton }))
|
|
21822
|
+
],
|
|
21823
|
+
deps.settingsDoor ? door("chart.settings.open", { label: t("menu.moreSettings"), icon: "settings" }, { page: "scales" }) : []
|
|
21824
|
+
].filter((group) => group.length > 0);
|
|
21825
|
+
}
|
|
21826
|
+
|
|
21547
21827
|
// src/widget/countdown.ts
|
|
21548
21828
|
function addUtcMonths(epochSecs, count2) {
|
|
21549
21829
|
const source3 = new Date(epochSecs * 1e3);
|
|
@@ -22124,13 +22404,20 @@ function createChartInstance(deps) {
|
|
|
22124
22404
|
// A chart that holds its view takes no drag, wheel, pinch or scale gesture from the renderer.
|
|
22125
22405
|
handleScroll: deps.features.navigation,
|
|
22126
22406
|
handleScale: deps.features.navigation,
|
|
22127
|
-
rightPriceScale: { ...look.rightPriceScale, visible: deps.ui.priceScale && scaleSide === "right" },
|
|
22128
|
-
leftPriceScale: { ...look.leftPriceScale, visible: deps.ui.priceScale && scaleSide === "left" },
|
|
22407
|
+
rightPriceScale: { ...look.rightPriceScale, visible: deps.ui.priceScale && scaleSide === "right", invertScale: scaleSide === "right" && eff.priceScale.invertScale },
|
|
22408
|
+
leftPriceScale: { ...look.leftPriceScale, visible: deps.ui.priceScale && scaleSide === "left", invertScale: scaleSide === "left" && eff.priceScale.invertScale },
|
|
22129
22409
|
// A series added without naming a scale stands on the main series' side.
|
|
22130
22410
|
defaultVisiblePriceScaleId: scaleSide,
|
|
22131
22411
|
timeScale: { ...look.timeScale, timeVisible: true, secondsVisible: false, rightOffset: appliedRightOffset, barSpacing: 8, minBarSpacing: 0.5 }
|
|
22132
22412
|
});
|
|
22133
|
-
const mainScale = () => chart.priceScale(scaleSide);
|
|
22413
|
+
const mainScale = () => chart.priceScale(scaleSide, mainPane());
|
|
22414
|
+
const scaleWidth = (side) => {
|
|
22415
|
+
try {
|
|
22416
|
+
return chart.priceScale(side).width();
|
|
22417
|
+
} catch {
|
|
22418
|
+
return 0;
|
|
22419
|
+
}
|
|
22420
|
+
};
|
|
22134
22421
|
const anchor = chart.addSeries(LineSeries4, {
|
|
22135
22422
|
visible: false,
|
|
22136
22423
|
lastValueVisible: false,
|
|
@@ -22365,6 +22652,7 @@ function createChartInstance(deps) {
|
|
|
22365
22652
|
onChips: () => {
|
|
22366
22653
|
paneOps.settle();
|
|
22367
22654
|
syncVolume();
|
|
22655
|
+
syncScaleSources();
|
|
22368
22656
|
legend2.push();
|
|
22369
22657
|
paneButtons?.sync();
|
|
22370
22658
|
},
|
|
@@ -22427,6 +22715,7 @@ function createChartInstance(deps) {
|
|
|
22427
22715
|
paneOps.settle();
|
|
22428
22716
|
legend2.push();
|
|
22429
22717
|
paneButtons?.sync();
|
|
22718
|
+
syncScaleSources();
|
|
22430
22719
|
},
|
|
22431
22720
|
onEvent: (entries) => events.emit("compare", entries)
|
|
22432
22721
|
}) : null;
|
|
@@ -22544,7 +22833,7 @@ function createChartInstance(deps) {
|
|
|
22544
22833
|
icons: deps.icons,
|
|
22545
22834
|
gestures,
|
|
22546
22835
|
overlay: chrome2,
|
|
22547
|
-
paneLeft: () =>
|
|
22836
|
+
paneLeft: () => scaleWidth("left"),
|
|
22548
22837
|
paneTop: mainPaneTop,
|
|
22549
22838
|
fetchBarMarks: datafeed.marks ? (s, from, to, resolution) => datafeed.marks(s, from, to, resolution) : null,
|
|
22550
22839
|
fetchTimescaleMarks: datafeed.timescaleMarks ? (s, from, to, resolution) => datafeed.timescaleMarks(s, from, to, resolution) : null,
|
|
@@ -22660,6 +22949,13 @@ function createChartInstance(deps) {
|
|
|
22660
22949
|
},
|
|
22661
22950
|
tags: () => ({ high: i18n.t("chrome.scaleHigh"), low: i18n.t("chrome.scaleLow"), bid: i18n.t("chrome.scaleBid"), ask: i18n.t("chrome.scaleAsk") })
|
|
22662
22951
|
});
|
|
22952
|
+
chart.timeScale().subscribeSizeChange(() => scaleControls?.sync());
|
|
22953
|
+
const heightWatch = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
|
|
22954
|
+
requestAnimationFrame(() => {
|
|
22955
|
+
if (!disposed) scaleControls?.sync();
|
|
22956
|
+
});
|
|
22957
|
+
});
|
|
22958
|
+
heightWatch?.observe(gestures);
|
|
22663
22959
|
chart.timeScale().subscribeVisibleLogicalRangeChange(() => {
|
|
22664
22960
|
levels?.refresh();
|
|
22665
22961
|
paneButtons?.sync();
|
|
@@ -22713,6 +23009,20 @@ function createChartInstance(deps) {
|
|
|
22713
23009
|
series: () => anchor,
|
|
22714
23010
|
gestures,
|
|
22715
23011
|
paneTop: mainPaneTop,
|
|
23012
|
+
scaleRows: (shortcut) => scaleMenuGroups({
|
|
23013
|
+
t: i18n.t,
|
|
23014
|
+
commands: deps.commands,
|
|
23015
|
+
settings: () => eff,
|
|
23016
|
+
scaleMode: () => scaleMode,
|
|
23017
|
+
autoScale: () => priceAxisPolicy() === "auto",
|
|
23018
|
+
side: () => scaleSide,
|
|
23019
|
+
ratio: () => eff.priceScale.lockPriceToBarRatio ? eff.priceScale.priceToBarRatio : liveRatio(),
|
|
23020
|
+
extendedHours: () => session2.extended(),
|
|
23021
|
+
shortcut,
|
|
23022
|
+
shown: (id) => commandShown(deps.access, id),
|
|
23023
|
+
permitted: (id) => commandPermitted(deps.access, id),
|
|
23024
|
+
settingsDoor: deps.ui.settingsMenu
|
|
23025
|
+
}),
|
|
22716
23026
|
host: deps.layer,
|
|
22717
23027
|
i18n,
|
|
22718
23028
|
icons: deps.icons,
|
|
@@ -22741,7 +23051,7 @@ function createChartInstance(deps) {
|
|
|
22741
23051
|
// scale, so whatever lies outside it is a scale.
|
|
22742
23052
|
plotArea: () => {
|
|
22743
23053
|
const box2 = gestures.getBoundingClientRect();
|
|
22744
|
-
const left = box2.left +
|
|
23054
|
+
const left = box2.left + scaleWidth("left");
|
|
22745
23055
|
const time = chart.timeScale();
|
|
22746
23056
|
return { left, right: left + time.width(), bottom: box2.bottom - time.height() };
|
|
22747
23057
|
}
|
|
@@ -22763,32 +23073,45 @@ function createChartInstance(deps) {
|
|
|
22763
23073
|
}) : null;
|
|
22764
23074
|
const priceScaleBox = () => {
|
|
22765
23075
|
if (!deps.ui.priceScale) return null;
|
|
22766
|
-
const width =
|
|
23076
|
+
const width = scaleWidth(scaleSide);
|
|
22767
23077
|
const height = chart.panes()[mainPane()]?.getHeight() ?? 0;
|
|
22768
23078
|
if (!(width > 0) || !(height > 0)) return null;
|
|
22769
23079
|
return { left: scaleSide === "left" ? 0 : gestures.clientWidth - width, top: mainPaneTop(), width, height, side: scaleSide };
|
|
22770
23080
|
};
|
|
23081
|
+
const scaleCornerBox = () => {
|
|
23082
|
+
if (!deps.ui.priceScale) return null;
|
|
23083
|
+
const width = scaleWidth(scaleSide);
|
|
23084
|
+
const height = chart.timeScale().height();
|
|
23085
|
+
if (!(width > 0) || !(height > 0)) return null;
|
|
23086
|
+
const panes = chart.panes();
|
|
23087
|
+
const last = panes.length - 1;
|
|
23088
|
+
const top = paneTopIn(chart, last, gestures) + (panes[last]?.getHeight() ?? 0);
|
|
23089
|
+
return { left: scaleSide === "left" ? 0 : gestures.clientWidth - width, top, width, height };
|
|
23090
|
+
};
|
|
23091
|
+
const toggleAutoScale = () => {
|
|
23092
|
+
applyPriceAxisPolicy(priceAxisPolicy() === "auto" ? "manual" : "auto");
|
|
23093
|
+
history2.changed();
|
|
23094
|
+
};
|
|
22771
23095
|
scaleControls = deps.ui.priceScale ? mountScaleControls({
|
|
22772
23096
|
chrome: chrome2,
|
|
22773
23097
|
gestures,
|
|
22774
23098
|
i18n,
|
|
22775
23099
|
icons: deps.icons,
|
|
22776
23100
|
box: priceScaleBox,
|
|
23101
|
+
corner: scaleCornerBox,
|
|
22777
23102
|
modeButtons: () => eff.priceScale.scaleModeButtons,
|
|
22778
23103
|
unitBox: () => eff.priceScale.currencyAndUnit,
|
|
22779
23104
|
currencyAndUnit: () => symbolInfo ? { currency: symbolInfo.currencyCode, unit: symbolInfo.unitId } : null,
|
|
22780
23105
|
autoScale: () => priceAxisPolicy() === "auto",
|
|
22781
23106
|
logScale: () => scaleMode === "log",
|
|
22782
|
-
toggleAutoScale
|
|
22783
|
-
applyPriceAxisPolicy(priceAxisPolicy() === "auto" ? "manual" : "auto");
|
|
22784
|
-
history2.changed();
|
|
22785
|
-
},
|
|
23107
|
+
toggleAutoScale,
|
|
22786
23108
|
toggleLogScale: () => {
|
|
22787
23109
|
deps.commands.execute(scaleMode === "log" ? "chart.scale.normal" : "chart.scale.log");
|
|
22788
23110
|
},
|
|
22789
23111
|
openPriceMenu: (anchor2, keyboard) => {
|
|
22790
23112
|
menu2?.raisePriceMenu(anchor2, keyboard);
|
|
22791
23113
|
},
|
|
23114
|
+
...menu2 ? { openScaleMenu: (anchor2, keyboard, expanded) => menu2.raiseScaleMenu(anchor2, keyboard, expanded) } : {},
|
|
22792
23115
|
...deps.scaleUnitMenu ? { openUnitMenu: (anchor2, keyboard, expanded) => deps.scaleUnitMenu?.({ chart: handle, anchor: anchor2, keyboard, expanded }) } : {}
|
|
22793
23116
|
}) : null;
|
|
22794
23117
|
scalePlus = scaleControls && menu2 ? attachScalePlus({
|
|
@@ -22820,7 +23143,7 @@ function createChartInstance(deps) {
|
|
|
22820
23143
|
maximized: paneOps.maximized(index)
|
|
22821
23144
|
}));
|
|
22822
23145
|
},
|
|
22823
|
-
insetEnd: () =>
|
|
23146
|
+
insetEnd: () => scaleWidth("right"),
|
|
22824
23147
|
removable: (index) => {
|
|
22825
23148
|
const contents = paneContents(index);
|
|
22826
23149
|
if (contents.indicators.length === 0 && contents.compares.length === 0) return false;
|
|
@@ -22986,6 +23309,7 @@ function createChartInstance(deps) {
|
|
|
22986
23309
|
const before = {
|
|
22987
23310
|
locked: eff.priceScale.lockPriceToBarRatio,
|
|
22988
23311
|
ratio: eff.priceScale.priceToBarRatio,
|
|
23312
|
+
inverted: eff.priceScale.invertScale,
|
|
22989
23313
|
subsession: activeSubsession(),
|
|
22990
23314
|
rightOffset: appliedRightOffset,
|
|
22991
23315
|
indicatorLabels: `${eff.priceLabels.indicatorLabelName}:${eff.priceLabels.indicatorLabelValue}`
|
|
@@ -23001,12 +23325,15 @@ function createChartInstance(deps) {
|
|
|
23001
23325
|
}
|
|
23002
23326
|
const c = canvas();
|
|
23003
23327
|
chart.applyOptions(lookOptions());
|
|
23004
|
-
|
|
23328
|
+
const moved = scaleSideOf(eff) !== scaleSide;
|
|
23329
|
+
if (moved) moveScale(scaleSideOf(eff));
|
|
23330
|
+
if (moved || eff.priceScale.invertScale !== before.inverted) mainScale().applyOptions({ invertScale: eff.priceScale.invertScale });
|
|
23005
23331
|
if (eff.canvas.marginRight !== before.rightOffset) {
|
|
23006
23332
|
appliedRightOffset = eff.canvas.marginRight;
|
|
23007
23333
|
chart.timeScale().applyOptions({ rightOffset: appliedRightOffset });
|
|
23008
23334
|
}
|
|
23009
23335
|
series2.applyOptions(styleOptions(style, paint()));
|
|
23336
|
+
syncScaleSources();
|
|
23010
23337
|
if (formatKey() !== builtFormatKey) {
|
|
23011
23338
|
setSymbolFormat(symbolFormat);
|
|
23012
23339
|
indicators2.recompute();
|
|
@@ -23061,6 +23388,24 @@ function createChartInstance(deps) {
|
|
|
23061
23388
|
mainScale().setVisibleRange({ from: middle - span / 2, to: middle + span / 2 });
|
|
23062
23389
|
scaleControls?.sync();
|
|
23063
23390
|
}
|
|
23391
|
+
function syncScaleSources() {
|
|
23392
|
+
const framing = eff.priceScale.scalePriceChartOnly ? () => null : (own) => own();
|
|
23393
|
+
for (const each of chart.panes()[mainPane()]?.getSeries() ?? []) {
|
|
23394
|
+
const id = each.options().priceScaleId;
|
|
23395
|
+
if (each !== series2 && (id === void 0 || id === scaleSide)) each.applyOptions({ autoscaleInfoProvider: framing });
|
|
23396
|
+
}
|
|
23397
|
+
uprightOtherPanes();
|
|
23398
|
+
}
|
|
23399
|
+
function uprightOtherPanes() {
|
|
23400
|
+
const main = mainPane();
|
|
23401
|
+
chart.panes().forEach((_, pane) => {
|
|
23402
|
+
if (pane === main) return;
|
|
23403
|
+
for (const side of ["left", "right"]) {
|
|
23404
|
+
const scale = chart.priceScale(side, pane);
|
|
23405
|
+
if (scale.options().invertScale) scale.applyOptions({ invertScale: false });
|
|
23406
|
+
}
|
|
23407
|
+
});
|
|
23408
|
+
}
|
|
23064
23409
|
function pricesChanged() {
|
|
23065
23410
|
if (disposed) return;
|
|
23066
23411
|
legend2.push();
|
|
@@ -23078,13 +23423,18 @@ function createChartInstance(deps) {
|
|
|
23078
23423
|
});
|
|
23079
23424
|
mainScale().applyOptions({ mode: held.mode });
|
|
23080
23425
|
if (!held.autoScale) mainScale().applyOptions({ autoScale: false });
|
|
23081
|
-
chart.priceScale(previous).applyOptions({ mode: PriceScaleMode2.Normal, autoScale: true });
|
|
23426
|
+
chart.priceScale(previous, mainPane()).applyOptions({ mode: PriceScaleMode2.Normal, autoScale: true, invertScale: false });
|
|
23082
23427
|
for (const each of chart.panes()[mainPane()]?.getSeries() ?? []) {
|
|
23083
23428
|
const id = each.options().priceScaleId;
|
|
23084
23429
|
if (id === void 0 || id === previous) each.applyOptions({ priceScaleId: next });
|
|
23085
23430
|
}
|
|
23086
23431
|
compare?.scaleMoved();
|
|
23087
23432
|
countdown?.restyled();
|
|
23433
|
+
requestAnimationFrame(() => {
|
|
23434
|
+
if (disposed) return;
|
|
23435
|
+
scaleControls?.sync();
|
|
23436
|
+
legend2.push();
|
|
23437
|
+
});
|
|
23088
23438
|
}
|
|
23089
23439
|
function resetSettings() {
|
|
23090
23440
|
if (disposed) return;
|
|
@@ -23780,6 +24130,7 @@ function createChartInstance(deps) {
|
|
|
23780
24130
|
events.on(lane, () => history2.changed());
|
|
23781
24131
|
}
|
|
23782
24132
|
const unregisterCommands = registerChartCommands({
|
|
24133
|
+
toggleAutoScale,
|
|
23783
24134
|
commands: deps.commands,
|
|
23784
24135
|
handle,
|
|
23785
24136
|
styles: deps.styles,
|
|
@@ -23930,6 +24281,7 @@ function createChartInstance(deps) {
|
|
|
23930
24281
|
unsubscribe?.();
|
|
23931
24282
|
unsubscribe = null;
|
|
23932
24283
|
prices.destroy();
|
|
24284
|
+
heightWatch?.disconnect();
|
|
23933
24285
|
unregisterCommands();
|
|
23934
24286
|
baselineLevel.destroy();
|
|
23935
24287
|
nav?.destroy();
|