@petal-nexus/toolkit 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -12
- package/dist/petal-toolkit.cjs10.js +1 -1
- package/dist/petal-toolkit.cjs11.js +1 -1
- package/dist/petal-toolkit.cjs1123.js +1 -1
- package/dist/petal-toolkit.cjs1125.js +1 -1
- package/dist/petal-toolkit.cjs1128.js +1 -1
- package/dist/petal-toolkit.cjs12.js +1 -1
- package/dist/petal-toolkit.cjs13.js +1 -1
- package/dist/petal-toolkit.cjs1320.js +1 -1
- package/dist/petal-toolkit.cjs1320.js.map +1 -1
- package/dist/petal-toolkit.cjs1321.js +1 -1
- package/dist/petal-toolkit.cjs1321.js.map +1 -1
- package/dist/petal-toolkit.cjs1322.js +1 -2
- package/dist/petal-toolkit.cjs1322.js.map +1 -1
- package/dist/petal-toolkit.cjs1325.js +1 -1
- package/dist/petal-toolkit.cjs1327.js +1 -1
- package/dist/petal-toolkit.cjs1328.js +1 -1
- package/dist/petal-toolkit.cjs1329.js +1 -1
- package/dist/petal-toolkit.cjs1329.js.map +1 -1
- package/dist/petal-toolkit.cjs1330.js +1 -1
- package/dist/petal-toolkit.cjs1330.js.map +1 -1
- package/dist/petal-toolkit.cjs1331.js +2 -1
- package/dist/petal-toolkit.cjs1331.js.map +1 -1
- package/dist/petal-toolkit.cjs1332.js +1 -1
- package/dist/petal-toolkit.cjs1332.js.map +1 -1
- package/dist/petal-toolkit.cjs1333.js +1 -1
- package/dist/petal-toolkit.cjs1333.js.map +1 -1
- package/dist/petal-toolkit.cjs1334.js +1 -1
- package/dist/petal-toolkit.cjs1334.js.map +1 -1
- package/dist/petal-toolkit.cjs1335.js +1 -1
- package/dist/petal-toolkit.cjs1346.js +1 -1
- package/dist/petal-toolkit.cjs1347.js +1 -1
- package/dist/petal-toolkit.cjs1348.js +1 -1
- package/dist/petal-toolkit.cjs14.js +1 -1
- package/dist/petal-toolkit.cjs15.js +1 -1
- package/dist/petal-toolkit.cjs18.js +1 -1
- package/dist/petal-toolkit.cjs19.js +1 -1
- package/dist/petal-toolkit.cjs22.js +1 -1
- package/dist/petal-toolkit.cjs24.js +1 -1
- package/dist/petal-toolkit.cjs25.js +1 -1
- package/dist/petal-toolkit.cjs26.js +1 -1
- package/dist/petal-toolkit.cjs27.js +1 -1
- package/dist/petal-toolkit.cjs30.js +1 -1
- package/dist/petal-toolkit.cjs31.js +1 -1
- package/dist/petal-toolkit.cjs32.js +1 -1
- package/dist/petal-toolkit.cjs34.js +1 -1
- package/dist/petal-toolkit.cjs35.js +1 -1
- package/dist/petal-toolkit.cjs36.js +1 -1
- package/dist/petal-toolkit.cjs37.js +1 -1
- package/dist/petal-toolkit.cjs38.js +1 -1
- package/dist/petal-toolkit.cjs4.js +1 -1
- package/dist/petal-toolkit.cjs40.js +1 -1
- package/dist/petal-toolkit.cjs41.js +1 -1
- package/dist/petal-toolkit.cjs42.js +1 -1
- package/dist/petal-toolkit.cjs43.js +1 -1
- package/dist/petal-toolkit.cjs44.js +1 -1
- package/dist/petal-toolkit.cjs45.js +1 -1
- package/dist/petal-toolkit.cjs47.js +1 -1
- package/dist/petal-toolkit.cjs48.js +1 -1
- package/dist/petal-toolkit.cjs5.js +1 -1
- package/dist/petal-toolkit.cjs50.js +1 -1
- package/dist/petal-toolkit.cjs52.js +1 -1
- package/dist/petal-toolkit.cjs6.js +1 -1
- package/dist/petal-toolkit.cjs682.js +1 -1
- package/dist/petal-toolkit.cjs684.js +1 -1
- package/dist/petal-toolkit.cjs7.js +1 -1
- package/dist/petal-toolkit.cjs715.js +1 -1
- package/dist/petal-toolkit.cjs719.js +1 -1
- package/dist/petal-toolkit.cjs721.js +1 -1
- package/dist/petal-toolkit.cjs726.js +1 -1
- package/dist/petal-toolkit.cjs734.js +1 -1
- package/dist/petal-toolkit.cjs752.js +1 -1
- package/dist/petal-toolkit.cjs764.js +1 -1
- package/dist/petal-toolkit.cjs787.js +1 -1
- package/dist/petal-toolkit.cjs8.js +1 -1
- package/dist/petal-toolkit.cjs847.js +1 -1
- package/dist/petal-toolkit.cjs848.js +1 -1
- package/dist/petal-toolkit.cjs850.js +1 -1
- package/dist/petal-toolkit.cjs851.js +1 -1
- package/dist/petal-toolkit.cjs854.js +1 -1
- package/dist/petal-toolkit.cjs859.js +1 -1
- package/dist/petal-toolkit.cjs861.js +1 -1
- package/dist/petal-toolkit.cjs864.js +1 -1
- package/dist/petal-toolkit.cjs866.js +1 -1
- package/dist/petal-toolkit.cjs867.js +1 -1
- package/dist/petal-toolkit.cjs868.js +1 -1
- package/dist/petal-toolkit.cjs870.js +1 -1
- package/dist/petal-toolkit.cjs874.js +1 -1
- package/dist/petal-toolkit.cjs9.js +1 -1
- package/dist/petal-toolkit.es10.js +3 -3
- package/dist/petal-toolkit.es11.js +3 -3
- package/dist/petal-toolkit.es1123.js +1 -1
- package/dist/petal-toolkit.es1125.js +1 -1
- package/dist/petal-toolkit.es1128.js +1 -1
- package/dist/petal-toolkit.es12.js +3 -3
- package/dist/petal-toolkit.es13.js +2 -2
- package/dist/petal-toolkit.es1320.js +2 -34
- package/dist/petal-toolkit.es1320.js.map +1 -1
- package/dist/petal-toolkit.es1321.js +2 -52
- package/dist/petal-toolkit.es1321.js.map +1 -1
- package/dist/petal-toolkit.es1322.js +2 -48
- package/dist/petal-toolkit.es1322.js.map +1 -1
- package/dist/petal-toolkit.es1324.js +2 -2
- package/dist/petal-toolkit.es1325.js +2 -2
- package/dist/petal-toolkit.es1326.js +2 -2
- package/dist/petal-toolkit.es1327.js +2 -2
- package/dist/petal-toolkit.es1328.js +2 -2
- package/dist/petal-toolkit.es1329.js +52 -2
- package/dist/petal-toolkit.es1329.js.map +1 -1
- package/dist/petal-toolkit.es1330.js +95 -2
- package/dist/petal-toolkit.es1330.js.map +1 -1
- package/dist/petal-toolkit.es1331.js +48 -2
- package/dist/petal-toolkit.es1331.js.map +1 -1
- package/dist/petal-toolkit.es1332.js +34 -17
- package/dist/petal-toolkit.es1332.js.map +1 -1
- package/dist/petal-toolkit.es1333.js +2 -95
- package/dist/petal-toolkit.es1333.js.map +1 -1
- package/dist/petal-toolkit.es1334.js +17 -2
- package/dist/petal-toolkit.es1334.js.map +1 -1
- package/dist/petal-toolkit.es1335.js +2 -2
- package/dist/petal-toolkit.es1338.js +2 -2
- package/dist/petal-toolkit.es1339.js +2 -2
- package/dist/petal-toolkit.es1340.js +2 -2
- package/dist/petal-toolkit.es1341.js +2 -2
- package/dist/petal-toolkit.es1343.js +2 -2
- package/dist/petal-toolkit.es1344.js +2 -2
- package/dist/petal-toolkit.es1346.js +2 -2
- package/dist/petal-toolkit.es1347.js +2 -2
- package/dist/petal-toolkit.es1348.js +2 -2
- package/dist/petal-toolkit.es14.js +2 -2
- package/dist/petal-toolkit.es15.js +2 -2
- package/dist/petal-toolkit.es18.js +3 -3
- package/dist/petal-toolkit.es19.js +3 -3
- package/dist/petal-toolkit.es22.js +2 -2
- package/dist/petal-toolkit.es24.js +2 -2
- package/dist/petal-toolkit.es25.js +2 -2
- package/dist/petal-toolkit.es26.js +2 -2
- package/dist/petal-toolkit.es27.js +3 -3
- package/dist/petal-toolkit.es30.js +1 -1
- package/dist/petal-toolkit.es31.js +2 -2
- package/dist/petal-toolkit.es32.js +2 -2
- package/dist/petal-toolkit.es34.js +2 -2
- package/dist/petal-toolkit.es35.js +1 -1
- package/dist/petal-toolkit.es36.js +2 -2
- package/dist/petal-toolkit.es37.js +2 -2
- package/dist/petal-toolkit.es38.js +1 -1
- package/dist/petal-toolkit.es4.js +2 -2
- package/dist/petal-toolkit.es40.js +2 -2
- package/dist/petal-toolkit.es41.js +2 -2
- package/dist/petal-toolkit.es42.js +2 -2
- package/dist/petal-toolkit.es43.js +2 -2
- package/dist/petal-toolkit.es44.js +3 -3
- package/dist/petal-toolkit.es45.js +2 -2
- package/dist/petal-toolkit.es47.js +2 -2
- package/dist/petal-toolkit.es48.js +1 -1
- package/dist/petal-toolkit.es5.js +2 -2
- package/dist/petal-toolkit.es50.js +1 -1
- package/dist/petal-toolkit.es52.js +2 -2
- package/dist/petal-toolkit.es6.js +3 -3
- package/dist/petal-toolkit.es682.js +1 -1
- package/dist/petal-toolkit.es684.js +1 -1
- package/dist/petal-toolkit.es7.js +2 -2
- package/dist/petal-toolkit.es715.js +1 -1
- package/dist/petal-toolkit.es719.js +1 -1
- package/dist/petal-toolkit.es721.js +1 -1
- package/dist/petal-toolkit.es726.js +1 -1
- package/dist/petal-toolkit.es734.js +1 -1
- package/dist/petal-toolkit.es752.js +1 -1
- package/dist/petal-toolkit.es764.js +1 -1
- package/dist/petal-toolkit.es787.js +1 -1
- package/dist/petal-toolkit.es8.js +1 -1
- package/dist/petal-toolkit.es847.js +1 -1
- package/dist/petal-toolkit.es848.js +1 -1
- package/dist/petal-toolkit.es850.js +1 -1
- package/dist/petal-toolkit.es851.js +1 -1
- package/dist/petal-toolkit.es854.js +1 -1
- package/dist/petal-toolkit.es859.js +1 -1
- package/dist/petal-toolkit.es861.js +1 -1
- package/dist/petal-toolkit.es864.js +1 -1
- package/dist/petal-toolkit.es866.js +1 -1
- package/dist/petal-toolkit.es867.js +1 -1
- package/dist/petal-toolkit.es868.js +1 -1
- package/dist/petal-toolkit.es870.js +1 -1
- package/dist/petal-toolkit.es874.js +1 -1
- package/dist/petal-toolkit.es9.js +3 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),y=require("react"),B=require("./petal-toolkit.cjs59.js"),E=require("./petal-toolkit.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),y=require("react"),B=require("./petal-toolkit.cjs59.js"),E=require("./petal-toolkit.cjs1329.js"),p=require("./petal-toolkit.cjs55.js"),C=require("./petal-toolkit.cjs1330.js"),g=require("./petal-toolkit.cjs1331.js"),d=require("./petal-toolkit.cjs58.js");function j(x){switch(x){case"light":return{capexColor:"#3b82f6",depreciationColor:"#f97316",netColor:"#16a34a"};case"navy":return{capexColor:"#60a5fa",depreciationColor:"#fb923c",netColor:"#10b981"};case"dark":default:return{capexColor:"#3B82F6",depreciationColor:"#FFA502",netColor:"#00FFB3"}}}const I=y.memo(function({data:t,width:q="100%",height:D=400,className:v,themePreset:m="dark",theme:V,showLegend:f=!0,showNetInvestment:h=!0,onChartReady:i}){const{containerId:s,containerRef:F,surfaceRef:c,sciChartTheme:b,baseColors:o,containerStyle:k}=E.useFinancialChartSetup({chartName:"capex-depreciation",width:q,height:D,themePreset:m,customTheme:V}),n=j(m);return y.useEffect(()=>{if(!F.current||t.length===0)return;let S=!1;return(async()=>{try{const l=t.map(e=>e.period),u=t.map((e,A)=>A),{sciChartSurface:r,wasmContext:a}=await B.scichartExports.SciChartSurface.create(s,{theme:b});if(S){r.delete();return}c.current=r,r.xAxes.add(p.createCategoryXAxis(a,{labelColor:o.axisLabelColor,labels:l})),r.yAxes.add(p.createNumericYAxis(a,{labelColor:o.axisLabelColor,gridColor:o.gridColor,labelFormatter:p.labelFormatters.currency})),r.renderableSeries.add(C.createBarSeries(a,{xValues:u.map(e=>e-.15),yValues:t.map(e=>e.capex),name:"CapEx",color:n.capexColor,dataPointWidth:.3})),r.renderableSeries.add(C.createBarSeries(a,{xValues:u.map(e=>e+.15),yValues:t.map(e=>e.depreciation),name:"Depreciation",color:n.depreciationColor,dataPointWidth:.3})),h&&r.renderableSeries.add(C.createLineSeries(a,{xValues:u,yValues:t.map(e=>e.netInvestment??e.capex-e.depreciation),name:"Net Investment",color:n.netColor,strokeThickness:2,pointMarker:{size:6}})),g.addStandardModifiers(r,{crosshairColor:o.crosshairColor,valueFormatters:{CapEx:d.tooltipFormatters.currency,Depreciation:d.tooltipFormatters.currency,"Net Investment":d.tooltipFormatters.currency}}),f&&g.addLegendModifier(r),i==null||i(r)}catch(l){console.error("Failed to initialize CapexDepreciationChart:",l)}})(),()=>{S=!0,c.current&&(c.current.delete(),c.current=null)}},[t,s,b,o,n,f,h,i]),M.jsx("div",{ref:F,id:s,className:v,style:k})});exports.CapexDepreciationChart=I;
|
|
2
2
|
//# sourceMappingURL=petal-toolkit.cjs9.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as q } from "react/jsx-runtime";
|
|
2
2
|
import { memo as D, useEffect as V } from "react";
|
|
3
3
|
import { s as B } from "./petal-toolkit.es59.js";
|
|
4
|
-
import { useFinancialChartSetup as E } from "./petal-toolkit.
|
|
4
|
+
import { useFinancialChartSetup as E } from "./petal-toolkit.es1329.js";
|
|
5
5
|
import { createCategoryXAxis as R, createNumericYAxis as w, labelFormatters as I } from "./petal-toolkit.es55.js";
|
|
6
|
-
import { createStackedCollection as L } from "./petal-toolkit.
|
|
7
|
-
import { addStandardModifiers as M, addLegendModifier as N } from "./petal-toolkit.
|
|
6
|
+
import { createStackedCollection as L } from "./petal-toolkit.es1330.js";
|
|
7
|
+
import { addStandardModifiers as M, addLegendModifier as N } from "./petal-toolkit.es1331.js";
|
|
8
8
|
import { tooltipFormatters as c } from "./petal-toolkit.es58.js";
|
|
9
9
|
function j(C) {
|
|
10
10
|
switch (C) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as A } from "react/jsx-runtime";
|
|
2
2
|
import { memo as E, useEffect as L } from "react";
|
|
3
3
|
import { s as k } from "./petal-toolkit.es59.js";
|
|
4
|
-
import { useFinancialChartSetup as v } from "./petal-toolkit.
|
|
4
|
+
import { useFinancialChartSetup as v } from "./petal-toolkit.es1329.js";
|
|
5
5
|
import { createCategoryXAxis as V, createNumericYAxis as w, labelFormatters as I } from "./petal-toolkit.es55.js";
|
|
6
|
-
import { createStackedCollection as M } from "./petal-toolkit.
|
|
7
|
-
import { addStandardModifiers as N, addLegendModifier as P } from "./petal-toolkit.
|
|
6
|
+
import { createStackedCollection as M } from "./petal-toolkit.es1330.js";
|
|
7
|
+
import { addStandardModifiers as N, addLegendModifier as P } from "./petal-toolkit.es1331.js";
|
|
8
8
|
import { tooltipFormatters as b } from "./petal-toolkit.es58.js";
|
|
9
9
|
function j(u) {
|
|
10
10
|
switch (u) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as A } from "react/jsx-runtime";
|
|
2
2
|
import { memo as L, useEffect as N } from "react";
|
|
3
3
|
import { s as B } from "./petal-toolkit.es59.js";
|
|
4
|
-
import { useFinancialChartSetup as V } from "./petal-toolkit.
|
|
4
|
+
import { useFinancialChartSetup as V } from "./petal-toolkit.es1329.js";
|
|
5
5
|
import { createCategoryXAxis as k, createNumericYAxis as E, labelFormatters as M } from "./petal-toolkit.es55.js";
|
|
6
|
-
import { addReferenceLine as O, createLineSeries as b } from "./petal-toolkit.
|
|
7
|
-
import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.
|
|
6
|
+
import { addReferenceLine as O, createLineSeries as b } from "./petal-toolkit.es1330.js";
|
|
7
|
+
import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.es1331.js";
|
|
8
8
|
import { tooltipFormatters as F } from "./petal-toolkit.es58.js";
|
|
9
9
|
function D(C) {
|
|
10
10
|
switch (C) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as B } from "react/jsx-runtime";
|
|
2
2
|
import { memo as E, useEffect as V } from "react";
|
|
3
3
|
import { s } from "./petal-toolkit.es59.js";
|
|
4
|
-
import { useFinancialChartSetup as X } from "./petal-toolkit.
|
|
4
|
+
import { useFinancialChartSetup as X } from "./petal-toolkit.es1329.js";
|
|
5
5
|
import { createCategoryXAxis as G, createNumericYAxis as M } from "./petal-toolkit.es55.js";
|
|
6
|
-
import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.
|
|
6
|
+
import { addStandardModifiers as j, addLegendModifier as z } from "./petal-toolkit.es1331.js";
|
|
7
7
|
import { tooltipFormatters as f } from "./petal-toolkit.es58.js";
|
|
8
8
|
function W(S) {
|
|
9
9
|
switch (S) {
|
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
return typeof e == "number" ? e > 1e12 ? Math.floor(e / 1e3) : e : Math.floor(e.getTime() / 1e3);
|
|
3
|
-
}
|
|
4
|
-
function u(e) {
|
|
5
|
-
return e > 1e12 ? new Date(e) : new Date(e * 1e3);
|
|
6
|
-
}
|
|
7
|
-
function f(e, t) {
|
|
8
|
-
const n = u(e);
|
|
9
|
-
if (t) {
|
|
10
|
-
const [i, o] = t, r = (o - i) / 3600;
|
|
11
|
-
if (r < 1)
|
|
12
|
-
return n.toLocaleTimeString("en-US", {
|
|
13
|
-
hour: "numeric",
|
|
14
|
-
minute: "2-digit",
|
|
15
|
-
second: "2-digit"
|
|
16
|
-
});
|
|
17
|
-
if (r < 24)
|
|
18
|
-
return n.toLocaleTimeString("en-US", {
|
|
19
|
-
hour: "numeric",
|
|
20
|
-
minute: "2-digit"
|
|
21
|
-
});
|
|
22
|
-
if (r < 168)
|
|
23
|
-
return n.toLocaleDateString("en-US", {
|
|
24
|
-
month: "short",
|
|
25
|
-
day: "numeric",
|
|
26
|
-
hour: "numeric",
|
|
27
|
-
minute: "2-digit"
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return n.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
31
|
-
}
|
|
1
|
+
var s = {};
|
|
32
2
|
export {
|
|
33
|
-
|
|
34
|
-
u as fromUnixTimestamp,
|
|
35
|
-
m as toUnixTimestamp
|
|
3
|
+
s as __exports
|
|
36
4
|
};
|
|
37
5
|
//# sourceMappingURL=petal-toolkit.es1320.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"petal-toolkit.es1320.js","sources":[
|
|
1
|
+
{"version":3,"file":"petal-toolkit.es1320.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,55 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { getThemeFromPreset as g } from "./petal-toolkit.es60.js";
|
|
3
|
-
function m(r) {
|
|
4
|
-
switch (r) {
|
|
5
|
-
case "light":
|
|
6
|
-
return {
|
|
7
|
-
gridColor: "rgba(0, 0, 0, 0.08)",
|
|
8
|
-
axisLabelColor: "#6b7280",
|
|
9
|
-
crosshairColor: "#3b82f6"
|
|
10
|
-
};
|
|
11
|
-
case "navy":
|
|
12
|
-
return {
|
|
13
|
-
gridColor: "rgba(255, 255, 255, 0.08)",
|
|
14
|
-
axisLabelColor: "#64748b",
|
|
15
|
-
crosshairColor: "#60a5fa"
|
|
16
|
-
};
|
|
17
|
-
case "dark":
|
|
18
|
-
default:
|
|
19
|
-
return {
|
|
20
|
-
gridColor: "rgba(255, 255, 255, 0.06)",
|
|
21
|
-
axisLabelColor: "#6B7280",
|
|
22
|
-
crosshairColor: "#3B82F6"
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function p(r = "100%", o = 400) {
|
|
27
|
-
return {
|
|
28
|
-
width: typeof r == "number" ? `${r}px` : r,
|
|
29
|
-
height: typeof o == "number" ? `${o}px` : o,
|
|
30
|
-
position: "relative"
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function x({
|
|
34
|
-
chartName: r,
|
|
35
|
-
width: o = "100%",
|
|
36
|
-
height: a = 400,
|
|
37
|
-
themePreset: e = "dark",
|
|
38
|
-
customTheme: n
|
|
39
|
-
}) {
|
|
40
|
-
const s = b(), c = t(null), i = t(null), l = n ?? g(e), u = m(e), f = `${r}-${s}`, C = p(o, a);
|
|
41
|
-
return {
|
|
42
|
-
containerId: f,
|
|
43
|
-
containerRef: c,
|
|
44
|
-
surfaceRef: i,
|
|
45
|
-
sciChartTheme: l,
|
|
46
|
-
baseColors: u,
|
|
47
|
-
containerStyle: C
|
|
48
|
-
};
|
|
49
|
-
}
|
|
1
|
+
var e = {};
|
|
50
2
|
export {
|
|
51
|
-
|
|
52
|
-
p as getContainerStyle,
|
|
53
|
-
x as useFinancialChartSetup
|
|
3
|
+
e as __exports
|
|
54
4
|
};
|
|
55
5
|
//# sourceMappingURL=petal-toolkit.es1321.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"petal-toolkit.es1321.js","sources":[
|
|
1
|
+
{"version":3,"file":"petal-toolkit.es1321.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,51 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { createCursorTooltip as P, TOOLTIP_STYLE as e } from "./petal-toolkit.es54.js";
|
|
3
|
-
function k(i, r) {
|
|
4
|
-
const { crosshairColor: a, showTooltip: s = !0, showAxisLabels: c = !0, valueFormatters: o } = r, g = new t.CursorModifier({
|
|
5
|
-
showTooltip: s,
|
|
6
|
-
showAxisLabels: c,
|
|
7
|
-
crosshairStroke: a,
|
|
8
|
-
tooltipSvgTemplate: P((n) => {
|
|
9
|
-
if (n.length === 0)
|
|
10
|
-
return { width: 0, height: 0, content: "" };
|
|
11
|
-
const w = 180, f = 30, l = 20, $ = f + n.length * l, M = n[0], p = new Date((M.xValue ?? 0) * 1e3).toLocaleDateString("en-US", {
|
|
12
|
-
month: "short",
|
|
13
|
-
day: "numeric",
|
|
14
|
-
year: "numeric"
|
|
15
|
-
}), S = `<text x="12" y="20" font-size="11" font-weight="600" font-family="${e.fontFamily}" fill="${e.textPrimary}">${p}</text>`, L = n.map((d, h) => {
|
|
16
|
-
var y;
|
|
17
|
-
const m = f + h * l + 10, x = d.seriesName || `Series ${h + 1}`, u = o == null ? void 0 : o[x], C = u ? u(d.yValue ?? 0) : `${((y = d.yValue) == null ? void 0 : y.toFixed(2)) ?? "-"}`;
|
|
18
|
-
return `<text x="12" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textSecondary}">${x}:</text>
|
|
19
|
-
<text x="100" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textPrimary}">${C}</text>`;
|
|
20
|
-
}).join(""), T = S + L;
|
|
21
|
-
return { width: w, height: $, content: T };
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
i.chartModifiers.add(
|
|
25
|
-
new t.ZoomPanModifier(),
|
|
26
|
-
new t.MouseWheelZoomModifier(),
|
|
27
|
-
new t.ZoomExtentsModifier(),
|
|
28
|
-
g
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function F(i, r = {}) {
|
|
32
|
-
const {
|
|
33
|
-
placement: a = t.ELegendPlacement.TopRight,
|
|
34
|
-
orientation: s = t.ELegendOrientation.Horizontal,
|
|
35
|
-
showCheckboxes: c = !1,
|
|
36
|
-
showSeriesMarkers: o = !0
|
|
37
|
-
} = r;
|
|
38
|
-
i.chartModifiers.add(
|
|
39
|
-
new t.LegendModifier({
|
|
40
|
-
placement: a,
|
|
41
|
-
orientation: s,
|
|
42
|
-
showCheckboxes: c,
|
|
43
|
-
showSeriesMarkers: o
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
}
|
|
1
|
+
var a = {};
|
|
47
2
|
export {
|
|
48
|
-
|
|
49
|
-
k as addStandardModifiers
|
|
3
|
+
a as __exports
|
|
50
4
|
};
|
|
51
5
|
//# sourceMappingURL=petal-toolkit.es1322.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"petal-toolkit.es1322.js","sources":[
|
|
1
|
+
{"version":3,"file":"petal-toolkit.es1322.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
import { useId as b, useRef as t } from "react";
|
|
2
|
+
import { getThemeFromPreset as g } from "./petal-toolkit.es60.js";
|
|
3
|
+
function m(r) {
|
|
4
|
+
switch (r) {
|
|
5
|
+
case "light":
|
|
6
|
+
return {
|
|
7
|
+
gridColor: "rgba(0, 0, 0, 0.08)",
|
|
8
|
+
axisLabelColor: "#6b7280",
|
|
9
|
+
crosshairColor: "#3b82f6"
|
|
10
|
+
};
|
|
11
|
+
case "navy":
|
|
12
|
+
return {
|
|
13
|
+
gridColor: "rgba(255, 255, 255, 0.08)",
|
|
14
|
+
axisLabelColor: "#64748b",
|
|
15
|
+
crosshairColor: "#60a5fa"
|
|
16
|
+
};
|
|
17
|
+
case "dark":
|
|
18
|
+
default:
|
|
19
|
+
return {
|
|
20
|
+
gridColor: "rgba(255, 255, 255, 0.06)",
|
|
21
|
+
axisLabelColor: "#6B7280",
|
|
22
|
+
crosshairColor: "#3B82F6"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function p(r = "100%", o = 400) {
|
|
27
|
+
return {
|
|
28
|
+
width: typeof r == "number" ? `${r}px` : r,
|
|
29
|
+
height: typeof o == "number" ? `${o}px` : o,
|
|
30
|
+
position: "relative"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function x({
|
|
34
|
+
chartName: r,
|
|
35
|
+
width: o = "100%",
|
|
36
|
+
height: a = 400,
|
|
37
|
+
themePreset: e = "dark",
|
|
38
|
+
customTheme: n
|
|
39
|
+
}) {
|
|
40
|
+
const s = b(), c = t(null), i = t(null), l = n ?? g(e), u = m(e), f = `${r}-${s}`, C = p(o, a);
|
|
41
|
+
return {
|
|
42
|
+
containerId: f,
|
|
43
|
+
containerRef: c,
|
|
44
|
+
surfaceRef: i,
|
|
45
|
+
sciChartTheme: l,
|
|
46
|
+
baseColors: u,
|
|
47
|
+
containerStyle: C
|
|
48
|
+
};
|
|
49
|
+
}
|
|
2
50
|
export {
|
|
3
|
-
|
|
51
|
+
m as getBaseThemeColors,
|
|
52
|
+
p as getContainerStyle,
|
|
53
|
+
x as useFinancialChartSetup
|
|
4
54
|
};
|
|
5
55
|
//# sourceMappingURL=petal-toolkit.es1329.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"petal-toolkit.es1329.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"petal-toolkit.es1329.js","sources":["../src/charts/financials/shared/useFinancialChartSetup.ts"],"sourcesContent":["import { useRef, useId } from 'react';\nimport type { SciChartSurface, IThemeProvider } from 'scichart';\nimport { type SciChartThemePreset, getThemeFromPreset } from '@/scichart/themes';\nimport type { BaseThemeColors, FinancialChartSetup } from './types';\n\n/**\n * Get base theme colors that are shared across all financial charts\n */\nexport function getBaseThemeColors(preset: SciChartThemePreset): BaseThemeColors {\n switch (preset) {\n case 'light':\n return {\n gridColor: 'rgba(0, 0, 0, 0.08)',\n axisLabelColor: '#6b7280',\n crosshairColor: '#3b82f6',\n };\n case 'navy':\n return {\n gridColor: 'rgba(255, 255, 255, 0.08)',\n axisLabelColor: '#64748b',\n crosshairColor: '#60a5fa',\n };\n case 'dark':\n default:\n return {\n gridColor: 'rgba(255, 255, 255, 0.06)',\n axisLabelColor: '#6B7280',\n crosshairColor: '#3B82F6',\n };\n }\n}\n\n/**\n * Calculate container style from width/height props\n */\nexport function getContainerStyle(\n width: string | number = '100%',\n height: string | number = 400\n): React.CSSProperties {\n return {\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n position: 'relative',\n };\n}\n\ninterface UseFinancialChartSetupOptions {\n /** Chart name prefix for container ID (e.g., 'margin-analysis') */\n chartName: string;\n /** Width prop */\n width?: string | number;\n /** Height prop */\n height?: string | number;\n /** Theme preset */\n themePreset?: SciChartThemePreset;\n /** Custom theme (overrides preset) */\n customTheme?: IThemeProvider;\n}\n\n/**\n * Hook that handles common financial chart setup:\n * - Container ref and ID generation\n * - Surface ref for cleanup\n * - Theme resolution\n * - Base theme colors\n * - Container style calculation\n */\nexport function useFinancialChartSetup({\n chartName,\n width = '100%',\n height = 400,\n themePreset = 'dark',\n customTheme,\n}: UseFinancialChartSetupOptions): FinancialChartSetup {\n const chartId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const surfaceRef = useRef<SciChartSurface | null>(null);\n\n const sciChartTheme = customTheme ?? getThemeFromPreset(themePreset);\n const baseColors = getBaseThemeColors(themePreset);\n const containerId = `${chartName}-${chartId}`;\n const containerStyle = getContainerStyle(width, height);\n\n return {\n containerId,\n containerRef,\n surfaceRef,\n sciChartTheme,\n baseColors,\n containerStyle,\n };\n}\n"],"names":["getBaseThemeColors","preset","getContainerStyle","width","height","useFinancialChartSetup","chartName","themePreset","customTheme","chartId","useId","containerRef","useRef","surfaceRef","sciChartTheme","getThemeFromPreset","baseColors","containerId","containerStyle"],"mappings":";;AAQO,SAASA,EAAmBC,GAA8C;AAC/E,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,IAEpB,KAAK;AACH,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,IAEpB,KAAK;AAAA,IACL;AACE,aAAO;AAAA,QACL,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,EAClB;AAEN;AAKO,SAASC,EACdC,IAAyB,QACzBC,IAA0B,KACL;AACrB,SAAO;AAAA,IACL,OAAO,OAAOD,KAAU,WAAW,GAAGA,CAAK,OAAOA;AAAA,IAClD,QAAQ,OAAOC,KAAW,WAAW,GAAGA,CAAM,OAAOA;AAAA,IACrD,UAAU;AAAA,EAAA;AAEd;AAuBO,SAASC,EAAuB;AAAA,EACrC,WAAAC;AAAA,EACA,OAAAH,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,aAAAG,IAAc;AAAA,EACd,aAAAC;AACF,GAAuD;AACrD,QAAMC,IAAUC,EAAA,GACVC,IAAeC,EAAuB,IAAI,GAC1CC,IAAaD,EAA+B,IAAI,GAEhDE,IAAgBN,KAAeO,EAAmBR,CAAW,GAC7DS,IAAahB,EAAmBO,CAAW,GAC3CU,IAAc,GAAGX,CAAS,IAAIG,CAAO,IACrCS,IAAiBhB,EAAkBC,GAAOC,CAAM;AAEtD,SAAO;AAAA,IACL,aAAAa;AAAA,IACA,cAAAN;AAAA,IACA,YAAAE;AAAA,IACA,eAAAC;AAAA,IACA,YAAAE;AAAA,IACA,gBAAAE;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,5 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
import { s as t } from "./petal-toolkit.es59.js";
|
|
2
|
+
function h(e, n) {
|
|
3
|
+
const {
|
|
4
|
+
xValues: i,
|
|
5
|
+
yValues: c,
|
|
6
|
+
name: r,
|
|
7
|
+
color: o,
|
|
8
|
+
strokeThickness: a = 3,
|
|
9
|
+
pointMarker: s = {}
|
|
10
|
+
} = n, {
|
|
11
|
+
size: l = 8,
|
|
12
|
+
strokeColor: d = "#FFFFFF",
|
|
13
|
+
strokeThickness: k = 2
|
|
14
|
+
} = s, u = new t.XyDataSeries(e, {
|
|
15
|
+
xValues: i,
|
|
16
|
+
yValues: c,
|
|
17
|
+
dataSeriesName: r
|
|
18
|
+
});
|
|
19
|
+
return new t.FastLineRenderableSeries(e, {
|
|
20
|
+
dataSeries: u,
|
|
21
|
+
stroke: o,
|
|
22
|
+
strokeThickness: a,
|
|
23
|
+
pointMarker: new t.EllipsePointMarker(e, {
|
|
24
|
+
width: l,
|
|
25
|
+
height: l,
|
|
26
|
+
fill: o,
|
|
27
|
+
stroke: d,
|
|
28
|
+
strokeThickness: k
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function y(e, n) {
|
|
33
|
+
const {
|
|
34
|
+
xValues: i,
|
|
35
|
+
yValues: c,
|
|
36
|
+
name: r,
|
|
37
|
+
color: o,
|
|
38
|
+
dataPointWidth: a = 0.6,
|
|
39
|
+
opacity: s = 0.8
|
|
40
|
+
} = n, l = Math.round(s * 255).toString(16).padStart(2, "0").toUpperCase(), d = new t.XyDataSeries(e, {
|
|
41
|
+
xValues: i,
|
|
42
|
+
yValues: c,
|
|
43
|
+
dataSeriesName: r
|
|
44
|
+
});
|
|
45
|
+
return new t.FastColumnRenderableSeries(e, {
|
|
46
|
+
dataSeries: d,
|
|
47
|
+
fill: o + l,
|
|
48
|
+
stroke: o,
|
|
49
|
+
strokeThickness: 0,
|
|
50
|
+
dataPointWidth: a
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function p(e, n) {
|
|
54
|
+
const { xValues: i, series: c, groupId: r, dataPointWidth: o = 0.6 } = n, a = new t.StackedColumnCollection(e);
|
|
55
|
+
a.dataPointWidth = o;
|
|
56
|
+
for (const s of c) {
|
|
57
|
+
const l = new t.XyDataSeries(e, {
|
|
58
|
+
xValues: i,
|
|
59
|
+
yValues: s.yValues,
|
|
60
|
+
dataSeriesName: s.name
|
|
61
|
+
}), d = new t.StackedColumnRenderableSeries(e, {
|
|
62
|
+
dataSeries: l,
|
|
63
|
+
fill: s.color,
|
|
64
|
+
stroke: s.color,
|
|
65
|
+
strokeThickness: 0,
|
|
66
|
+
stackedGroupId: r
|
|
67
|
+
});
|
|
68
|
+
a.add(d);
|
|
69
|
+
}
|
|
70
|
+
return a;
|
|
71
|
+
}
|
|
72
|
+
function f(e, n) {
|
|
73
|
+
const {
|
|
74
|
+
y: i,
|
|
75
|
+
color: c,
|
|
76
|
+
label: r,
|
|
77
|
+
strokeThickness: o = 1,
|
|
78
|
+
dashed: a = !0
|
|
79
|
+
} = n;
|
|
80
|
+
e.annotations.add(
|
|
81
|
+
new t.HorizontalLineAnnotation({
|
|
82
|
+
y1: i,
|
|
83
|
+
stroke: c,
|
|
84
|
+
strokeThickness: o,
|
|
85
|
+
strokeDashArray: a ? [5, 5] : void 0,
|
|
86
|
+
annotationLayer: t.EAnnotationLayer.BelowChart,
|
|
87
|
+
showLabel: !!r,
|
|
88
|
+
labelValue: r
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}
|
|
2
92
|
export {
|
|
3
|
-
|
|
93
|
+
f as addReferenceLine,
|
|
94
|
+
y as createBarSeries,
|
|
95
|
+
h as createLineSeries,
|
|
96
|
+
p as createStackedCollection
|
|
4
97
|
};
|
|
5
98
|
//# sourceMappingURL=petal-toolkit.es1330.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"petal-toolkit.es1330.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"petal-toolkit.es1330.js","sources":["../src/charts/financials/shared/seriesFactory.ts"],"sourcesContent":["/**\n * Series Factory Functions\n *\n * Reusable factory functions for creating common SciChart series types.\n * These reduce boilerplate in financial chart components.\n */\n\nimport {\n XyDataSeries,\n FastLineRenderableSeries,\n FastColumnRenderableSeries,\n StackedColumnRenderableSeries,\n StackedColumnCollection,\n EllipsePointMarker,\n HorizontalLineAnnotation,\n EAnnotationLayer,\n type TSciChart,\n type SciChartSurface,\n} from 'scichart';\n\n/** Options for creating a line series */\nexport interface LineSeriesOptions {\n xValues: number[];\n yValues: number[];\n name: string;\n color: string;\n strokeThickness?: number;\n pointMarker?: {\n size?: number;\n strokeColor?: string;\n strokeThickness?: number;\n };\n}\n\n/** Options for creating a bar/column series */\nexport interface BarSeriesOptions {\n xValues: number[];\n yValues: number[];\n name: string;\n color: string;\n dataPointWidth?: number;\n opacity?: number; // 0-1, will be converted to hex\n}\n\n/** Options for creating a stacked series within a collection */\nexport interface StackedSeriesConfig {\n yValues: number[];\n name: string;\n color: string;\n}\n\n/** Options for creating a stacked column collection */\nexport interface StackedCollectionOptions {\n xValues: number[];\n series: StackedSeriesConfig[];\n groupId: string;\n dataPointWidth?: number;\n}\n\n/** Options for creating a horizontal reference line */\nexport interface ReferenceLineOptions {\n y: number;\n color: string;\n label?: string;\n strokeThickness?: number;\n dashed?: boolean;\n}\n\n/**\n * Create a line series with point markers\n */\nexport function createLineSeries(\n wasmContext: TSciChart,\n options: LineSeriesOptions\n): FastLineRenderableSeries {\n const {\n xValues,\n yValues,\n name,\n color,\n strokeThickness = 3,\n pointMarker = {},\n } = options;\n\n const {\n size = 8,\n strokeColor = '#FFFFFF',\n strokeThickness: markerStrokeThickness = 2,\n } = pointMarker;\n\n const dataSeries = new XyDataSeries(wasmContext, {\n xValues,\n yValues,\n dataSeriesName: name,\n });\n\n return new FastLineRenderableSeries(wasmContext, {\n dataSeries,\n stroke: color,\n strokeThickness,\n pointMarker: new EllipsePointMarker(wasmContext, {\n width: size,\n height: size,\n fill: color,\n stroke: strokeColor,\n strokeThickness: markerStrokeThickness,\n }),\n });\n}\n\n/**\n * Create a column/bar series\n */\nexport function createBarSeries(\n wasmContext: TSciChart,\n options: BarSeriesOptions\n): FastColumnRenderableSeries {\n const {\n xValues,\n yValues,\n name,\n color,\n dataPointWidth = 0.6,\n opacity = 0.8,\n } = options;\n\n // Convert opacity to hex (0.8 -> CC)\n const opacityHex = Math.round(opacity * 255).toString(16).padStart(2, '0').toUpperCase();\n\n const dataSeries = new XyDataSeries(wasmContext, {\n xValues,\n yValues,\n dataSeriesName: name,\n });\n\n return new FastColumnRenderableSeries(wasmContext, {\n dataSeries,\n fill: color + opacityHex,\n stroke: color,\n strokeThickness: 0,\n dataPointWidth,\n });\n}\n\n/**\n * Create a stacked column collection with multiple series\n */\nexport function createStackedCollection(\n wasmContext: TSciChart,\n options: StackedCollectionOptions\n): StackedColumnCollection {\n const { xValues, series, groupId, dataPointWidth = 0.6 } = options;\n\n const collection = new StackedColumnCollection(wasmContext);\n collection.dataPointWidth = dataPointWidth;\n\n for (const seriesConfig of series) {\n const dataSeries = new XyDataSeries(wasmContext, {\n xValues,\n yValues: seriesConfig.yValues,\n dataSeriesName: seriesConfig.name,\n });\n\n const stackedSeries = new StackedColumnRenderableSeries(wasmContext, {\n dataSeries,\n fill: seriesConfig.color,\n stroke: seriesConfig.color,\n strokeThickness: 0,\n stackedGroupId: groupId,\n });\n\n collection.add(stackedSeries);\n }\n\n return collection;\n}\n\n/**\n * Add a horizontal reference line annotation\n */\nexport function addReferenceLine(\n surface: SciChartSurface,\n options: ReferenceLineOptions\n): void {\n const {\n y,\n color,\n label,\n strokeThickness = 1,\n dashed = true,\n } = options;\n\n surface.annotations.add(\n new HorizontalLineAnnotation({\n y1: y,\n stroke: color,\n strokeThickness,\n strokeDashArray: dashed ? [5, 5] : undefined,\n annotationLayer: EAnnotationLayer.BelowChart,\n showLabel: !!label,\n labelValue: label,\n })\n );\n}\n"],"names":["createLineSeries","wasmContext","options","xValues","yValues","name","color","strokeThickness","pointMarker","size","strokeColor","markerStrokeThickness","dataSeries","XyDataSeries","FastLineRenderableSeries","EllipsePointMarker","createBarSeries","dataPointWidth","opacity","opacityHex","FastColumnRenderableSeries","createStackedCollection","series","groupId","collection","StackedColumnCollection","seriesConfig","stackedSeries","StackedColumnRenderableSeries","addReferenceLine","surface","y","label","dashed","HorizontalLineAnnotation","EAnnotationLayer"],"mappings":"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"}
|
|
@@ -1,5 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
import { s as t } from "./petal-toolkit.es59.js";
|
|
2
|
+
import { createCursorTooltip as P, TOOLTIP_STYLE as e } from "./petal-toolkit.es54.js";
|
|
3
|
+
function k(i, r) {
|
|
4
|
+
const { crosshairColor: a, showTooltip: s = !0, showAxisLabels: c = !0, valueFormatters: o } = r, g = new t.CursorModifier({
|
|
5
|
+
showTooltip: s,
|
|
6
|
+
showAxisLabels: c,
|
|
7
|
+
crosshairStroke: a,
|
|
8
|
+
tooltipSvgTemplate: P((n) => {
|
|
9
|
+
if (n.length === 0)
|
|
10
|
+
return { width: 0, height: 0, content: "" };
|
|
11
|
+
const w = 180, f = 30, l = 20, $ = f + n.length * l, M = n[0], p = new Date((M.xValue ?? 0) * 1e3).toLocaleDateString("en-US", {
|
|
12
|
+
month: "short",
|
|
13
|
+
day: "numeric",
|
|
14
|
+
year: "numeric"
|
|
15
|
+
}), S = `<text x="12" y="20" font-size="11" font-weight="600" font-family="${e.fontFamily}" fill="${e.textPrimary}">${p}</text>`, L = n.map((d, h) => {
|
|
16
|
+
var y;
|
|
17
|
+
const m = f + h * l + 10, x = d.seriesName || `Series ${h + 1}`, u = o == null ? void 0 : o[x], C = u ? u(d.yValue ?? 0) : `${((y = d.yValue) == null ? void 0 : y.toFixed(2)) ?? "-"}`;
|
|
18
|
+
return `<text x="12" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textSecondary}">${x}:</text>
|
|
19
|
+
<text x="100" y="${m}" font-size="10" font-family="${e.fontFamily}" fill="${e.textPrimary}">${C}</text>`;
|
|
20
|
+
}).join(""), T = S + L;
|
|
21
|
+
return { width: w, height: $, content: T };
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
i.chartModifiers.add(
|
|
25
|
+
new t.ZoomPanModifier(),
|
|
26
|
+
new t.MouseWheelZoomModifier(),
|
|
27
|
+
new t.ZoomExtentsModifier(),
|
|
28
|
+
g
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function F(i, r = {}) {
|
|
32
|
+
const {
|
|
33
|
+
placement: a = t.ELegendPlacement.TopRight,
|
|
34
|
+
orientation: s = t.ELegendOrientation.Horizontal,
|
|
35
|
+
showCheckboxes: c = !1,
|
|
36
|
+
showSeriesMarkers: o = !0
|
|
37
|
+
} = r;
|
|
38
|
+
i.chartModifiers.add(
|
|
39
|
+
new t.LegendModifier({
|
|
40
|
+
placement: a,
|
|
41
|
+
orientation: s,
|
|
42
|
+
showCheckboxes: c,
|
|
43
|
+
showSeriesMarkers: o
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
}
|
|
2
47
|
export {
|
|
3
|
-
|
|
48
|
+
F as addLegendModifier,
|
|
49
|
+
k as addStandardModifiers
|
|
4
50
|
};
|
|
5
51
|
//# sourceMappingURL=petal-toolkit.es1331.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"petal-toolkit.es1331.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"petal-toolkit.es1331.js","sources":["../src/charts/financials/shared/chartModifiers.ts"],"sourcesContent":["import {\n SciChartSurface,\n ZoomPanModifier,\n MouseWheelZoomModifier,\n ZoomExtentsModifier,\n CursorModifier,\n LegendModifier,\n ELegendPlacement,\n ELegendOrientation,\n} from 'scichart';\nimport { createCursorTooltip, TOOLTIP_STYLE } from '@/scichart/modifiers/tooltipTemplates';\n\ninterface StandardModifiersOptions {\n /** Crosshair/cursor stroke color */\n crosshairColor: string;\n /** Whether to show tooltips on cursor (default: true) */\n showTooltip?: boolean;\n /** Whether to show axis labels on cursor (default: true) */\n showAxisLabels?: boolean;\n /** Formatter functions per series (by series name) */\n valueFormatters?: {\n [seriesName: string]: (value: number) => string;\n };\n}\n\n/**\n * Add standard chart modifiers: ZoomPan, MouseWheelZoom, ZoomExtents, Cursor with styled tooltip\n */\nexport function addStandardModifiers(\n surface: SciChartSurface,\n options: StandardModifiersOptions\n): void {\n const { crosshairColor, showTooltip = true, showAxisLabels = true, valueFormatters } = options;\n\n const cursorModifier = new CursorModifier({\n showTooltip,\n showAxisLabels,\n crosshairStroke: crosshairColor,\n tooltipSvgTemplate: createCursorTooltip((seriesInfos) => {\n // Default multi-series tooltip formatting with dark background\n if (seriesInfos.length === 0) {\n return { width: 0, height: 0, content: '' };\n }\n\n const width = 180;\n const baseHeight = 30;\n const rowHeight = 20;\n const height = baseHeight + (seriesInfos.length * rowHeight);\n\n // Date from first series\n const firstInfo = seriesInfos[0];\n const date = new Date((firstInfo.xValue ?? 0) * 1000);\n const dateStr = date.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric'\n });\n\n const dateContent = `<text x=\"12\" y=\"20\" font-size=\"11\" font-weight=\"600\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textPrimary}\">${dateStr}</text>`;\n\n const seriesContent = seriesInfos.map((info, i) => {\n const yPos = baseHeight + (i * rowHeight) + 10;\n const seriesName = info.seriesName || `Series ${i + 1}`;\n\n // Apply formatter if provided, otherwise use default\n const formatter = valueFormatters?.[seriesName];\n const value = formatter\n ? formatter(info.yValue ?? 0)\n : `${info.yValue?.toFixed(2) ?? '-'}`;\n\n return `<text x=\"12\" y=\"${yPos}\" font-size=\"10\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textSecondary}\">${seriesName}:</text>\n <text x=\"100\" y=\"${yPos}\" font-size=\"10\" font-family=\"${TOOLTIP_STYLE.fontFamily}\" fill=\"${TOOLTIP_STYLE.textPrimary}\">${value}</text>`;\n }).join('');\n\n const content = dateContent + seriesContent;\n\n return { width, height, content };\n }),\n });\n\n surface.chartModifiers.add(\n new ZoomPanModifier(),\n new MouseWheelZoomModifier(),\n new ZoomExtentsModifier(),\n cursorModifier\n );\n}\n\ninterface LegendModifierOptions {\n /** Placement of the legend (default: TopRight). Use ELegendPlacement enum values. */\n placement?: ELegendPlacement | number;\n /** Orientation of the legend (default: Horizontal). Use ELegendOrientation enum values. */\n orientation?: ELegendOrientation | number;\n /** Show checkboxes for toggling series (default: false) */\n showCheckboxes?: boolean;\n /** Show series markers in legend (default: true) */\n showSeriesMarkers?: boolean;\n}\n\n/**\n * Add a legend modifier to the chart\n */\nexport function addLegendModifier(\n surface: SciChartSurface,\n options: LegendModifierOptions = {}\n): void {\n const {\n placement = ELegendPlacement.TopRight,\n orientation = ELegendOrientation.Horizontal,\n showCheckboxes = false,\n showSeriesMarkers = true,\n } = options;\n\n surface.chartModifiers.add(\n new LegendModifier({\n placement: placement as ELegendPlacement,\n orientation: orientation as ELegendOrientation,\n showCheckboxes,\n showSeriesMarkers,\n })\n );\n}\n\n/**\n * Add both standard modifiers and legend in one call\n */\nexport function addStandardModifiersWithLegend(\n surface: SciChartSurface,\n options: StandardModifiersOptions & { legendOptions?: LegendModifierOptions }\n): void {\n addStandardModifiers(surface, options);\n addLegendModifier(surface, options.legendOptions);\n}\n"],"names":["addStandardModifiers","surface","options","crosshairColor","showTooltip","showAxisLabels","valueFormatters","cursorModifier","CursorModifier","createCursorTooltip","seriesInfos","width","baseHeight","rowHeight","height","firstInfo","dateStr","dateContent","TOOLTIP_STYLE","seriesContent","info","i","yPos","seriesName","formatter","value","_a","content","ZoomPanModifier","MouseWheelZoomModifier","ZoomExtentsModifier","addLegendModifier","placement","ELegendPlacement","orientation","ELegendOrientation","showCheckboxes","showSeriesMarkers","LegendModifier"],"mappings":";;AA4BO,SAASA,EACdC,GACAC,GACM;AACN,QAAM,EAAE,gBAAAC,GAAgB,aAAAC,IAAc,IAAM,gBAAAC,IAAiB,IAAM,iBAAAC,MAAoBJ,GAEjFK,IAAiB,IAAIC,iBAAe;AAAA,IACxC,aAAAJ;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAiBF;AAAA,IACjB,oBAAoBM,EAAoB,CAACC,MAAgB;AAEvD,UAAIA,EAAY,WAAW;AACzB,eAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAA;AAGzC,YAAMC,IAAQ,KACRC,IAAa,IACbC,IAAY,IACZC,IAASF,IAAcF,EAAY,SAASG,GAG5CE,IAAYL,EAAY,CAAC,GAEzBM,IADO,IAAI,MAAMD,EAAU,UAAU,KAAK,GAAI,EAC/B,mBAAmB,SAAS;AAAA,QAC/C,OAAO;AAAA,QACP,KAAK;AAAA,QACL,MAAM;AAAA,MAAA,CACP,GAEKE,IAAc,qEAAqEC,EAAc,UAAU,WAAWA,EAAc,WAAW,KAAKF,CAAO,WAE3JG,IAAgBT,EAAY,IAAI,CAACU,GAAMC,MAAM;;AACjD,cAAMC,IAAOV,IAAcS,IAAIR,IAAa,IACtCU,IAAaH,EAAK,cAAc,UAAUC,IAAI,CAAC,IAG/CG,IAAYlB,KAAA,gBAAAA,EAAkBiB,IAC9BE,IAAQD,IACVA,EAAUJ,EAAK,UAAU,CAAC,IAC1B,KAAGM,IAAAN,EAAK,WAAL,gBAAAM,EAAa,QAAQ,OAAM,GAAG;AAErC,eAAO,mBAAmBJ,CAAI,iCAAiCJ,EAAc,UAAU,WAAWA,EAAc,aAAa,KAAKK,CAAU;AAAA,mCACjHD,CAAI,iCAAiCJ,EAAc,UAAU,WAAWA,EAAc,WAAW,KAAKO,CAAK;AAAA,MACxI,CAAC,EAAE,KAAK,EAAE,GAEJE,IAAUV,IAAcE;AAE9B,aAAO,EAAE,OAAAR,GAAO,QAAAG,GAAQ,SAAAa,EAAA;AAAA,IAC1B,CAAC;AAAA,EAAA,CACF;AAED,EAAA1B,EAAQ,eAAe;AAAA,IACrB,IAAI2B,kBAAA;AAAA,IACJ,IAAIC,yBAAA;AAAA,IACJ,IAAIC,sBAAA;AAAA,IACJvB;AAAA,EAAA;AAEJ;AAgBO,SAASwB,EACd9B,GACAC,IAAiC,IAC3B;AACN,QAAM;AAAA,IACJ,WAAA8B,IAAYC,EAAAA,iBAAiB;AAAA,IAC7B,aAAAC,IAAcC,EAAAA,mBAAmB;AAAA,IACjC,gBAAAC,IAAiB;AAAA,IACjB,mBAAAC,IAAoB;AAAA,EAAA,IAClBnC;AAEJ,EAAAD,EAAQ,eAAe;AAAA,IACrB,IAAIqC,iBAAe;AAAA,MACjB,WAAAN;AAAA,MACA,aAAAE;AAAA,MACA,gBAAAE;AAAA,MACA,mBAAAC;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;"}
|