@servicetitan/marketing-ui 5.11.1 → 6.0.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/dist/components/charts/common/color-tag.d.ts +15 -0
- package/dist/components/charts/common/color-tag.d.ts.map +1 -0
- package/dist/components/charts/common/color-tag.js +79 -0
- package/dist/components/charts/common/color-tag.js.map +1 -0
- package/dist/components/charts/common/color-tag.module.less +23 -0
- package/dist/components/charts/common/color-tag.module.less.d.ts +6 -0
- package/dist/components/charts/common/index.d.ts +2 -0
- package/dist/components/charts/common/index.d.ts.map +1 -0
- package/dist/components/charts/common/index.js +3 -0
- package/dist/components/charts/common/index.js.map +1 -0
- package/dist/components/charts/funnel-chart/components/funnel-chart.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.js +115 -70
- package/dist/components/charts/funnel-chart/components/funnel-chart.js.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-chart.module.less +28 -10
- package/dist/components/charts/funnel-chart/components/funnel-chart.module.less.d.ts +3 -1
- package/dist/components/charts/funnel-chart/components/funnel-svg.d.ts +2 -0
- package/dist/components/charts/funnel-chart/components/funnel-svg.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/components/funnel-svg.js +72 -31
- package/dist/components/charts/funnel-chart/components/funnel-svg.js.map +1 -1
- package/dist/components/charts/funnel-chart/funnel-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/utils/const.d.ts +1 -1
- package/dist/components/charts/funnel-chart/utils/const.js +1 -1
- package/dist/components/charts/funnel-chart/utils/const.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/interface.d.ts +1 -0
- package/dist/components/charts/funnel-chart/utils/interface.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart/utils/interface.js.map +1 -1
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.d.ts +2 -0
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.d.ts.map +1 -0
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.js +47 -0
- package/dist/components/charts/funnel-chart/utils/svg-rounded-path.js.map +1 -0
- package/dist/components/charts/line-chart/components/hover-popover.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.js +13 -7
- package/dist/components/charts/line-chart/components/hover-popover.js.map +1 -1
- package/dist/components/charts/line-chart/components/hover-popover.module.less +10 -0
- package/dist/components/charts/line-chart/components/hover-popover.module.less.d.ts +2 -0
- package/dist/components/charts/line-chart/components/stuff.d.ts +0 -8
- package/dist/components/charts/line-chart/components/stuff.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/stuff.js +6 -20
- package/dist/components/charts/line-chart/components/stuff.js.map +1 -1
- package/dist/components/charts/line-chart/components/stuff.module.less +0 -16
- package/dist/components/charts/line-chart/components/stuff.module.less.d.ts +0 -3
- package/dist/components/charts/line-chart/components/svg-bars.d.ts.map +1 -1
- package/dist/components/charts/line-chart/components/svg-bars.js +97 -13
- package/dist/components/charts/line-chart/components/svg-bars.js.map +1 -1
- package/dist/components/charts/line-chart/line-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.d.ts +5 -0
- package/dist/components/charts/line-chart/stores/line-chart.store.d.ts.map +1 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.js +41 -1
- package/dist/components/charts/line-chart/stores/line-chart.store.js.map +1 -1
- package/dist/components/charts/line-chart/utils/interfaces.d.ts +4 -0
- package/dist/components/charts/line-chart/utils/interfaces.d.ts.map +1 -1
- package/dist/components/charts/line-chart/utils/interfaces.js.map +1 -1
- package/dist/components/charts/line-chart/utils/labels.js +1 -1
- package/dist/components/charts/line-chart/utils/labels.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.js +24 -13
- package/dist/components/charts/pie-chart/components/pie-chart.js.map +1 -1
- package/dist/components/charts/pie-chart/components/pie-chart.module.less +15 -0
- package/dist/components/charts/pie-chart/components/pie-chart.module.less.d.ts +1 -0
- package/dist/components/charts/pie-chart/components/pie.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/components/pie.js +105 -28
- package/dist/components/charts/pie-chart/components/pie.js.map +1 -1
- package/dist/components/charts/pie-chart/pie-chart.stories.d.ts.map +1 -1
- package/dist/components/charts/pie-chart/utils/const.js +1 -1
- package/dist/components/charts/pie-chart/utils/const.js.map +1 -1
- package/dist/components/stat/stat-card.d.ts.map +1 -1
- package/dist/components/stat/stat-card.js +28 -12
- package/dist/components/stat/stat-card.js.map +1 -1
- package/package.json +5 -3
- package/src/components/charts/common/color-tag.module.less +23 -0
- package/src/components/charts/common/color-tag.module.less.d.ts +6 -0
- package/src/components/charts/common/color-tag.tsx +92 -0
- package/src/components/charts/common/index.ts +1 -0
- package/src/components/charts/funnel-chart/components/funnel-chart.module.less +28 -10
- package/src/components/charts/funnel-chart/components/funnel-chart.module.less.d.ts +3 -1
- package/src/components/charts/funnel-chart/components/funnel-chart.tsx +107 -78
- package/src/components/charts/funnel-chart/components/funnel-svg.tsx +91 -23
- package/src/components/charts/funnel-chart/funnel-chart.stories.tsx +3 -1
- package/src/components/charts/funnel-chart/utils/const.ts +1 -1
- package/src/components/charts/funnel-chart/utils/interface.ts +1 -0
- package/src/components/charts/funnel-chart/utils/svg-rounded-path.ts +86 -0
- package/src/components/charts/line-chart/components/hover-popover.module.less +10 -0
- package/src/components/charts/line-chart/components/hover-popover.module.less.d.ts +2 -0
- package/src/components/charts/line-chart/components/hover-popover.tsx +29 -9
- package/src/components/charts/line-chart/components/stuff.module.less +0 -16
- package/src/components/charts/line-chart/components/stuff.module.less.d.ts +0 -3
- package/src/components/charts/line-chart/components/stuff.tsx +4 -30
- package/src/components/charts/line-chart/components/svg-bars.tsx +106 -9
- package/src/components/charts/line-chart/line-chart.stories.tsx +13 -8
- package/src/components/charts/line-chart/stores/line-chart.store.ts +39 -1
- package/src/components/charts/line-chart/utils/interfaces.ts +4 -0
- package/src/components/charts/line-chart/utils/labels.ts +1 -1
- package/src/components/charts/pie-chart/components/pie-chart.module.less +15 -0
- package/src/components/charts/pie-chart/components/pie-chart.module.less.d.ts +1 -0
- package/src/components/charts/pie-chart/components/pie-chart.tsx +23 -13
- package/src/components/charts/pie-chart/components/pie.tsx +106 -40
- package/src/components/charts/pie-chart/pie-chart.stories.tsx +3 -4
- package/src/components/charts/pie-chart/utils/const.ts +1 -1
- package/src/components/stat/stat-card.tsx +34 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
import { useDependencies } from '@servicetitan/react-ioc';
|
|
4
4
|
import { keyVal } from '../utils/key';
|
|
@@ -8,27 +8,106 @@ export const SvgBars = observer(({ metrics, isStackedBarChart, isGroupedBarChart
|
|
|
8
8
|
const { fpx, fpy, barWidth, length } = store;
|
|
9
9
|
const barWidthHalf = barWidth / 2;
|
|
10
10
|
const paths = [];
|
|
11
|
+
const patternDefs = metrics.filter((m)=>{
|
|
12
|
+
var _m_opts;
|
|
13
|
+
return ((_m_opts = m.opts) === null || _m_opts === void 0 ? void 0 : _m_opts.pattern) === 'striped';
|
|
14
|
+
}).map((m)=>{
|
|
15
|
+
const rotation = 20;
|
|
16
|
+
const tileW = 0.6;
|
|
17
|
+
const tileH = 0.6;
|
|
18
|
+
const stripeWidth = Math.max(0.1, Math.floor(tileW / 20));
|
|
19
|
+
const tintOpacity = 0.06;
|
|
20
|
+
return /*#__PURE__*/ _jsxs("pattern", {
|
|
21
|
+
id: `stripe-pattern-${m.id}`,
|
|
22
|
+
patternUnits: "userSpaceOnUse",
|
|
23
|
+
width: tileW,
|
|
24
|
+
height: tileH,
|
|
25
|
+
patternTransform: `rotate(${rotation})`,
|
|
26
|
+
children: [
|
|
27
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
28
|
+
width: tileW,
|
|
29
|
+
height: tileH,
|
|
30
|
+
fill: m.color,
|
|
31
|
+
opacity: tintOpacity
|
|
32
|
+
}),
|
|
33
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
34
|
+
width: stripeWidth,
|
|
35
|
+
height: tileH,
|
|
36
|
+
fill: m.color
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
}, `pattern-${m.id}`);
|
|
40
|
+
});
|
|
11
41
|
for(let i = 0; i < length; i++){
|
|
12
42
|
const x = store.periodX(i);
|
|
13
43
|
const values = metrics.map((m)=>{
|
|
14
|
-
var _m_valuesOpts_i, _m_valuesOpts;
|
|
44
|
+
var _m_valuesOpts_i, _m_valuesOpts, _m_opts, _m_opts1, _m_opts2;
|
|
15
45
|
var _m_valuesOpts_i_color;
|
|
16
46
|
return {
|
|
17
47
|
id: m.id,
|
|
18
48
|
color: (_m_valuesOpts_i_color = (_m_valuesOpts = m.valuesOpts) === null || _m_valuesOpts === void 0 ? void 0 : (_m_valuesOpts_i = _m_valuesOpts[i]) === null || _m_valuesOpts_i === void 0 ? void 0 : _m_valuesOpts_i.color) !== null && _m_valuesOpts_i_color !== void 0 ? _m_valuesOpts_i_color : m.color,
|
|
19
49
|
opacity: m.opacity,
|
|
20
|
-
val: store.periodY(m, i)
|
|
50
|
+
val: store.periodY(m, i),
|
|
51
|
+
pattern: (_m_opts = m.opts) === null || _m_opts === void 0 ? void 0 : _m_opts.pattern,
|
|
52
|
+
strokeColor: (_m_opts1 = m.opts) === null || _m_opts1 === void 0 ? void 0 : _m_opts1.strokeColor,
|
|
53
|
+
outlineColor: (_m_opts2 = m.opts) === null || _m_opts2 === void 0 ? void 0 : _m_opts2.outlineColor,
|
|
54
|
+
value: m.values[i]
|
|
21
55
|
};
|
|
22
56
|
});
|
|
23
57
|
if (isStackedBarChart) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
58
|
+
const spacingBetweenSegments = 1; // Approximately 4px in SVG coordinates
|
|
59
|
+
const totalSpacing = (values.length - 1) * spacingBetweenSegments;
|
|
60
|
+
let stackedBarHeight = values.reduce((sum, curr)=>sum + curr.val, 0) + totalSpacing;
|
|
61
|
+
const totalValue = values.reduce((sum, curr)=>sum + curr.value, 0);
|
|
62
|
+
if (totalValue > 0) {
|
|
63
|
+
const yTop = +fpy(stackedBarHeight);
|
|
64
|
+
const scaleX = 0.3;
|
|
65
|
+
const scaleY = 1;
|
|
66
|
+
paths.push(/*#__PURE__*/ _jsx("g", {
|
|
67
|
+
transform: `translate(${x},${yTop}) scale(${scaleX},${scaleY})`,
|
|
68
|
+
pointerEvents: "none",
|
|
69
|
+
children: /*#__PURE__*/ _jsx("text", {
|
|
70
|
+
x: 0,
|
|
71
|
+
y: 0,
|
|
72
|
+
textAnchor: "middle",
|
|
73
|
+
dominantBaseline: "alphabetic",
|
|
74
|
+
fontSize: "2.5",
|
|
75
|
+
fontWeight: 600,
|
|
76
|
+
fill: "#111827",
|
|
77
|
+
stroke: "white",
|
|
78
|
+
strokeWidth: 0.8,
|
|
79
|
+
paintOrder: "stroke",
|
|
80
|
+
fontFamily: "Nunito Sans",
|
|
81
|
+
children: Math.round(totalValue)
|
|
82
|
+
})
|
|
83
|
+
}, `total-${i}`));
|
|
84
|
+
}
|
|
85
|
+
for(let j = 0; j < values.length; j++){
|
|
86
|
+
const value = values[j];
|
|
87
|
+
stackedBarHeight -= spacingBetweenSegments;
|
|
88
|
+
const TOP_RADIUS = 1;
|
|
89
|
+
const xLeft = +fpx(x - barWidth / 2);
|
|
90
|
+
const yTop = +fpy(stackedBarHeight) + (values.length - 2);
|
|
91
|
+
const height = +fpx(value.val);
|
|
92
|
+
const width = +fpx(barWidth);
|
|
93
|
+
const r = j === 0 ? TOP_RADIUS : 0; // radius must be numeric
|
|
94
|
+
const d = [
|
|
95
|
+
`M ${xLeft} ${yTop + height}`,
|
|
96
|
+
`L ${xLeft} ${yTop + r}`,
|
|
97
|
+
`Q ${xLeft} ${yTop} ${xLeft + r / 2} ${yTop}`,
|
|
98
|
+
`L ${xLeft + width - r / 2} ${yTop}`,
|
|
99
|
+
`Q ${xLeft + width} ${yTop} ${xLeft + width} ${yTop + r}`,
|
|
100
|
+
`L ${xLeft + width} ${yTop + height}`,
|
|
101
|
+
'Z'
|
|
102
|
+
].join(' ');
|
|
103
|
+
var _value_strokeColor;
|
|
104
|
+
paths.push(/*#__PURE__*/ _jsx("path", {
|
|
105
|
+
d: d,
|
|
106
|
+
fill: value.pattern === 'striped' ? `url(#stripe-pattern-${value.id})` : value.color,
|
|
107
|
+
stroke: value.pattern === 'outline' ? value.outlineColor : (_value_strokeColor = value.strokeColor) !== null && _value_strokeColor !== void 0 ? _value_strokeColor : value.color,
|
|
108
|
+
strokeWidth: 1,
|
|
109
|
+
vectorEffect: "non-scaling-stroke",
|
|
110
|
+
strokeLinejoin: "round"
|
|
32
111
|
}, keyVal(value.id, i)));
|
|
33
112
|
stackedBarHeight -= value.val;
|
|
34
113
|
}
|
|
@@ -58,8 +137,13 @@ export const SvgBars = observer(({ metrics, isStackedBarChart, isGroupedBarChart
|
|
|
58
137
|
}
|
|
59
138
|
}
|
|
60
139
|
}
|
|
61
|
-
return /*#__PURE__*/
|
|
62
|
-
children:
|
|
140
|
+
return /*#__PURE__*/ _jsxs("g", {
|
|
141
|
+
children: [
|
|
142
|
+
patternDefs.length > 0 && /*#__PURE__*/ _jsx("defs", {
|
|
143
|
+
children: patternDefs
|
|
144
|
+
}),
|
|
145
|
+
paths
|
|
146
|
+
]
|
|
63
147
|
});
|
|
64
148
|
});
|
|
65
149
|
export const SvgBarsHover = observer(({ onHover, onLeave })=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/line-chart/components/svg-bars.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { observer } from 'mobx-react';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport { ChartMetric } from '../utils/internal-interfaces';\nimport { keyVal } from '../utils/key';\nimport { SvgStore } from '../stores/svg.store';\n\ninterface SvgBarsProps {\n metrics: ChartMetric[];\n isStackedBarChart?: boolean;\n isGroupedBarChart?: boolean;\n}\n\nexport const SvgBars: FC<SvgBarsProps> = observer(\n ({ metrics, isStackedBarChart, isGroupedBarChart }) => {\n const [store] = useDependencies(SvgStore);\n const { fpx, fpy, barWidth, length } = store;\n const barWidthHalf = barWidth / 2;\n const paths = [];\n\n for (let i = 0; i < length; i++) {\n const x = store.periodX(i);\n const values = metrics.map(m => ({\n id: m.id,\n color: m.valuesOpts?.[i]?.color ?? m.color,\n opacity: m.opacity,\n val: store.periodY(m, i),\n }));\n\n if (isStackedBarChart) {\n let stackedBarHeight = values.reduce((sum, curr) => sum + curr.val, 0);\n\n for (const value of values) {\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(stackedBarHeight)}\n width={fpx(barWidth)}\n height={fpx(value.val)}\n fill={value.color}\n />\n );\n stackedBarHeight -= value.val;\n }\n } else if (isGroupedBarChart) {\n for (let j = 0; j < values.length; j++) {\n const groupedBarX = (j * barWidth) / values.length;\n const value = values[j];\n\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={x + groupedBarX - barWidthHalf}\n y={fpy(value.val)}\n width={barWidth / values.length - 0.1}\n height={fpx(value.val)}\n fill={value.color}\n opacity={value.opacity}\n />\n );\n }\n } else {\n values.sort((a, b) => b.val - a.val);\n for (const value of values) {\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(value.val)}\n width={fpx(barWidth)}\n height={fpx(value.val)}\n fill={value.color}\n />\n );\n }\n }\n }\n\n return <g>{paths}</g>;\n }\n);\n\ninterface SvgBarsHoverProps {\n onHover(ind: number): void;\n onLeave(ind: number): void;\n}\n\nexport const SvgBarsHover: FC<SvgBarsHoverProps> = observer(({ onHover, onLeave }) => {\n const [store] = useDependencies(SvgStore);\n const { fpx, fpy, barWidth, length } = store;\n const barWidthHalf = barWidth / 2;\n const paths = [];\n\n for (let i = 0; i < length; i++) {\n const x = store.periodX(i);\n\n paths.push(\n <rect\n key={keyVal('_', i)}\n onMouseEnter={() => onHover(i)}\n onMouseLeave={() => onLeave(i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(100)}\n width={fpx(barWidth)}\n height=\"100%\"\n fill=\"white\"\n fillOpacity=\"0\"\n />\n );\n }\n\n return <g>{paths}</g>;\n});\n"],"names":["observer","useDependencies","keyVal","SvgStore","SvgBars","metrics","isStackedBarChart","isGroupedBarChart","store","fpx","fpy","barWidth","length","barWidthHalf","paths","i","x","periodX","values","map","m","id","color","valuesOpts","opacity","val","periodY","stackedBarHeight","reduce","sum","curr","value","push","rect","y","width","height","fill","j","groupedBarX","sort","a","b","g","SvgBarsHover","onHover","onLeave","onMouseEnter","onMouseLeave","fillOpacity"],"mappings":";AACA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,eAAe,QAAQ,0BAA0B;AAE1D,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,QAAQ,QAAQ,sBAAsB;AAQ/C,OAAO,MAAMC,UAA4BJ,SACrC,CAAC,EAAEK,OAAO,EAAEC,iBAAiB,EAAEC,iBAAiB,EAAE;IAC9C,MAAM,CAACC,MAAM,GAAGP,gBAAgBE;IAChC,MAAM,EAAEM,GAAG,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGJ;IACvC,MAAMK,eAAeF,WAAW;IAChC,MAAMG,QAAQ,EAAE;IAEhB,IAAK,IAAIC,IAAI,GAAGA,IAAIH,QAAQG,IAAK;QAC7B,MAAMC,IAAIR,MAAMS,OAAO,CAACF;QACxB,MAAMG,SAASb,QAAQc,GAAG,CAACC,CAAAA;gBAEhBA,iBAAAA;gBAAAA;mBAFsB;gBAC7BC,IAAID,EAAEC,EAAE;gBACRC,OAAOF,CAAAA,yBAAAA,gBAAAA,EAAEG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BJ,MAAMkB,IAAI,eACN,KAACC;oBAEGjB,GAAGP,IAAIO,IAAIH;oBACXqB,GAAGxB,IAAIqB,MAAMN,GAAG;oBAChBU,OAAO1B,IAAIE;oBACXyB,QAAQ3B,IAAIsB,MAAMN,GAAG;oBACrBY,MAAMN,MAAMT,KAAK;mBALZpB,OAAO6B,MAAMV,EAAE,EAAEN;YAQlC;QACJ;IACJ;IAEA,qBAAO,KAAC4B;kBAAG7B;;AACf,GACF;AAOF,OAAO,MAAM8B,eAAsC5C,SAAS,CAAC,EAAE6C,OAAO,EAAEC,OAAO,EAAE;IAC7E,MAAM,CAACtC,MAAM,GAAGP,gBAAgBE;IAChC,MAAM,EAAEM,GAAG,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGJ;IACvC,MAAMK,eAAeF,WAAW;IAChC,MAAMG,QAAQ,EAAE;IAEhB,IAAK,IAAIC,IAAI,GAAGA,IAAIH,QAAQG,IAAK;QAC7B,MAAMC,IAAIR,MAAMS,OAAO,CAACF;QAExBD,MAAMkB,IAAI,eACN,KAACC;YAEGc,cAAc,IAAMF,QAAQ9B;YAC5BiC,cAAc,IAAMF,QAAQ/B;YAC5BC,GAAGP,IAAIO,IAAIH;YACXqB,GAAGxB,IAAI;YACPyB,OAAO1B,IAAIE;YACXyB,QAAO;YACPC,MAAK;YACLY,aAAY;WARP/C,OAAO,KAAKa;IAW7B;IAEA,qBAAO,KAAC4B;kBAAG7B;;AACf,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/line-chart/components/svg-bars.tsx"],"sourcesContent":["import { FC } from 'react';\nimport { observer } from 'mobx-react';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport { ChartMetric } from '../utils/internal-interfaces';\nimport { keyVal } from '../utils/key';\nimport { SvgStore } from '../stores/svg.store';\n\ninterface SvgBarsProps {\n metrics: ChartMetric[];\n isStackedBarChart?: boolean;\n isGroupedBarChart?: boolean;\n}\n\nexport const SvgBars: FC<SvgBarsProps> = observer(\n ({ metrics, isStackedBarChart, isGroupedBarChart }) => {\n const [store] = useDependencies(SvgStore);\n const { fpx, fpy, barWidth, length } = store;\n const barWidthHalf = barWidth / 2;\n const paths = [];\n\n const patternDefs = metrics\n .filter(m => m.opts?.pattern === 'striped')\n .map(m => {\n const rotation = 20;\n const tileW = 0.6;\n const tileH = 0.6;\n const stripeWidth = Math.max(0.1, Math.floor(tileW / 20));\n const tintOpacity = 0.06;\n\n return (\n <pattern\n key={`pattern-${m.id}`}\n id={`stripe-pattern-${m.id}`}\n patternUnits=\"userSpaceOnUse\"\n width={tileW}\n height={tileH}\n patternTransform={`rotate(${rotation})`}\n >\n <rect width={tileW} height={tileH} fill={m.color} opacity={tintOpacity} />\n <rect width={stripeWidth} height={tileH} fill={m.color} />\n </pattern>\n );\n });\n\n for (let i = 0; i < length; i++) {\n const x = store.periodX(i);\n const values = metrics.map(m => ({\n id: m.id,\n color: m.valuesOpts?.[i]?.color ?? m.color,\n opacity: m.opacity,\n val: store.periodY(m, i),\n pattern: m.opts?.pattern,\n strokeColor: m.opts?.strokeColor,\n outlineColor: m.opts?.outlineColor,\n value: m.values[i],\n }));\n\n if (isStackedBarChart) {\n const spacingBetweenSegments = 1; // Approximately 4px in SVG coordinates\n const totalSpacing = (values.length - 1) * spacingBetweenSegments;\n let stackedBarHeight =\n values.reduce((sum, curr) => sum + curr.val, 0) + totalSpacing;\n\n const totalValue = values.reduce((sum, curr) => sum + curr.value, 0);\n if (totalValue > 0) {\n const yTop = +fpy(stackedBarHeight);\n const scaleX = 0.3;\n const scaleY = 1;\n\n paths.push(\n <g\n key={`total-${i}`}\n transform={`translate(${x},${yTop}) scale(${scaleX},${scaleY})`}\n pointerEvents=\"none\"\n >\n <text\n x={0}\n y={0}\n textAnchor=\"middle\"\n dominantBaseline=\"alphabetic\"\n fontSize=\"2.5\"\n fontWeight={600}\n fill=\"#111827\"\n stroke=\"white\"\n strokeWidth={0.8}\n paintOrder=\"stroke\"\n fontFamily=\"Nunito Sans\"\n >\n {Math.round(totalValue)}\n </text>\n </g>\n );\n }\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j];\n stackedBarHeight -= spacingBetweenSegments;\n\n const TOP_RADIUS = 1;\n const xLeft = +fpx(x - barWidth / 2);\n const yTop = +fpy(stackedBarHeight) + (values.length - 2);\n const height = +fpx(value.val);\n const width = +fpx(barWidth);\n\n const r = j === 0 ? TOP_RADIUS : 0; // radius must be numeric\n\n const d = [\n `M ${xLeft} ${yTop + height}`, // bottom-left\n `L ${xLeft} ${yTop + r}`, // up left edge\n `Q ${xLeft} ${yTop} ${xLeft + r / 2} ${yTop}`, // top-left corner\n `L ${xLeft + width - r / 2} ${yTop}`, // across top\n `Q ${xLeft + width} ${yTop} ${xLeft + width} ${yTop + r}`, // top-right corner\n `L ${xLeft + width} ${yTop + height}`, // down right edge\n 'Z',\n ].join(' ');\n paths.push(\n <path\n key={keyVal(value.id, i)}\n d={d}\n fill={\n value.pattern === 'striped'\n ? `url(#stripe-pattern-${value.id})`\n : value.color\n }\n stroke={\n value.pattern === 'outline'\n ? value.outlineColor\n : (value.strokeColor ?? value.color)\n }\n strokeWidth={1}\n vectorEffect=\"non-scaling-stroke\"\n strokeLinejoin=\"round\"\n />\n );\n\n stackedBarHeight -= value.val;\n }\n } else if (isGroupedBarChart) {\n for (let j = 0; j < values.length; j++) {\n const groupedBarX = (j * barWidth) / values.length;\n const value = values[j];\n\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={x + groupedBarX - barWidthHalf}\n y={fpy(value.val)}\n width={barWidth / values.length - 0.1}\n height={fpx(value.val)}\n fill={value.color}\n opacity={value.opacity}\n />\n );\n }\n } else {\n values.sort((a, b) => b.val - a.val);\n for (const value of values) {\n paths.push(\n <rect\n key={keyVal(value.id, i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(value.val)}\n width={fpx(barWidth)}\n height={fpx(value.val)}\n fill={value.color}\n />\n );\n }\n }\n }\n\n return (\n <g>\n {patternDefs.length > 0 && <defs>{patternDefs}</defs>}\n {paths}\n </g>\n );\n }\n);\n\ninterface SvgBarsHoverProps {\n onHover(ind: number): void;\n onLeave(ind: number): void;\n}\n\nexport const SvgBarsHover: FC<SvgBarsHoverProps> = observer(({ onHover, onLeave }) => {\n const [store] = useDependencies(SvgStore);\n const { fpx, fpy, barWidth, length } = store;\n const barWidthHalf = barWidth / 2;\n const paths = [];\n\n for (let i = 0; i < length; i++) {\n const x = store.periodX(i);\n\n paths.push(\n <rect\n key={keyVal('_', i)}\n onMouseEnter={() => onHover(i)}\n onMouseLeave={() => onLeave(i)}\n x={fpx(x - barWidthHalf)}\n y={fpy(100)}\n width={fpx(barWidth)}\n height=\"100%\"\n fill=\"white\"\n fillOpacity=\"0\"\n />\n );\n }\n\n return <g>{paths}</g>;\n});\n"],"names":["observer","useDependencies","keyVal","SvgStore","SvgBars","metrics","isStackedBarChart","isGroupedBarChart","store","fpx","fpy","barWidth","length","barWidthHalf","paths","patternDefs","filter","m","opts","pattern","map","rotation","tileW","tileH","stripeWidth","Math","max","floor","tintOpacity","id","patternUnits","width","height","patternTransform","rect","fill","color","opacity","i","x","periodX","values","valuesOpts","val","periodY","strokeColor","outlineColor","value","spacingBetweenSegments","totalSpacing","stackedBarHeight","reduce","sum","curr","totalValue","yTop","scaleX","scaleY","push","g","transform","pointerEvents","text","y","textAnchor","dominantBaseline","fontSize","fontWeight","stroke","strokeWidth","paintOrder","fontFamily","round","j","TOP_RADIUS","xLeft","r","d","join","path","vectorEffect","strokeLinejoin","groupedBarX","sort","a","b","defs","SvgBarsHover","onHover","onLeave","onMouseEnter","onMouseLeave","fillOpacity"],"mappings":";AACA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,eAAe,QAAQ,0BAA0B;AAE1D,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,QAAQ,QAAQ,sBAAsB;AAQ/C,OAAO,MAAMC,UAA4BJ,SACrC,CAAC,EAAEK,OAAO,EAAEC,iBAAi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EAAEwF,OAAO,EAAEC,OAAO,EAAE;IAC7E,MAAM,CAACjF,MAAM,GAAGP,gBAAgBE;IAChC,MAAM,EAAEM,GAAG,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGJ;IACvC,MAAMK,eAAeF,WAAW;IAChC,MAAMG,QAAQ,EAAE;IAEhB,IAAK,IAAIwB,IAAI,GAAGA,IAAI1B,QAAQ0B,IAAK;QAC7B,MAAMC,IAAI/B,MAAMgC,OAAO,CAACF;QAExBxB,MAAM4C,IAAI,eACN,KAACxB;YAEGwD,cAAc,IAAMF,QAAQlD;YAC5BqD,cAAc,IAAMF,QAAQnD;YAC5BC,GAAG9B,IAAI8B,IAAI1B;YACXkD,GAAGrD,IAAI;YACPqB,OAAOtB,IAAIE;YACXqB,QAAO;YACPG,MAAK;YACLyD,aAAY;WARP1F,OAAO,KAAKoC;IAW7B;IAEA,qBAAO,KAACqB;kBAAG7C;;AACf,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/line-chart/line-chart.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;;;;;;
|
|
1
|
+
{"version":3,"file":"line-chart.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/charts/line-chart/line-chart.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;;;;;;AAKrC,wBAIE;AAkFF,eAAO,MAAM,0BAA0B,+CA4BtC,CAAC;AAEF,eAAO,MAAM,gCAAgC,+CAsC5C,CAAC;AAEF,eAAO,MAAM,gCAAgC,+CAkC5C,CAAC;AAEF,eAAO,MAAM,eAAe,+CA2B3B,CAAC;AA2BF,eAAO,MAAM,mBAAmB,EAAE,EA8BjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EA8B9B,CAAC"}
|
|
@@ -6,11 +6,16 @@ export declare class LineChartStore {
|
|
|
6
6
|
metrics: ChartMetric[];
|
|
7
7
|
periods: LineChartPeriod[];
|
|
8
8
|
resolution: LineChartResolution;
|
|
9
|
+
totalMetricName?: string;
|
|
9
10
|
left?: SideMetricsSettings;
|
|
10
11
|
right?: SideMetricsSettings;
|
|
11
12
|
hoveredIndex: number;
|
|
13
|
+
get stackedTotals(): number[] | undefined;
|
|
14
|
+
get totalLabel(): string;
|
|
12
15
|
constructor();
|
|
13
16
|
init: (props: LineChartProps) => void;
|
|
14
17
|
setHoveredIndex: (index: number, isHovered: boolean) => void;
|
|
18
|
+
formattedTotalAt: (index: number) => string;
|
|
19
|
+
private totalAt;
|
|
15
20
|
}
|
|
16
21
|
//# sourceMappingURL=line-chart.store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.store.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,gBAAgB,EAGhB,eAAe,EACf,cAAc,EACd,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAsErF,qBACa,cAAc;IACX,MAAM,UAAS;IACf,OAAO,EAAE,gBAAgB,CAAoB;IAC7C,OAAO,EAAE,WAAW,EAAE,CAAM;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAM;IAChC,UAAU,EAAE,mBAAmB,CAAS;
|
|
1
|
+
{"version":3,"file":"line-chart.store.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,gBAAgB,EAGhB,eAAe,EACf,cAAc,EACd,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAsErF,qBACa,cAAc;IACX,MAAM,UAAS;IACf,OAAO,EAAE,gBAAgB,CAAoB;IAC7C,OAAO,EAAE,WAAW,EAAE,CAAM;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAM;IAChC,UAAU,EAAE,mBAAmB,CAAS;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAE5B,YAAY,SAAM;IAE9B,IAAc,aAAa,IAAI,MAAM,EAAE,GAAG,SAAS,CAoBlD;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;;IAMO,IAAI,GAAI,OAAO,cAAc,UAuCnC;IAEM,eAAe,GAAI,OAAO,MAAM,EAAE,WAAW,OAAO,UAM1D;IAEF,gBAAgB,GAAI,OAAO,MAAM,KAAG,MAAM,CAGxC;IAEF,OAAO,CAAC,OAAO,CAGH;CACf"}
|
|
@@ -21,7 +21,7 @@ function _ts_metadata(k, v) {
|
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
23
|
import { injectable } from '@servicetitan/react-ioc';
|
|
24
|
-
import { action, observable, makeObservable } from 'mobx';
|
|
24
|
+
import { action, observable, makeObservable, computed } from 'mobx';
|
|
25
25
|
import { defaultDisplay } from '../utils/const';
|
|
26
26
|
import { getFormatter } from '../utils/formatters';
|
|
27
27
|
const getSideMetricsSettings = (metrics, values, range, title, format)=>{
|
|
@@ -65,12 +65,37 @@ const getSideMetricsSettings = (metrics, values, range, title, format)=>{
|
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
export class LineChartStore {
|
|
68
|
+
get stackedTotals() {
|
|
69
|
+
const stackedSeries = this.metrics.filter((m)=>m.type === 'stacked-bar');
|
|
70
|
+
if (stackedSeries.length === 0) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const length = Math.max(this.periods.length, ...stackedSeries.map((s)=>s.values.length));
|
|
74
|
+
if (length === 0) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const totals = Array.from({
|
|
78
|
+
length
|
|
79
|
+
}, ()=>0);
|
|
80
|
+
for(let i = 0; i < length; i++){
|
|
81
|
+
for (const s of stackedSeries){
|
|
82
|
+
const v = s.values[i];
|
|
83
|
+
totals[i] += !Number.isNaN(v) ? v : 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return totals;
|
|
87
|
+
}
|
|
88
|
+
get totalLabel() {
|
|
89
|
+
var _this_totalMetricName;
|
|
90
|
+
return (_this_totalMetricName = this.totalMetricName) !== null && _this_totalMetricName !== void 0 ? _this_totalMetricName : 'Total';
|
|
91
|
+
}
|
|
68
92
|
constructor(){
|
|
69
93
|
_define_property(this, "isInit", false);
|
|
70
94
|
_define_property(this, "display", defaultDisplay());
|
|
71
95
|
_define_property(this, "metrics", []);
|
|
72
96
|
_define_property(this, "periods", []);
|
|
73
97
|
_define_property(this, "resolution", 'day');
|
|
98
|
+
_define_property(this, "totalMetricName", void 0);
|
|
74
99
|
_define_property(this, "left", void 0);
|
|
75
100
|
_define_property(this, "right", void 0);
|
|
76
101
|
_define_property(this, "hoveredIndex", -1);
|
|
@@ -95,6 +120,7 @@ export class LineChartStore {
|
|
|
95
120
|
this.left = getSideMetricsSettings(this.metrics.filter((m)=>!m.isRight), props.metricValues, props.maxRange, props.titleY, this.display.yLeftFormat);
|
|
96
121
|
this.right = getSideMetricsSettings(this.metrics.filter((m)=>m.isRight), props.metricValues, props.maxRangeRight, props.titleYRight, this.display.yRightFormat);
|
|
97
122
|
this.resolution = props.resolution;
|
|
123
|
+
this.totalMetricName = props.totalMetricName;
|
|
98
124
|
this.periods = props.periods || [];
|
|
99
125
|
this.hoveredIndex = -1;
|
|
100
126
|
this.isInit = true;
|
|
@@ -106,6 +132,11 @@ export class LineChartStore {
|
|
|
106
132
|
this.hoveredIndex = -1;
|
|
107
133
|
}
|
|
108
134
|
});
|
|
135
|
+
_define_property(this, "formattedTotalAt", (index)=>{
|
|
136
|
+
const formatter = getFormatter(this.display.yLeftFormat);
|
|
137
|
+
return formatter(this.totalAt(index));
|
|
138
|
+
});
|
|
139
|
+
_define_property(this, "totalAt", (index)=>this.stackedTotals && index >= 0 && index < this.stackedTotals.length ? this.stackedTotals[index] : 0);
|
|
109
140
|
makeObservable(this);
|
|
110
141
|
}
|
|
111
142
|
}
|
|
@@ -128,6 +159,10 @@ _ts_decorate([
|
|
|
128
159
|
observable,
|
|
129
160
|
_ts_metadata("design:type", typeof LineChartResolution === "undefined" ? Object : LineChartResolution)
|
|
130
161
|
], LineChartStore.prototype, "resolution", void 0);
|
|
162
|
+
_ts_decorate([
|
|
163
|
+
observable,
|
|
164
|
+
_ts_metadata("design:type", String)
|
|
165
|
+
], LineChartStore.prototype, "totalMetricName", void 0);
|
|
131
166
|
_ts_decorate([
|
|
132
167
|
observable,
|
|
133
168
|
_ts_metadata("design:type", typeof SideMetricsSettings === "undefined" ? Object : SideMetricsSettings)
|
|
@@ -139,6 +174,11 @@ _ts_decorate([
|
|
|
139
174
|
_ts_decorate([
|
|
140
175
|
observable
|
|
141
176
|
], LineChartStore.prototype, "hoveredIndex", void 0);
|
|
177
|
+
_ts_decorate([
|
|
178
|
+
computed,
|
|
179
|
+
_ts_metadata("design:type", Object),
|
|
180
|
+
_ts_metadata("design:paramtypes", [])
|
|
181
|
+
], LineChartStore.prototype, "stackedTotals", null);
|
|
142
182
|
_ts_decorate([
|
|
143
183
|
action
|
|
144
184
|
], LineChartStore.prototype, "init", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"sourcesContent":["import { injectable } from '@servicetitan/react-ioc';\nimport { action, observable, makeObservable } from 'mobx';\nimport type {\n LineChartDisplay,\n LineChartDisplayValueFormat,\n LineChartMetricValues,\n LineChartPeriod,\n LineChartProps,\n LineChartResolution,\n} from '../utils/interfaces';\nimport { defaultDisplay } from '../utils/const';\nimport type { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';\nimport { getFormatter } from '../utils/formatters';\n\nconst getSideMetricsSettings = (\n metrics: ChartMetric[],\n values: LineChartMetricValues[],\n range?: number,\n title?: string,\n format?: LineChartDisplayValueFormat\n): SideMetricsSettings | undefined => {\n let maxRange = range ?? 0;\n const lineBarMetricIDs = metrics\n .filter(m => m.type === 'line' || m.type === 'bar' || m.type === 'grouped-bar')\n .map(m => m.id);\n const stackedBarMetricIDs = metrics.filter(m => m.type === 'stacked-bar').map(m => m.id);\n\n if (!maxRange) {\n maxRange = values.reduce(\n (sum, metricValues) =>\n lineBarMetricIDs.includes(metricValues.metricId)\n ? Math.max(\n sum,\n metricValues.values.reduce((acc, v) => Math.max(acc, v), 0)\n )\n : sum,\n 0\n );\n }\n\n if (stackedBarMetricIDs.length) {\n const stackChartMetricValues = values\n .filter(metricValues => stackedBarMetricIDs.includes(metricValues.metricId))\n .map(metric => metric.values);\n\n const summedStackedMetrics = stackChartMetricValues[0]?.map((value, i) =>\n stackChartMetricValues.reduce((sum, metricValues) => sum + metricValues[i], 0)\n );\n\n if (summedStackedMetrics?.length) {\n maxRange = Math.max(...summedStackedMetrics, maxRange);\n }\n }\n\n if (!maxRange) {\n if (!lineBarMetricIDs.length && !stackedBarMetricIDs.length) {\n return undefined;\n }\n\n maxRange = 10;\n }\n\n maxRange = Math.max(maxRange, 10);\n\n if (format === 'moneyShort' && maxRange > 1000 && maxRange < 10000) {\n maxRange = 10000;\n }\n\n const sums = [];\n const step = maxRange / 10;\n const formatter = getFormatter(format);\n\n for (let i = 0; i < 10; i++) {\n sums.push(formatter(maxRange - i * step));\n }\n\n const width = title ? 64 : 48;\n\n return { maxRange, maxValue: 1.1 * maxRange, title: title ?? '', values: sums, width };\n};\n\n@injectable()\nexport class LineChartStore {\n @observable isInit = false;\n @observable display: LineChartDisplay = defaultDisplay();\n @observable metrics: ChartMetric[] = [];\n @observable periods: LineChartPeriod[] = [];\n @observable resolution: LineChartResolution = 'day';\n\n @observable left?: SideMetricsSettings;\n @observable right?: SideMetricsSettings;\n\n @observable hoveredIndex = -1;\n\n constructor() {\n makeObservable(this);\n }\n\n @action init = (props: LineChartProps) => {\n this.display = {\n ...defaultDisplay(),\n ...(props.display ?? {}),\n };\n\n this.metrics = props.metrics.map(m => {\n const mv = props.metricValues.find(mv => mv.metricId === m.id);\n\n return {\n ...m,\n isRight: !!m.isRight,\n type: m.type ?? 'line',\n opts: m.opts ?? {},\n values: mv?.values ?? [],\n valuesOpts: mv?.opts,\n };\n });\n\n this.left = getSideMetricsSettings(\n this.metrics.filter(m => !m.isRight),\n props.metricValues,\n props.maxRange,\n props.titleY,\n this.display.yLeftFormat\n );\n this.right = getSideMetricsSettings(\n this.metrics.filter(m => m.isRight),\n props.metricValues,\n props.maxRangeRight,\n props.titleYRight,\n this.display.yRightFormat\n );\n\n this.resolution = props.resolution;\n this.periods = props.periods || [];\n this.hoveredIndex = -1;\n this.isInit = true;\n };\n\n @action setHoveredIndex = (index: number, isHovered: boolean) => {\n if (isHovered) {\n this.hoveredIndex = index;\n } else if (index === this.hoveredIndex) {\n this.hoveredIndex = -1;\n }\n };\n}\n"],"names":["injectable","action","observable","makeObservable","defaultDisplay","getFormatter","getSideMetricsSettings","metrics","values","range","title","format","maxRange","lineBarMetricIDs","filter","m","type","map","id","stackedBarMetricIDs","reduce","sum","metricValues","includes","metricId","Math","max","acc","v","length","stackChartMetricValues","metric","summedStackedMetrics","value","i","undefined","sums","step","formatter","push","width","maxValue","LineChartStore","isInit","display","periods","resolution","left","right","hoveredIndex","init","props","mv","find","isRight","opts","valuesOpts","titleY","yLeftFormat","maxRangeRight","titleYRight","yRightFormat","setHoveredIndex","index","isHovered"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,MAAM,EAAEC,UAAU,EAAEC,cAAc,QAAQ,OAAO;A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S,CAAC,CAACvC,EAAEuC,OAAO;oBACpBtC,MAAMD,CAAAA,UAAAA,EAAEC,IAAI,cAAND,qBAAAA,UAAU;oBAChBwC,MAAMxC,CAAAA,UAAAA,EAAEwC,IAAI,cAANxC,qBAAAA,UAAU,CAAC;oBACjBP,QAAQ4C,CAAAA,aAAAA,eAAAA,yBAAAA,GAAI5C,MAAM,cAAV4C,wBAAAA,aAAc,EAAE;oBACxBI,UAAU,EAAEJ,eAAAA,yBAAAA,GAAIG,IAAI;gBACxB;YACJ;YAEA,IAAI,CAACR,IAAI,GAAGzC,uBACR,IAAI,CAACC,OAAO,CAACO,MAAM,CAACC,CAAAA,IAAK,CAACA,EAAEuC,OAAO,GACnCH,MAAM7B,YAAY,EAClB6B,MAAMvC,QAAQ,EACduC,MAAMM,MAAM,EACZ,IAAI,CAACb,OAAO,CAACc,WAAW;YAE5B,IAAI,CAACV,KAAK,GAAG1C,uBACT,IAAI,CAACC,OAAO,CAACO,MAAM,CAACC,CAAAA,IAAKA,EAAEuC,OAAO,GAClCH,MAAM7B,YAAY,EAClB6B,MAAMQ,aAAa,EACnBR,MAAMS,WAAW,EACjB,IAAI,CAAChB,OAAO,CAACiB,YAAY;YAG7B,IAAI,CAACf,UAAU,GAAGK,MAAML,UAAU;YAClC,IAAI,CAACD,OAAO,GAAGM,MAAMN,OAAO,IAAI,EAAE;YAClC,IAAI,CAACI,YAAY,GAAG,CAAC;YACrB,IAAI,CAACN,MAAM,GAAG;QAClB;QAEA,uBAAQmB,mBAAkB,CAACC,OAAeC;YACtC,IAAIA,WAAW;gBACX,IAAI,CAACf,YAAY,GAAGc;YACxB,OAAO,IAAIA,UAAU,IAAI,CAACd,YAAY,EAAE;gBACpC,IAAI,CAACA,YAAY,GAAG,CAAC;YACzB;QACJ;QAjDI9C,eAAe,IAAI;IACvB;AAiDJ"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/line-chart/stores/line-chart.store.ts"],"sourcesContent":["import { injectable } from '@servicetitan/react-ioc';\nimport { action, observable, makeObservable, computed } from 'mobx';\nimport type {\n LineChartDisplay,\n LineChartDisplayValueFormat,\n LineChartMetricValues,\n LineChartPeriod,\n LineChartProps,\n LineChartResolution,\n} from '../utils/interfaces';\nimport { defaultDisplay } from '../utils/const';\nimport type { ChartMetric, SideMetricsSettings } from '../utils/internal-interfaces';\nimport { getFormatter } from '../utils/formatters';\n\nconst getSideMetricsSettings = (\n metrics: ChartMetric[],\n values: LineChartMetricValues[],\n range?: number,\n title?: string,\n format?: LineChartDisplayValueFormat\n): SideMetricsSettings | undefined => {\n let maxRange = range ?? 0;\n const lineBarMetricIDs = metrics\n .filter(m => m.type === 'line' || m.type === 'bar' || m.type === 'grouped-bar')\n .map(m => m.id);\n const stackedBarMetricIDs = metrics.filter(m => m.type === 'stacked-bar').map(m => m.id);\n\n if (!maxRange) {\n maxRange = values.reduce(\n (sum, metricValues) =>\n lineBarMetricIDs.includes(metricValues.metricId)\n ? Math.max(\n sum,\n metricValues.values.reduce((acc, v) => Math.max(acc, v), 0)\n )\n : sum,\n 0\n );\n }\n\n if (stackedBarMetricIDs.length) {\n const stackChartMetricValues = values\n .filter(metricValues => stackedBarMetricIDs.includes(metricValues.metricId))\n .map(metric => metric.values);\n\n const summedStackedMetrics = stackChartMetricValues[0]?.map((value, i) =>\n stackChartMetricValues.reduce((sum, metricValues) => sum + metricValues[i], 0)\n );\n\n if (summedStackedMetrics?.length) {\n maxRange = Math.max(...summedStackedMetrics, maxRange);\n }\n }\n\n if (!maxRange) {\n if (!lineBarMetricIDs.length && !stackedBarMetricIDs.length) {\n return undefined;\n }\n\n maxRange = 10;\n }\n\n maxRange = Math.max(maxRange, 10);\n\n if (format === 'moneyShort' && maxRange > 1000 && maxRange < 10000) {\n maxRange = 10000;\n }\n\n const sums = [];\n const step = maxRange / 10;\n const formatter = getFormatter(format);\n\n for (let i = 0; i < 10; i++) {\n sums.push(formatter(maxRange - i * step));\n }\n\n const width = title ? 64 : 48;\n\n return { maxRange, maxValue: 1.1 * maxRange, title: title ?? '', values: sums, width };\n};\n\n@injectable()\nexport class LineChartStore {\n @observable isInit = false;\n @observable display: LineChartDisplay = defaultDisplay();\n @observable metrics: ChartMetric[] = [];\n @observable periods: LineChartPeriod[] = [];\n @observable resolution: LineChartResolution = 'day';\n @observable totalMetricName?: string;\n\n @observable left?: SideMetricsSettings;\n @observable right?: SideMetricsSettings;\n\n @observable hoveredIndex = -1;\n\n @computed get stackedTotals(): number[] | undefined {\n const stackedSeries = this.metrics.filter(m => m.type === 'stacked-bar');\n if (stackedSeries.length === 0) {\n return undefined;\n }\n const length = Math.max(this.periods.length, ...stackedSeries.map(s => s.values.length));\n if (length === 0) {\n return [];\n }\n\n const totals = Array.from({ length }, () => 0);\n\n for (let i = 0; i < length; i++) {\n for (const s of stackedSeries) {\n const v = s.values[i];\n totals[i] += !Number.isNaN(v) ? v : 0;\n }\n }\n\n return totals;\n }\n\n get totalLabel(): string {\n return this.totalMetricName ?? 'Total';\n }\n\n constructor() {\n makeObservable(this);\n }\n\n @action init = (props: LineChartProps) => {\n this.display = {\n ...defaultDisplay(),\n ...(props.display ?? {}),\n };\n\n this.metrics = props.metrics.map(m => {\n const mv = props.metricValues.find(mv => mv.metricId === m.id);\n\n return {\n ...m,\n isRight: !!m.isRight,\n type: m.type ?? 'line',\n opts: m.opts ?? {},\n values: mv?.values ?? [],\n valuesOpts: mv?.opts,\n };\n });\n\n this.left = getSideMetricsSettings(\n this.metrics.filter(m => !m.isRight),\n props.metricValues,\n props.maxRange,\n props.titleY,\n this.display.yLeftFormat\n );\n this.right = getSideMetricsSettings(\n this.metrics.filter(m => m.isRight),\n props.metricValues,\n props.maxRangeRight,\n props.titleYRight,\n this.display.yRightFormat\n );\n\n this.resolution = props.resolution;\n this.totalMetricName = props.totalMetricName;\n this.periods = props.periods || [];\n this.hoveredIndex = -1;\n this.isInit = true;\n };\n\n @action setHoveredIndex = (index: number, isHovered: boolean) => {\n if (isHovered) {\n this.hoveredIndex = index;\n } else if (index === this.hoveredIndex) {\n this.hoveredIndex = -1;\n }\n };\n\n formattedTotalAt = (index: number): string => {\n const formatter = getFormatter(this.display.yLeftFormat);\n return formatter(this.totalAt(index));\n };\n\n private totalAt = (index: number): number =>\n this.stackedTotals && index >= 0 && index < this.stackedTotals.length\n ? this.stackedTotals[index]\n : 0;\n}\n"],"names":["injectable","action","observable","makeObservable","computed","defaultDisplay","getFormatter","getSideMetricsSettings","metrics","values","range","title","format","maxRange","lineBarMetricIDs","filter","m","type","map","id","stackedBarMetricIDs","reduce","sum","metricValues","includes","metricId","Math","max","acc","v","length","stackChartMetricValues","metric","summedStackedMetrics","value","i","undefined","sums","step","formatter","push","width","maxValue","LineChartStore","stackedTotals","stackedSeries","periods","s","totals","Array","from","Number","isNaN","totalLabel","totalMetricName","isInit","display","resolution","left","right","hoveredIndex","init","props","mv","find","isRight","opts","valuesOpts","titleY","yLeftFormat","maxRangeRight","titleYRight","yRightFormat","setHoveredIndex","index","isHovered","formattedTotalAt","totalAt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,MAAM,EAAEC,UAAU,EAAEC,cAAc,EAAEC,QAAQ,QAAQ,OAAO;AASpE,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,SAASC,YAAY,QAAQ,sBAAsB;AAEnD,MAAMC,yBAAyB,CAC3BC,SACAC,QACAC,OACAC,OACAC;IAEA,IAAIC,WAAWH,kBAAAA,mBAAAA,QAAS;IACxB,MAAMI,mBAAmBN,QACpBO,MAAM,CAACC,CAAAA,IAAKA,EAAEC,IAAI,KAAK,UAAUD,EAAEC,IAAI,KAAK,SAASD,EAAEC,IAAI,KAAK,eAChEC,GAAG,CAACF,CAAAA,IAAKA,EAAEG,EAAE;IAClB,MAAMC,sBAAsBZ,QAAQO,MAAM,CAACC,CAAAA,IAAKA,EAAEC,IAAI,KAAK,eAAeC,GAAG,CAACF,CAAAA,IAAKA,EAAEG,EAA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YAClC,IAAI,CAACc,YAAY,GAAG,CAAC;YACrB,IAAI,CAACL,MAAM,GAAG;QAClB;QAEA,uBAAQkB,mBAAkB,CAACC,OAAeC;YACtC,IAAIA,WAAW;gBACX,IAAI,CAACf,YAAY,GAAGc;YACxB,OAAO,IAAIA,UAAU,IAAI,CAACd,YAAY,EAAE;gBACpC,IAAI,CAACA,YAAY,GAAG,CAAC;YACzB;QACJ;QAEAgB,uBAAAA,oBAAmB,CAACF;YAChB,MAAMnC,YAAYjC,aAAa,IAAI,CAACkD,OAAO,CAACa,WAAW;YACvD,OAAO9B,UAAU,IAAI,CAACsC,OAAO,CAACH;QAClC;QAEA,uBAAQG,WAAU,CAACH,QACf,IAAI,CAAC9B,aAAa,IAAI8B,SAAS,KAAKA,QAAQ,IAAI,CAAC9B,aAAa,CAACd,MAAM,GAC/D,IAAI,CAACc,aAAa,CAAC8B,MAAM,GACzB;QA5DNvE,eAAe,IAAI;IACvB;AA4DJ"}
|
|
@@ -4,6 +4,9 @@ export type LineChartMetricType = 'line' | 'bar' | 'stacked-bar' | 'grouped-bar'
|
|
|
4
4
|
export type LineChartMetricsTitlePosition = 'top' | 'top-right' | 'bottom';
|
|
5
5
|
export interface LineChartMetricOpts {
|
|
6
6
|
dashed?: boolean;
|
|
7
|
+
strokeColor?: string;
|
|
8
|
+
outlineColor?: string;
|
|
9
|
+
pattern?: 'solid' | 'striped' | 'outline';
|
|
7
10
|
}
|
|
8
11
|
export interface LineChartMetric {
|
|
9
12
|
id: number;
|
|
@@ -31,6 +34,7 @@ export interface LineChartData {
|
|
|
31
34
|
periods: LineChartPeriod[];
|
|
32
35
|
metricValues: LineChartMetricValues[];
|
|
33
36
|
resolution: LineChartResolution;
|
|
37
|
+
totalMetricName?: string;
|
|
34
38
|
}
|
|
35
39
|
export type LineChartDisplayValueFormatterName = 'number' | 'money' | 'moneyShort';
|
|
36
40
|
export type LineChartDisplayValueFormatter = (val: number) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/utils/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,aAAa,GAAG,aAAa,CAAC;AACjF,MAAM,MAAM,6BAA6B,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3E,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/line-chart/utils/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,aAAa,GAAG,aAAa,CAAC;AACjF,MAAM,MAAM,6BAA6B,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3E,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,mBAAmB,C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AAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/line-chart/utils/interfaces.ts"],"sourcesContent":["import { ReactElement } from 'react';\n\nexport type LineChartResolution = 'hour' | 'day' | 'week' | 'month';\nexport type LineChartMetricType = 'line' | 'bar' | 'stacked-bar' | 'grouped-bar';\nexport type LineChartMetricsTitlePosition = 'top' | 'top-right' | 'bottom';\n\nexport interface LineChartMetricOpts {\n dashed?: boolean;\n}\n\nexport interface LineChartMetric {\n id: number;\n color: string;\n title: string;\n opacity?: number;\n isRight?: boolean;\n type?: LineChartMetricType;\n opts?: LineChartMetricOpts;\n}\n\nexport interface LineChartPeriod {\n from: Date;\n to?: Date;\n partial?: boolean;\n}\n\nexport type LineChartMetricValueOpts =\n | undefined\n | {\n color?: string;\n };\n\nexport interface LineChartMetricValues {\n metricId: number;\n values: number[];\n opts?: LineChartMetricValueOpts[];\n}\n\nexport interface LineChartData {\n periods: LineChartPeriod[];\n metricValues: LineChartMetricValues[];\n resolution: LineChartResolution;\n}\n\nexport type LineChartDisplayValueFormatterName = 'number' | 'money' | 'moneyShort';\nexport type LineChartDisplayValueFormatter = (val: number) => string;\nexport type LineChartDisplayValueFormat =\n | LineChartDisplayValueFormatter\n | LineChartDisplayValueFormatterName;\n\nexport interface LineChartDisplay {\n xLabels: boolean;\n yGrid: boolean;\n yLeft: boolean;\n yRight: boolean;\n yLeftFormat?: LineChartDisplayValueFormat;\n yRightFormat?: LineChartDisplayValueFormat;\n metricsTitlePosition?: LineChartMetricsTitlePosition;\n metricsLeftFormat?: LineChartDisplayValueFormat;\n metricsRightFormat?: LineChartDisplayValueFormat;\n}\n\nexport interface LineChartProps extends LineChartData {\n maxRange?: number;\n titleY?: string;\n maxRangeRight?: number;\n titleYRight?: string;\n\n metrics: LineChartMetric[];\n from?: Date;\n display?: Partial<LineChartDisplay>;\n className?: string;\n classNameTitle?: string;\n}\n\nexport interface LineChartCardProps extends LineChartProps {\n title: string;\n headerRight?: ReactElement;\n loading?: boolean;\n grayControls?: boolean;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/line-chart/utils/interfaces.ts"],"sourcesContent":["import { ReactElement } from 'react';\n\nexport type LineChartResolution = 'hour' | 'day' | 'week' | 'month';\nexport type LineChartMetricType = 'line' | 'bar' | 'stacked-bar' | 'grouped-bar';\nexport type LineChartMetricsTitlePosition = 'top' | 'top-right' | 'bottom';\n\nexport interface LineChartMetricOpts {\n dashed?: boolean;\n strokeColor?: string;\n outlineColor?: string;\n pattern?: 'solid' | 'striped' | 'outline';\n}\n\nexport interface LineChartMetric {\n id: number;\n color: string;\n title: string;\n opacity?: number;\n isRight?: boolean;\n type?: LineChartMetricType;\n opts?: LineChartMetricOpts;\n}\n\nexport interface LineChartPeriod {\n from: Date;\n to?: Date;\n partial?: boolean;\n}\n\nexport type LineChartMetricValueOpts =\n | undefined\n | {\n color?: string;\n };\n\nexport interface LineChartMetricValues {\n metricId: number;\n values: number[];\n opts?: LineChartMetricValueOpts[];\n}\n\nexport interface LineChartData {\n periods: LineChartPeriod[];\n metricValues: LineChartMetricValues[];\n resolution: LineChartResolution;\n totalMetricName?: string;\n}\n\nexport type LineChartDisplayValueFormatterName = 'number' | 'money' | 'moneyShort';\nexport type LineChartDisplayValueFormatter = (val: number) => string;\nexport type LineChartDisplayValueFormat =\n | LineChartDisplayValueFormatter\n | LineChartDisplayValueFormatterName;\n\nexport interface LineChartDisplay {\n xLabels: boolean;\n yGrid: boolean;\n yLeft: boolean;\n yRight: boolean;\n yLeftFormat?: LineChartDisplayValueFormat;\n yRightFormat?: LineChartDisplayValueFormat;\n metricsTitlePosition?: LineChartMetricsTitlePosition;\n metricsLeftFormat?: LineChartDisplayValueFormat;\n metricsRightFormat?: LineChartDisplayValueFormat;\n}\n\nexport interface LineChartProps extends LineChartData {\n maxRange?: number;\n titleY?: string;\n maxRangeRight?: number;\n titleYRight?: string;\n\n metrics: LineChartMetric[];\n from?: Date;\n display?: Partial<LineChartDisplay>;\n className?: string;\n classNameTitle?: string;\n}\n\nexport interface LineChartCardProps extends LineChartProps {\n title: string;\n headerRight?: ReactElement;\n loading?: boolean;\n grayControls?: boolean;\n}\n"],"names":[],"mappings":"AA+EA,WAKC"}
|
|
@@ -93,7 +93,7 @@ export const getXLabels = (periods, resolution, width)=>{
|
|
|
93
93
|
};
|
|
94
94
|
export const periodDateTitleFormatter = {
|
|
95
95
|
hour: (period)=>moment(period.from).format('MM/DD') + ' ' + moment(period.from).format('HH:mm') + ' - ' + moment(period.to).format('HH:mm'),
|
|
96
|
-
day: (period)=>moment(period.from).format('
|
|
96
|
+
day: (period)=>moment(period.from).format('MMM DD, YYYY'),
|
|
97
97
|
month: (period)=>moment(period.from).format('MMMM YYYY'),
|
|
98
98
|
week: (period)=>moment(period.from).format('MM/DD/YYYY') + '-' + moment(period.to).format('MM/DD/YYYY')
|
|
99
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/line-chart/utils/labels.ts"],"sourcesContent":["import moment from 'moment';\nimport { LineChartPeriod, LineChartResolution } from './interfaces';\nimport { ChartXLabels } from './internal-interfaces';\n\nconst xLabelFormats = {\n hour: 'HH:mm',\n day: 'MM/DD',\n month: 'MMM',\n};\n\nexport const getXLabels = (\n periods: LineChartPeriod[],\n resolution: LineChartResolution,\n width: number\n): ChartXLabels => {\n let labels: [string, number][] = [];\n\n if (resolution === 'hour') {\n if (width / periods.length < 76) {\n let day = -1;\n\n for (const p of periods) {\n const d = p.from.getDay();\n\n if (d === day) {\n labels[labels.length - 1][1]++;\n\n continue;\n }\n\n day = d;\n labels.push([moment(p.from).format(xLabelFormats.day), 1]);\n }\n } else {\n labels = periods.map(p => [\n moment(p.from).format(xLabelFormats.hour) +\n ' - ' +\n moment(p.to ?? p.from).format(xLabelFormats.hour),\n 1,\n ]);\n }\n } else if (resolution === 'day') {\n if (width / periods.length < 40) {\n let month = -1;\n\n for (const p of periods) {\n const m = p.from.getMonth();\n\n if (m === month) {\n labels[labels.length - 1][1]++;\n\n continue;\n }\n\n month = m;\n labels.push([moment(p.from).format(xLabelFormats.month), 1]);\n }\n } else {\n labels = periods.map(p => [moment(p.from).format(xLabelFormats.day), 1]);\n }\n } else if (resolution === 'week') {\n if (width / periods.length < 76) {\n let month = -1;\n\n for (const p of periods) {\n const m = p.from.getMonth();\n\n if (m === month || (month > 0 && p.from.getDate() < 4)) {\n labels[labels.length - 1][1]++;\n\n continue;\n }\n\n if (p.to && p.to.getDate() > 3) {\n month = p.to.getMonth();\n labels.push([moment(p.to).format(xLabelFormats.month), 1]);\n } else {\n month = m;\n labels.push([moment(p.from).format(xLabelFormats.month), 1]);\n }\n }\n } else {\n labels = periods.map(p => [\n moment(p.from).format(xLabelFormats.day) +\n ' - ' +\n moment(p.to ?? p.from).format(xLabelFormats.day),\n 1,\n ]);\n }\n } else if (resolution === 'month') {\n labels = periods.map(p => [moment(p.from).format(xLabelFormats.month), 1]);\n }\n\n return labels;\n};\n\nexport const periodDateTitleFormatter: Record<\n LineChartResolution,\n (period: LineChartPeriod) => string\n> = {\n hour: period =>\n moment(period.from).format('MM/DD') +\n ' ' +\n moment(period.from).format('HH:mm') +\n ' - ' +\n moment(period.to).format('HH:mm'),\n day: period => moment(period.from).format('
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/line-chart/utils/labels.ts"],"sourcesContent":["import moment from 'moment';\nimport { LineChartPeriod, LineChartResolution } from './interfaces';\nimport { ChartXLabels } from './internal-interfaces';\n\nconst xLabelFormats = {\n hour: 'HH:mm',\n day: 'MM/DD',\n month: 'MMM',\n};\n\nexport const getXLabels = (\n periods: LineChartPeriod[],\n resolution: LineChartResolution,\n width: number\n): ChartXLabels => {\n let labels: [string, number][] = [];\n\n if (resolution === 'hour') {\n if (width / periods.length < 76) {\n let day = -1;\n\n for (const p of periods) {\n const d = p.from.getDay();\n\n if (d === day) {\n labels[labels.length - 1][1]++;\n\n continue;\n }\n\n day = d;\n labels.push([moment(p.from).format(xLabelFormats.day), 1]);\n }\n } else {\n labels = periods.map(p => [\n moment(p.from).format(xLabelFormats.hour) +\n ' - ' +\n moment(p.to ?? p.from).format(xLabelFormats.hour),\n 1,\n ]);\n }\n } else if (resolution === 'day') {\n if (width / periods.length < 40) {\n let month = -1;\n\n for (const p of periods) {\n const m = p.from.getMonth();\n\n if (m === month) {\n labels[labels.length - 1][1]++;\n\n continue;\n }\n\n month = m;\n labels.push([moment(p.from).format(xLabelFormats.month), 1]);\n }\n } else {\n labels = periods.map(p => [moment(p.from).format(xLabelFormats.day), 1]);\n }\n } else if (resolution === 'week') {\n if (width / periods.length < 76) {\n let month = -1;\n\n for (const p of periods) {\n const m = p.from.getMonth();\n\n if (m === month || (month > 0 && p.from.getDate() < 4)) {\n labels[labels.length - 1][1]++;\n\n continue;\n }\n\n if (p.to && p.to.getDate() > 3) {\n month = p.to.getMonth();\n labels.push([moment(p.to).format(xLabelFormats.month), 1]);\n } else {\n month = m;\n labels.push([moment(p.from).format(xLabelFormats.month), 1]);\n }\n }\n } else {\n labels = periods.map(p => [\n moment(p.from).format(xLabelFormats.day) +\n ' - ' +\n moment(p.to ?? p.from).format(xLabelFormats.day),\n 1,\n ]);\n }\n } else if (resolution === 'month') {\n labels = periods.map(p => [moment(p.from).format(xLabelFormats.month), 1]);\n }\n\n return labels;\n};\n\nexport const periodDateTitleFormatter: Record<\n LineChartResolution,\n (period: LineChartPeriod) => string\n> = {\n hour: period =>\n moment(period.from).format('MM/DD') +\n ' ' +\n moment(period.from).format('HH:mm') +\n ' - ' +\n moment(period.to).format('HH:mm'),\n day: period => moment(period.from).format('MMM DD, YYYY'),\n month: period => moment(period.from).format('MMMM YYYY'),\n week: period =>\n moment(period.from).format('MM/DD/YYYY') + '-' + moment(period.to).format('MM/DD/YYYY'),\n};\n"],"names":["moment","xLabelFormats","hour","day","month","getXLabels","periods","resolution","width","labels","length","p","d","from","getDay","push","format","map","to","m","getMonth","getDate","periodDateTitleFormatter","period","week"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAI5B,MAAMC,gBAAgB;IAClBC,MAAM;IACNC,KAAK;IACLC,OAAO;AACX;AAEA,OAAO,MAAMC,aAAa,CACtBC,SACAC,YACAC;IAEA,IAAIC,SAA6B,EAAE;IAEnC,IAAIF,eAAe,QAAQ;QACvB,IAAIC,QAAQF,QAAQI,MAAM,GAAG,IAAI;YAC7B,IAAIP,MAAM,CAAC;YAEX,KAAK,MAAMQ,KAAKL,QAAS;gBACrB,MAAMM,IAAID,EAAEE,IAAI,CAACC,MAAM;gBAEvB,IAAIF,MAAMT,KAAK;oBACXM,MAAM,CAACA,OAAOC,MAAM,GAAG,EAAE,CAAC,EAAE;oBAE5B;gBACJ;gBAEAP,MAAMS;gBACNH,OAAOM,IAAI,CAAC;oBAACf,OAAOW,EAAEE,IAAI,EAAEG,MAAM,CAACf,cAAcE,GAAG;oBAAG;iBAAE;YAC7D;QACJ,OAAO;YACHM,SAASH,QAAQW,GAAG,CAACN,CAAAA;oBAGNA;uBAHW;oBACtBX,OAAOW,EAAEE,IAAI,EAAEG,MAAM,CAACf,cAAcC,IAAI,IACpC,QACAF,OAAOW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7D,OAAO;oBACHA,QAAQe;oBACRV,OAAOM,IAAI,CAAC;wBAACf,OAAOW,EAAEE,IAAI,EAAEG,MAAM,CAACf,cAAcG,KAAK;wBAAG;qBAAE;gBAC/D;YACJ;QACJ,OAAO;YACHK,SAASH,QAAQW,GAAG,CAACN,CAAAA;oBAGNA;uBAHW;oBACtBX,OAAOW,EAAEE,IAAI,EAAEG,MAAM,CAACf,cAAcE,GAAG,IACnC,QACAH,OAAOW,CAAAA,QAAAA,EAAEO,EAAE,cAAJP,mBAAAA,QAAQA,EAAEE,IAAI,EAAEG,MAAM,CAACf,cAAcE,GAAG;oBACnD;iBACH;;QACL;IACJ,OAAO,IAAII,eAAe,SAAS;QAC/BE,SAASH,QAAQW,GAAG,CAACN,CAAAA,IAAK;gBAACX,OAAOW,EAAEE,IAAI,EAAEG,MAAM,CAACf,cAAcG,KAAK;gBAAG;aAAE;IAC7E;IAEA,OAAOK;AACX,EAAE;AAEF,OAAO,MAAMa,2BAGT;IACApB,MAAMqB,CAAAA,SACFvB,OAAOuB,OAAOV,IAAI,EAAEG,MAAM,CAAC,WAC3B,MACAhB,OAAOuB,OAAOV,IAAI,EAAEG,MAAM,CAAC,WAC3B,QACAhB,OAAOuB,OAAOL,EAAE,EAAEF,MAAM,CAAC;IAC7Bb,KAAKoB,CAAAA,SAAUvB,OAAOuB,OAAOV,IAAI,EAAEG,MAAM,CAAC;IAC1CZ,OAAOmB,CAAAA,SAAUvB,OAAOuB,OAAOV,IAAI,EAAEG,MAAM,CAAC;IAC5CQ,MAAMD,CAAAA,SACFvB,OAAOuB,OAAOV,IAAI,EAAEG,MAAM,CAAC,gBAAgB,MAAMhB,OAAOuB,OAAOL,EAAE,EAAEF,MAAM,CAAC;AAClF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/pie-chart/components/pie-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/pie-chart/components/pie-chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAY,MAAM,oBAAoB,CAAC;AAoC7D,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAiCtC,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
3
|
import { BodyText, Stack, StatusLight } from '@servicetitan/design-system';
|
|
5
4
|
import { convertSessionsToPieces, radiusRelativeDefault } from '../utils/const';
|
|
6
5
|
import { Pie } from './pie';
|
|
6
|
+
import { Flex } from '@servicetitan/anvil2';
|
|
7
|
+
import classNames from 'classnames';
|
|
7
8
|
import * as Styles from './pie-chart.module.less';
|
|
9
|
+
import { ColorTag } from '../../common';
|
|
8
10
|
const PieTitles = ({ title, pieces })=>{
|
|
9
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
11
|
+
return pieces.length > 2 ? /*#__PURE__*/ _jsx("div", {
|
|
10
12
|
className: classNames(Styles.titleWrapper, 'of-y-auto p-t-2'),
|
|
11
13
|
children: /*#__PURE__*/ _jsxs("div", {
|
|
12
14
|
children: [
|
|
@@ -32,6 +34,13 @@ const PieTitles = ({ title, pieces })=>{
|
|
|
32
34
|
}, piece.title))
|
|
33
35
|
]
|
|
34
36
|
})
|
|
37
|
+
}) : /*#__PURE__*/ _jsx(Flex, {
|
|
38
|
+
direction: "row",
|
|
39
|
+
gap: 8,
|
|
40
|
+
children: pieces.map((piece)=>/*#__PURE__*/ _jsx(ColorTag, {
|
|
41
|
+
label: piece.title,
|
|
42
|
+
color: piece.color
|
|
43
|
+
}, piece.title))
|
|
35
44
|
});
|
|
36
45
|
};
|
|
37
46
|
export const PieChart = ({ height, width, title, sections, popoverContent, content, radiusRelative = radiusRelativeDefault, popoverDirection = 'rb', hideTitles = false })=>{
|
|
@@ -46,18 +55,20 @@ export const PieChart = ({ height, width, title, sections, popoverContent, conte
|
|
|
46
55
|
height,
|
|
47
56
|
width
|
|
48
57
|
]);
|
|
49
|
-
return /*#__PURE__*/ _jsxs(
|
|
50
|
-
|
|
51
|
-
style: style,
|
|
58
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
59
|
+
direction: pieces.length > 2 ? 'row' : 'column',
|
|
52
60
|
children: [
|
|
53
|
-
/*#__PURE__*/ _jsx(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
/*#__PURE__*/ _jsx("div", {
|
|
62
|
+
style: style,
|
|
63
|
+
children: /*#__PURE__*/ _jsx(Pie, {
|
|
64
|
+
title: title,
|
|
65
|
+
pieces: pieces,
|
|
66
|
+
content: content,
|
|
67
|
+
popoverContent: popoverContent,
|
|
68
|
+
popoverDirection: popoverDirection,
|
|
69
|
+
radiusRelative: radiusRelative,
|
|
70
|
+
hideTitles: hideTitles
|
|
71
|
+
})
|
|
61
72
|
}),
|
|
62
73
|
!hideTitles && /*#__PURE__*/ _jsx(PieTitles, {
|
|
63
74
|
title: title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/charts/pie-chart/components/pie-chart.tsx"],"sourcesContent":["import { useMemo, FC } from 'react';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/charts/pie-chart/components/pie-chart.tsx"],"sourcesContent":["import { useMemo, FC } from 'react';\nimport { BodyText, Stack, StatusLight } from '@servicetitan/design-system';\nimport { PieChartProps, PiePiece } from '../utils/interface';\nimport { convertSessionsToPieces, radiusRelativeDefault } from '../utils/const';\nimport { Pie } from './pie';\nimport { Flex } from '@servicetitan/anvil2';\nimport classNames from 'classnames';\nimport * as Styles from './pie-chart.module.less';\nimport { ColorTag } from '../../common';\n\nconst PieTitles: FC<{ title: string; pieces: PiePiece[] }> = ({ title, pieces }) => {\n return pieces.length > 2 ? (\n <div className={classNames(Styles.titleWrapper, 'of-y-auto p-t-2')}>\n <div>\n {!!pieces.length && (\n <Stack.Item className=\"p-l-1 p-b-1\">\n <BodyText bold>{title}</BodyText>\n </Stack.Item>\n )}\n {pieces.map(piece => (\n <Stack key={piece.title} alignItems=\"center\">\n <StatusLight color={piece.color} />\n <BodyText className=\"c-neutral-90\" size=\"medium\">\n {piece.title}\n </BodyText>\n </Stack>\n ))}\n </div>\n </div>\n ) : (\n <Flex direction=\"row\" gap={8}>\n {pieces.map(piece => (\n <ColorTag key={piece.title} label={piece.title} color={piece.color} />\n ))}\n </Flex>\n );\n};\n\nexport const PieChart: FC<PieChartProps> = ({\n height,\n width,\n title,\n sections,\n popoverContent,\n content,\n radiusRelative = radiusRelativeDefault,\n popoverDirection = 'rb',\n hideTitles = false,\n}) => {\n const pieces = useMemo(\n () => convertSessionsToPieces(sections, radiusRelative),\n [sections, radiusRelative]\n );\n const style = useMemo(() => ({ height, width }), [height, width]);\n\n return (\n <Stack direction={pieces.length > 2 ? 'row' : 'column'}>\n <div style={style}>\n <Pie\n title={title}\n pieces={pieces}\n content={content}\n popoverContent={popoverContent}\n popoverDirection={popoverDirection}\n radiusRelative={radiusRelative}\n hideTitles={hideTitles}\n />\n </div>\n {!hideTitles && <PieTitles title={title} pieces={pieces} />}\n </Stack>\n );\n};\n"],"names":["useMemo","BodyText","Stack","StatusLight","convertSessionsToPieces","radiusRelativeDefault","Pie","Flex","classNames","Styles","ColorTag","PieTitles","title","pieces","length","div","className","titleWrapper","Item","bold","map","piece","alignItems","color","size","direction","gap","label","PieChart","height","width","sections","popoverContent","content","radiusRelative","popoverDirection","hideTitles","style"],"mappings":";AAAA,SAASA,OAAO,QAAY,QAAQ;AACpC,SAASC,QAAQ,EA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QC;QAAM,CAAA,GAAI;QAACD;QAAQC;KAAM;IAEhE,qBACI,MAAC5B;QAAMuB,WAAWZ,OAAOC,MAAM,GAAG,IAAI,QAAQ;;0BAC1C,KAACC;gBAAIsB,OAAOA;0BACR,cAAA,KAAC/B;oBACGM,OAAOA;oBACPC,QAAQA;oBACRoB,SAASA;oBACTD,gBAAgBA;oBAChBG,kBAAkBA;oBAClBD,gBAAgBA;oBAChBE,YAAYA;;;YAGnB,CAACA,4BAAc,KAACzB;gBAAUC,OAAOA;gBAAOC,QAAQA;;;;AAG7D,EAAE"}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
@import (reference) '@servicetitan/tokens/core/tokens.less';
|
|
2
|
+
|
|
1
3
|
.title-wrapper {
|
|
2
4
|
max-width: 120px;
|
|
3
5
|
}
|
|
6
|
+
|
|
7
|
+
.percent-text-wrapper {
|
|
8
|
+
width: 32px;
|
|
9
|
+
height: 32px;
|
|
10
|
+
border-radius: @border-radius-circular;
|
|
11
|
+
background: @color-neutral-0;
|
|
12
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
margin: @spacing-0 auto;
|
|
17
|
+
box-shadow: 0 0 0 1px @color-neutral-0 inset;
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/pie-chart/components/pie.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,EAAE,EAAY,MAAM,OAAO,CAAC;AAKrE,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"pie.d.ts","sourceRoot":"","sources":["../../../../../src/components/charts/pie-chart/components/pie.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,EAAE,EAAY,MAAM,OAAO,CAAC;AAKrE,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAsK5F,eAAO,MAAM,GAAG,EAAE,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,EAAE,CAAC;IACb,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC,CA2HA,CAAC"}
|