@kyndryl-design-system/shidoka-charts 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/config/chartTypes/bar.js.map +1 -1
- package/common/config/chartTypes/boxplot.js.map +1 -1
- package/common/config/chartTypes/bubble.js.map +1 -1
- package/common/config/chartTypes/bubbleMap.js.map +1 -1
- package/common/config/chartTypes/choropleth.js.map +1 -1
- package/common/config/chartTypes/dendrogram.js +2 -0
- package/common/config/chartTypes/dendrogram.js.map +1 -0
- package/common/config/chartTypes/doughnut.js.map +1 -1
- package/common/config/chartTypes/forceDirectedGraph.js +2 -0
- package/common/config/chartTypes/forceDirectedGraph.js.map +1 -0
- package/common/config/chartTypes/graph.js +2 -0
- package/common/config/chartTypes/graph.js.map +1 -0
- package/common/config/chartTypes/graphCommon.js +2 -0
- package/common/config/chartTypes/graphCommon.js.map +1 -0
- package/common/config/chartTypes/line.js.map +1 -1
- package/common/config/chartTypes/matrix.js.map +1 -1
- package/common/config/chartTypes/meter.js.map +1 -1
- package/common/config/chartTypes/pie.js.map +1 -1
- package/common/config/chartTypes/tree.js +2 -0
- package/common/config/chartTypes/tree.js.map +1 -0
- package/common/config/chartTypes/treemap.js.map +1 -1
- package/common/config/chartTypes/violin.js.map +1 -1
- package/common/config/globalOptions.js.map +1 -1
- package/common/config/globalOptionsNonRadial.js.map +1 -1
- package/common/config/globalOptionsRadial.js.map +1 -1
- package/common/helpers/graphTreeTableRenderer.d.ts +2 -0
- package/common/helpers/graphTreeTableRenderer.d.ts.map +1 -0
- package/common/helpers/graphTreeTableRenderer.js +30 -0
- package/common/helpers/graphTreeTableRenderer.js.map +1 -0
- package/common/helpers/helpers.d.ts +1 -0
- package/common/helpers/helpers.d.ts.map +1 -1
- package/common/helpers/helpers.js +1 -1
- package/common/helpers/helpers.js.map +1 -1
- package/common/legend/getLegendData.js.map +1 -1
- package/common/legend/htmlRenderer.js.map +1 -1
- package/common/plugins/canvasBackground.js.map +1 -1
- package/common/plugins/doughnutLabel.js.map +1 -1
- package/common/plugins/gradientLegend.js.map +1 -1
- package/common/plugins/htmlLegendPlugin.js.map +1 -1
- package/common/plugins/meterGaugeNeedle.js.map +1 -1
- package/components/chart/chart.d.ts.map +1 -1
- package/components/chart/chart.js +12 -12
- package/components/chart/chart.js.map +1 -1
- package/package.json +12 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar.js","sources":["../../../../src/common/config/chartTypes/bar.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'bar';\n\nexport const options = (ctx) => {\n const Horizontal = ctx.options.indexAxis === 'y';\n const FloatingBars = ctx.datasets.find((dataset) =>\n Array.isArray(dataset.data[0])\n );\n const Stacked = ctx.options.scales?.y?.stacked;\n\n return {\n interaction: {\n mode: Stacked ? 'index' : 'nearest',\n },\n borderRadius: 2,\n borderSkipped: FloatingBars ? false : 'start',\n scales: {\n x: {\n grid: {\n display: FloatingBars || Horizontal,\n },\n },\n y: {\n grid: {\n display: !Horizontal,\n },\n },\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: (tooltipItems) => {\n // add axis label to tooltip title\n const AxisLabel = Horizontal\n ? tooltipItems[0].chart.options.scales.y.title.text\n : tooltipItems[0].chart.options.scales.x.title.text;\n const Label = tooltipItems[0].label;\n\n return AxisLabel + ': ' + Label;\n },\n footer: (tooltipItems) => {\n // add total row\n let sum = 0;\n\n tooltipItems.forEach(function (tooltipItem) {\n sum += Horizontal ? tooltipItem.parsed.x : tooltipItem.parsed.y;\n });\n\n // Fix floating point rounding issues, show up to 2 decimals max\n const formattedSum = Math.round((sum + Number.EPSILON) * 100) / 100;\n\n return Stacked ? 'Total: ' + formattedSum : null;\n },\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const Horizontal = ctx.options.indexAxis === 'y';\n const Stacked = ctx.options.scales?.y?.stacked;\n const Datasets = ctx.datasets;\n const BarDatasets = Datasets.filter((dataset) => dataset.type !== 'line');\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const ColorCycles = Math.floor(index / (Colors.length - 1));\n const Index =\n index > Colors.length - 1\n ? index - (Colors.length - 1) * ColorCycles\n : index;\n\n return {\n backgroundColor: Colors[Index],\n borderWidth: {\n top: !Horizontal && Stacked && index < BarDatasets.length - 1 ? 2 : 0, // stacked bars 2px gap\n right: Horizontal && Stacked && index < BarDatasets.length - 1 ? 2 : 0, // stacked bars 2px gap\n bottom: 0,\n left: 0,\n },\n };\n};\n"],"names":["type","options","ctx","Horizontal","indexAxis","FloatingBars","datasets","find","dataset","Array","isArray","data","Stacked","scales","y","stacked","interaction","mode","borderRadius","borderSkipped","x","grid","display","plugins","tooltip","callbacks","title","tooltipItems","chart","text","label","footer","sum","forEach","tooltipItem","parsed","formattedSum","Math","round","Number","EPSILON","datasetOptions","index","BarDatasets","filter","Colors","getComputedColorPalette","colorPalette","ColorCycles","floor","length","backgroundColor","borderWidth","top","right","bottom","left"],"mappings":"8DAEY,MAACA,EAAO,MAEPC,EAAWC,IACtB,MAAMC,EAAuC,MAA1BD,EAAID,QAAQG,UACzBC,EAAeH,EAAII,SAASC,MAAMC,GACtCC,MAAMC,QAAQF,EAAQG,KAAK,MAEvBC,EAAUV,EAAID,QAAQY,QAAQC,GAAGC,QAEvC,MAAO,CACLC,YAAa,CACXC,KAAML,EAAU,QAAU,WAE5BM,aAAc,EACdC,eAAed,GAAuB,QACtCQ,OAAQ,CACNO,EAAG,CACDC,KAAM,CACJC,QAASjB,GAAgBF,IAG7BW,EAAG,CACDO,KAAM,CACJC,SAAUnB,KAIhBoB,QAAS,CACPC,QAAS,CACPC,UAAW,CACTC,MAAQC,IAEYxB,EACdwB,EAAa,GAAGC,MAAM3B,QAAQY,OAAOC,EAAEY,MAAMG,KAC7CF,EAAa,GAAGC,MAAM3B,QAAQY,OAAOO,EAAEM,MAAMG,MAG9B,KAFLF,EAAa,GAAGG,MAIhCC,OAASJ,IAEP,IAAIK,EAAM,EAEVL,EAAaM,SAAQ,SAAUC,GAC7BF,GAAO7B,EAAa+B,EAAYC,OAAOf,EAAIc,EAAYC,OAAOrB,
|
|
1
|
+
{"version":3,"file":"bar.js","sources":["../../../../src/common/config/chartTypes/bar.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'bar';\n\nexport const options = (ctx) => {\n const Horizontal = ctx.options.indexAxis === 'y';\n const FloatingBars = ctx.datasets.find((dataset) =>\n Array.isArray(dataset.data[0])\n );\n const Stacked = ctx.options.scales?.y?.stacked;\n\n return {\n interaction: {\n mode: Stacked ? 'index' : 'nearest',\n },\n borderRadius: 2,\n borderSkipped: FloatingBars ? false : 'start',\n scales: {\n x: {\n grid: {\n display: FloatingBars || Horizontal,\n },\n },\n y: {\n grid: {\n display: !Horizontal,\n },\n },\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: (tooltipItems) => {\n // add axis label to tooltip title\n const AxisLabel = Horizontal\n ? tooltipItems[0].chart.options.scales.y.title.text\n : tooltipItems[0].chart.options.scales.x.title.text;\n const Label = tooltipItems[0].label;\n\n return AxisLabel + ': ' + Label;\n },\n footer: (tooltipItems) => {\n // add total row\n let sum = 0;\n\n tooltipItems.forEach(function (tooltipItem) {\n sum += Horizontal ? tooltipItem.parsed.x : tooltipItem.parsed.y;\n });\n\n // Fix floating point rounding issues, show up to 2 decimals max\n const formattedSum = Math.round((sum + Number.EPSILON) * 100) / 100;\n\n return Stacked ? 'Total: ' + formattedSum : null;\n },\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const Horizontal = ctx.options.indexAxis === 'y';\n const Stacked = ctx.options.scales?.y?.stacked;\n const Datasets = ctx.datasets;\n const BarDatasets = Datasets.filter((dataset) => dataset.type !== 'line');\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const ColorCycles = Math.floor(index / (Colors.length - 1));\n const Index =\n index > Colors.length - 1\n ? index - (Colors.length - 1) * ColorCycles\n : index;\n\n return {\n backgroundColor: Colors[Index],\n borderWidth: {\n top: !Horizontal && Stacked && index < BarDatasets.length - 1 ? 2 : 0, // stacked bars 2px gap\n right: Horizontal && Stacked && index < BarDatasets.length - 1 ? 2 : 0, // stacked bars 2px gap\n bottom: 0,\n left: 0,\n },\n };\n};\n"],"names":["type","options","ctx","Horizontal","indexAxis","FloatingBars","datasets","find","dataset","Array","isArray","data","Stacked","scales","y","stacked","interaction","mode","borderRadius","borderSkipped","x","grid","display","plugins","tooltip","callbacks","title","tooltipItems","chart","text","label","footer","sum","forEach","tooltipItem","parsed","formattedSum","Math","round","Number","EPSILON","datasetOptions","index","BarDatasets","filter","Colors","getComputedColorPalette","colorPalette","ColorCycles","floor","length","backgroundColor","borderWidth","top","right","bottom","left"],"mappings":"8DAEY,MAACA,EAAO,MAEPC,EAAWC,IACtB,MAAMC,EAAuC,MAA1BD,EAAID,QAAQG,UACzBC,EAAeH,EAAII,SAASC,MAAMC,GACtCC,MAAMC,QAAQF,EAAQG,KAAK,MAEvBC,EAAUV,EAAID,QAAQY,QAAQC,GAAGC,QAEvC,MAAO,CACLC,YAAa,CACXC,KAAML,EAAU,QAAU,WAE5BM,aAAc,EACdC,eAAed,GAAuB,QACtCQ,OAAQ,CACNO,EAAG,CACDC,KAAM,CACJC,QAASjB,GAAgBF,IAG7BW,EAAG,CACDO,KAAM,CACJC,SAAUnB,KAIhBoB,QAAS,CACPC,QAAS,CACPC,UAAW,CACTC,MAAQC,IAEYxB,EACdwB,EAAa,GAAGC,MAAM3B,QAAQY,OAAOC,EAAEY,MAAMG,KAC7CF,EAAa,GAAGC,MAAM3B,QAAQY,OAAOO,EAAEM,MAAMG,MAG9B,KAFLF,EAAa,GAAGG,MAIhCC,OAASJ,IAEP,IAAIK,EAAM,EAEVL,EAAaM,SAAQ,SAAUC,GAC7BF,GAAO7B,EAAa+B,EAAYC,OAAOf,EAAIc,EAAYC,OAAOrB,CAChE,IAGA,MAAMsB,EAAeC,KAAKC,MAA+B,KAAxBN,EAAMO,OAAOC,UAAkB,IAEhE,OAAO5B,EAAU,UAAYwB,EAAe,IAAI,KAKzD,EAGUK,EAAiB,CAACvC,EAAKwC,KAClC,MAAMvC,EAAuC,MAA1BD,EAAID,QAAQG,UACzBQ,EAAUV,EAAID,QAAQY,QAAQC,GAAGC,QAEjC4B,EADWzC,EAAII,SACQsC,QAAQpC,GAA6B,SAAjBA,EAAQR,OACnD6C,EAASC,EACb5C,EAAID,QAAQ8C,cAAgB,eAExBC,EAAcX,KAAKY,MAAMP,GAASG,EAAOK,OAAS,IAMxD,MAAO,CACLC,gBAAiBN,EALjBH,EAAQG,EAAOK,OAAS,EACpBR,GAASG,EAAOK,OAAS,GAAKF,EAC9BN,GAIJU,YAAa,CACXC,KAAMlD,GAAcS,GAAW8B,EAAQC,EAAYO,OAAS,EAAI,EAAI,EACpEI,MAAOnD,GAAcS,GAAW8B,EAAQC,EAAYO,OAAS,EAAI,EAAI,EACrEK,OAAQ,EACRC,KAAM,GAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boxplot.js","sources":["../../../../src/common/config/chartTypes/boxplot.js"],"sourcesContent":["import { Chart, registerables } from 'chart.js';\nimport {\n BoxPlotController,\n BoxAndWiskers,\n} from '@sgratzl/chartjs-chart-boxplot';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\nimport { getComputedColorPalette } from '../colorPalettes';\n\nChart.register(...registerables, BoxPlotController, BoxAndWiskers);\n\nexport const type = 'boxplot';\nconst defaultBorderWidth = 1;\n\nexport const options = (ctx) => ({\n scales: {\n x: { grid: { display: ctx.options.indexAxis === 'y' } },\n y: { grid: { display: ctx.options.indexAxis !== 'y' } },\n },\n plugins: {\n legend: { display: true, position: 'bottom' },\n tooltip: {\n enabled: true,\n callbacks: {\n title: (items) => {\n const axis = ctx.options.indexAxis === 'y' ? 'y' : 'x';\n const title = items[0].chart.options.scales[axis].title?.text;\n return title ? `${title}: ${items[0].label}` : items[0].label;\n },\n },\n },\n },\n ...ctx.options,\n});\n\nexport const datasetOptions = (ctx, index) => {\n const {\n colorPalette = 'categorical',\n outlierStyle = 'circle',\n outlierRadius = 3,\n datasetOptionsOverride = {},\n } = ctx.options;\n\n const palette = getComputedColorPalette(colorPalette);\n const hex = palette[index % palette.length];\n const idxString = String(index + 1).padStart(2, '0');\n\n const match = colorPalette.match(/^([a-z]+?)(\\d{1,2})$/i);\n const base = match ? match[1] : colorPalette;\n const num = match ? match[2].padStart(2, '0') : idxString;\n\n const prefix =\n colorPalette === 'categorical'\n ? `sequential-${idxString}`\n : `${base}-${num}`;\n\n const borderToken = `--kd-color-data-viz-${prefix}-70`;\n const lowerToken = `--kd-color-data-viz-${prefix}-40`;\n const upperToken = `--kd-color-data-viz-${prefix}-20`;\n\n const borderColor = getTokenThemeVal(borderToken) || hex;\n const lowerBackgroundColor = getTokenThemeVal(lowerToken) || `${hex}40`;\n const upperBackgroundColor = getTokenThemeVal(upperToken) || `${hex}20`;\n const neutralBg = getTokenThemeVal(\n '--kd-color-data-viz-neutral-background-color'\n );\n\n return {\n borderColor,\n borderWidth: defaultBorderWidth,\n backgroundColor: upperBackgroundColor,\n lowerBackgroundColor,\n outlierStyle,\n outlierRadius,\n outlierBorderWidth: 1.5,\n outlierBackgroundColor: 'transparent',\n outlierBorderColor: borderColor,\n meanStyle: 'circle',\n meanRadius: 3,\n meanBorderWidth: defaultBorderWidth,\n meanBackgroundColor: neutralBg,\n meanBorderColor: borderColor,\n ...datasetOptionsOverride,\n };\n};\n\nexport const generateRandomData = (count, min, max, outliers = 0) => {\n const values = Array.from({ length: count }, () =>\n Math.floor(Math.random() * (max - min) + min)\n ).sort((a, b) => a - b);\n\n for (let i = 0; i < outliers; i++) {\n if (Math.random() > 0.5) {\n values.push(max + Math.floor(Math.random() * max * 0.5));\n } else {\n values.unshift(Math.max(0, min - Math.floor(Math.random() * min * 0.5)));\n }\n }\n\n return values;\n};\n"],"names":["Chart","register","registerables","BoxPlotController","BoxAndWiskers","type","options","ctx","scales","x","grid","display","indexAxis","y","plugins","legend","position","tooltip","enabled","callbacks","title","items","axis","chart","text","label","datasetOptions","index","colorPalette","outlierStyle","outlierRadius","datasetOptionsOverride","palette","getComputedColorPalette","hex","length","idxString","String","padStart","match","base","num","prefix","lowerToken","upperToken","borderColor","getTokenThemeVal","lowerBackgroundColor","borderWidth","backgroundColor","outlierBorderWidth","outlierBackgroundColor","outlierBorderColor","meanStyle","meanRadius","meanBorderWidth","meanBackgroundColor","meanBorderColor","generateRandomData","count","min","max","outliers","values","Array","from","Math","floor","random","sort","a","b","i","push","unshift"],"mappings":"0SAQAA,EAAMC,YAAYC,EAAeC,EAAmBC,GAExC,MAACC,EAAO,UAGPC,EAAWC,
|
|
1
|
+
{"version":3,"file":"boxplot.js","sources":["../../../../src/common/config/chartTypes/boxplot.js"],"sourcesContent":["import { Chart, registerables } from 'chart.js';\nimport {\n BoxPlotController,\n BoxAndWiskers,\n} from '@sgratzl/chartjs-chart-boxplot';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\nimport { getComputedColorPalette } from '../colorPalettes';\n\nChart.register(...registerables, BoxPlotController, BoxAndWiskers);\n\nexport const type = 'boxplot';\nconst defaultBorderWidth = 1;\n\nexport const options = (ctx) => ({\n scales: {\n x: { grid: { display: ctx.options.indexAxis === 'y' } },\n y: { grid: { display: ctx.options.indexAxis !== 'y' } },\n },\n plugins: {\n legend: { display: true, position: 'bottom' },\n tooltip: {\n enabled: true,\n callbacks: {\n title: (items) => {\n const axis = ctx.options.indexAxis === 'y' ? 'y' : 'x';\n const title = items[0].chart.options.scales[axis].title?.text;\n return title ? `${title}: ${items[0].label}` : items[0].label;\n },\n },\n },\n },\n ...ctx.options,\n});\n\nexport const datasetOptions = (ctx, index) => {\n const {\n colorPalette = 'categorical',\n outlierStyle = 'circle',\n outlierRadius = 3,\n datasetOptionsOverride = {},\n } = ctx.options;\n\n const palette = getComputedColorPalette(colorPalette);\n const hex = palette[index % palette.length];\n const idxString = String(index + 1).padStart(2, '0');\n\n const match = colorPalette.match(/^([a-z]+?)(\\d{1,2})$/i);\n const base = match ? match[1] : colorPalette;\n const num = match ? match[2].padStart(2, '0') : idxString;\n\n const prefix =\n colorPalette === 'categorical'\n ? `sequential-${idxString}`\n : `${base}-${num}`;\n\n const borderToken = `--kd-color-data-viz-${prefix}-70`;\n const lowerToken = `--kd-color-data-viz-${prefix}-40`;\n const upperToken = `--kd-color-data-viz-${prefix}-20`;\n\n const borderColor = getTokenThemeVal(borderToken) || hex;\n const lowerBackgroundColor = getTokenThemeVal(lowerToken) || `${hex}40`;\n const upperBackgroundColor = getTokenThemeVal(upperToken) || `${hex}20`;\n const neutralBg = getTokenThemeVal(\n '--kd-color-data-viz-neutral-background-color'\n );\n\n return {\n borderColor,\n borderWidth: defaultBorderWidth,\n backgroundColor: upperBackgroundColor,\n lowerBackgroundColor,\n outlierStyle,\n outlierRadius,\n outlierBorderWidth: 1.5,\n outlierBackgroundColor: 'transparent',\n outlierBorderColor: borderColor,\n meanStyle: 'circle',\n meanRadius: 3,\n meanBorderWidth: defaultBorderWidth,\n meanBackgroundColor: neutralBg,\n meanBorderColor: borderColor,\n ...datasetOptionsOverride,\n };\n};\n\nexport const generateRandomData = (count, min, max, outliers = 0) => {\n const values = Array.from({ length: count }, () =>\n Math.floor(Math.random() * (max - min) + min)\n ).sort((a, b) => a - b);\n\n for (let i = 0; i < outliers; i++) {\n if (Math.random() > 0.5) {\n values.push(max + Math.floor(Math.random() * max * 0.5));\n } else {\n values.unshift(Math.max(0, min - Math.floor(Math.random() * min * 0.5)));\n }\n }\n\n return values;\n};\n"],"names":["Chart","register","registerables","BoxPlotController","BoxAndWiskers","type","options","ctx","scales","x","grid","display","indexAxis","y","plugins","legend","position","tooltip","enabled","callbacks","title","items","axis","chart","text","label","datasetOptions","index","colorPalette","outlierStyle","outlierRadius","datasetOptionsOverride","palette","getComputedColorPalette","hex","length","idxString","String","padStart","match","base","num","prefix","lowerToken","upperToken","borderColor","getTokenThemeVal","lowerBackgroundColor","borderWidth","backgroundColor","outlierBorderWidth","outlierBackgroundColor","outlierBorderColor","meanStyle","meanRadius","meanBorderWidth","meanBackgroundColor","meanBorderColor","generateRandomData","count","min","max","outliers","values","Array","from","Math","floor","random","sort","a","b","i","push","unshift"],"mappings":"0SAQAA,EAAMC,YAAYC,EAAeC,EAAmBC,GAExC,MAACC,EAAO,UAGPC,EAAWC,IAAG,CACzBC,OAAQ,CACNC,EAAG,CAAEC,KAAM,CAAEC,QAAmC,MAA1BJ,EAAID,QAAQM,YAClCC,EAAG,CAAEH,KAAM,CAAEC,QAAmC,MAA1BJ,EAAID,QAAQM,aAEpCE,QAAS,CACPC,OAAQ,CAAEJ,SAAS,EAAMK,SAAU,UACnCC,QAAS,CACPC,SAAS,EACTC,UAAW,CACTC,MAAQC,IACN,MAAMC,EAAiC,MAA1Bf,EAAID,QAAQM,UAAoB,IAAM,IAC7CQ,EAAQC,EAAM,GAAGE,MAAMjB,QAAQE,OAAOc,GAAMF,OAAOI,KACzD,OAAOJ,EAAQ,GAAGA,MAAUC,EAAM,GAAGI,QAAUJ,EAAM,GAAGI,KAAK,QAKlElB,EAAID,UAGIoB,EAAiB,CAACnB,EAAKoB,KAClC,MAAMC,aACJA,EAAe,cAAaC,aAC5BA,EAAe,SAAQC,cACvBA,EAAgB,EAACC,uBACjBA,EAAyB,CAAA,GACvBxB,EAAID,QAEF0B,EAAUC,EAAwBL,GAClCM,EAAMF,EAAQL,EAAQK,EAAQG,QAC9BC,EAAYC,OAAOV,EAAQ,GAAGW,SAAS,EAAG,KAE1CC,EAAQX,EAAaW,MAAM,yBAC3BC,EAAOD,EAAQA,EAAM,GAAKX,EAC1Ba,EAAMF,EAAQA,EAAM,GAAGD,SAAS,EAAG,KAAOF,EAE1CM,EACa,gBAAjBd,EACI,cAAcQ,IACd,GAAGI,KAAQC,IAGXE,EAAa,uBAAuBD,OACpCE,EAAa,uBAAuBF,OAEpCG,EAAcC,EAJA,uBAAuBJ,SAIUR,EAC/Ca,EAAuBD,EAAiBH,IAAe,GAAGT,MAMhE,MAAO,CACLW,cACAG,YAzDuB,EA0DvBC,gBAR2BH,EAAiBF,IAAe,GAAGV,MAS9Da,uBACAlB,eACAC,gBACAoB,mBAAoB,IACpBC,uBAAwB,cACxBC,mBAAoBP,EACpBQ,UAAW,SACXC,WAAY,EACZC,gBAnEuB,EAoEvBC,oBAjBgBV,EAChB,gDAiBAW,gBAAiBZ,KACdd,EACJ,EAGU2B,EAAqB,CAACC,EAAOC,EAAKC,EAAKC,EAAW,KAC7D,MAAMC,EAASC,MAAMC,KAAK,CAAE9B,OAAQwB,IAAS,IAC3CO,KAAKC,MAAMD,KAAKE,UAAYP,EAAMD,GAAOA,KACzCS,MAAK,CAACC,EAAGC,IAAMD,EAAIC,IAErB,IAAK,IAAIC,EAAI,EAAGA,EAAIV,EAAUU,IACxBN,KAAKE,SAAW,GAClBL,EAAOU,KAAKZ,EAAMK,KAAKC,MAAMD,KAAKE,SAAWP,EAAM,KAEnDE,EAAOW,QAAQR,KAAKL,IAAI,EAAGD,EAAMM,KAAKC,MAAMD,KAAKE,SAAWR,EAAM,MAItE,OAAOG,CAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubble.js","sources":["../../../../src/common/config/chartTypes/bubble.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'bubble';\n\nexport const options = () => {\n return {};\n};\n\nexport const datasetOptions = (ctx, index) => {\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const ColorCycles = Math.floor(index / (Colors.length - 1));\n const Index =\n index > Colors.length - 1\n ? index - (Colors.length - 1) * ColorCycles\n : index;\n\n return {\n backgroundColor: Colors[Index] + '80', // 50% opacity\n borderColor: Colors[index],\n };\n};\n"],"names":["type","options","datasetOptions","ctx","index","Colors","getComputedColorPalette","colorPalette","ColorCycles","Math","floor","length","backgroundColor","borderColor"],"mappings":"8DAEY,MAACA,EAAO,SAEPC,EAAU,KACd,
|
|
1
|
+
{"version":3,"file":"bubble.js","sources":["../../../../src/common/config/chartTypes/bubble.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'bubble';\n\nexport const options = () => {\n return {};\n};\n\nexport const datasetOptions = (ctx, index) => {\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const ColorCycles = Math.floor(index / (Colors.length - 1));\n const Index =\n index > Colors.length - 1\n ? index - (Colors.length - 1) * ColorCycles\n : index;\n\n return {\n backgroundColor: Colors[Index] + '80', // 50% opacity\n borderColor: Colors[index],\n };\n};\n"],"names":["type","options","datasetOptions","ctx","index","Colors","getComputedColorPalette","colorPalette","ColorCycles","Math","floor","length","backgroundColor","borderColor"],"mappings":"8DAEY,MAACA,EAAO,SAEPC,EAAU,KACd,CAAA,GAGIC,EAAiB,CAACC,EAAKC,KAClC,MAAMC,EAASC,EACbH,EAAIF,QAAQM,cAAgB,eAExBC,EAAcC,KAAKC,MAAMN,GAASC,EAAOM,OAAS,IAMxD,MAAO,CACLC,gBAAiBP,EALjBD,EAAQC,EAAOM,OAAS,EACpBP,GAASC,EAAOM,OAAS,GAAKH,EAC9BJ,GAG6B,KACjCS,YAAaR,EAAOD,GACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubbleMap.js","sources":["../../../../src/common/config/chartTypes/bubbleMap.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nexport const type = 'bubbleMap';\n\nexport const options = (ctx) => {\n const BorderColor = getTokenThemeVal('--kd-color-background-page-default');\n const LabelColor = getTokenThemeVal('--kd-color-text-variant-inversed');\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const BubbleColor = getTokenThemeVal('--kd-color-data-viz-level-secondary');\n const LegendTicksColor = getTokenThemeVal('--kd-color-border-variants-light');\n\n return {\n outlineBorderWidth: 0.5,\n outlineBorderColor: BorderColor,\n outlineBackgroundColor: BubbleColor,\n backgroundColor: Colors[0], // + '80', // 50% opacity\n plugins: {\n legend: {\n display: false,\n },\n datalabels: {\n font: {\n size: 12,\n weight: 'bold',\n },\n color: LabelColor,\n // display: 'auto',\n display: function (context) {\n const Value = context.dataset.data[context.dataIndex].value;\n const Range = context.chart.scales.size._range;\n const Avg = (Range.min + Range.max) / 2;\n\n return Value > Avg ? 'auto' : false;\n },\n align: 'center',\n anchor: 'center',\n formatter: function (entry) {\n return entry.value;\n },\n },\n },\n scales: {\n projection: {\n axis: 'x',\n projection: 'naturalEarth1',\n },\n x: {\n display: false,\n },\n y: {\n display: false,\n },\n size: {\n axis: 'x',\n grid: {\n color: LegendTicksColor,\n },\n border: {\n color: LegendTicksColor,\n },\n },\n },\n };\n};\n\nexport const datasetOptions = () => {\n return {};\n};\n"],"names":["type","options","ctx","BorderColor","getTokenThemeVal","LabelColor","Colors","getComputedColorPalette","colorPalette","BubbleColor","LegendTicksColor","outlineBorderWidth","outlineBorderColor","outlineBackgroundColor","backgroundColor","plugins","legend","display","datalabels","font","size","weight","color","context","Value","dataset","data","dataIndex","value","Range","chart","scales","_range","min","max","align","anchor","formatter","entry","projection","axis","x","y","grid","border","datasetOptions"],"mappings":"gKAGY,MAACA,EAAO,YAEPC,EAAWC,IACtB,MAAMC,EAAcC,EAAiB,sCAC/BC,EAAaD,EAAiB,oCAC9BE,EAASC,EACbL,EAAID,QAAQO,cAAgB,eAExBC,EAAcL,EAAiB,uCAC/BM,EAAmBN,EAAiB,oCAE1C,MAAO,CACLO,mBAAoB,GACpBC,mBAAoBT,EACpBU,uBAAwBJ,EACxBK,gBAAiBR,EAAO,GACxBS,QAAS,CACPC,OAAQ,CACNC,SAAS,GAEXC,WAAY,CACVC,KAAM,CACJC,KAAM,GACNC,OAAQ,QAEVC,MAAOjB,EAEPY,QAAS,SAAUM,GACjB,MAAMC,EAAQD,EAAQE,QAAQC,KAAKH,EAAQI,WAAWC,MAChDC,EAAQN,EAAQO,MAAMC,OAAOX,KAAKY,OAGxC,OAAOR,GAFMK,EAAMI,IAAMJ,EAAMK,KAAO,GAEjB,
|
|
1
|
+
{"version":3,"file":"bubbleMap.js","sources":["../../../../src/common/config/chartTypes/bubbleMap.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nexport const type = 'bubbleMap';\n\nexport const options = (ctx) => {\n const BorderColor = getTokenThemeVal('--kd-color-background-page-default');\n const LabelColor = getTokenThemeVal('--kd-color-text-variant-inversed');\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const BubbleColor = getTokenThemeVal('--kd-color-data-viz-level-secondary');\n const LegendTicksColor = getTokenThemeVal('--kd-color-border-variants-light');\n\n return {\n outlineBorderWidth: 0.5,\n outlineBorderColor: BorderColor,\n outlineBackgroundColor: BubbleColor,\n backgroundColor: Colors[0], // + '80', // 50% opacity\n plugins: {\n legend: {\n display: false,\n },\n datalabels: {\n font: {\n size: 12,\n weight: 'bold',\n },\n color: LabelColor,\n // display: 'auto',\n display: function (context) {\n const Value = context.dataset.data[context.dataIndex].value;\n const Range = context.chart.scales.size._range;\n const Avg = (Range.min + Range.max) / 2;\n\n return Value > Avg ? 'auto' : false;\n },\n align: 'center',\n anchor: 'center',\n formatter: function (entry) {\n return entry.value;\n },\n },\n },\n scales: {\n projection: {\n axis: 'x',\n projection: 'naturalEarth1',\n },\n x: {\n display: false,\n },\n y: {\n display: false,\n },\n size: {\n axis: 'x',\n grid: {\n color: LegendTicksColor,\n },\n border: {\n color: LegendTicksColor,\n },\n },\n },\n };\n};\n\nexport const datasetOptions = () => {\n return {};\n};\n"],"names":["type","options","ctx","BorderColor","getTokenThemeVal","LabelColor","Colors","getComputedColorPalette","colorPalette","BubbleColor","LegendTicksColor","outlineBorderWidth","outlineBorderColor","outlineBackgroundColor","backgroundColor","plugins","legend","display","datalabels","font","size","weight","color","context","Value","dataset","data","dataIndex","value","Range","chart","scales","_range","min","max","align","anchor","formatter","entry","projection","axis","x","y","grid","border","datasetOptions"],"mappings":"gKAGY,MAACA,EAAO,YAEPC,EAAWC,IACtB,MAAMC,EAAcC,EAAiB,sCAC/BC,EAAaD,EAAiB,oCAC9BE,EAASC,EACbL,EAAID,QAAQO,cAAgB,eAExBC,EAAcL,EAAiB,uCAC/BM,EAAmBN,EAAiB,oCAE1C,MAAO,CACLO,mBAAoB,GACpBC,mBAAoBT,EACpBU,uBAAwBJ,EACxBK,gBAAiBR,EAAO,GACxBS,QAAS,CACPC,OAAQ,CACNC,SAAS,GAEXC,WAAY,CACVC,KAAM,CACJC,KAAM,GACNC,OAAQ,QAEVC,MAAOjB,EAEPY,QAAS,SAAUM,GACjB,MAAMC,EAAQD,EAAQE,QAAQC,KAAKH,EAAQI,WAAWC,MAChDC,EAAQN,EAAQO,MAAMC,OAAOX,KAAKY,OAGxC,OAAOR,GAFMK,EAAMI,IAAMJ,EAAMK,KAAO,GAEjB,MACvB,EACAC,MAAO,SACPC,OAAQ,SACRC,UAAW,SAAUC,GACnB,OAAOA,EAAMV,KACf,IAGJG,OAAQ,CACNQ,WAAY,CACVC,KAAM,IACND,WAAY,iBAEdE,EAAG,CACDxB,SAAS,GAEXyB,EAAG,CACDzB,SAAS,GAEXG,KAAM,CACJoB,KAAM,IACNG,KAAM,CACJrB,MAAOZ,GAETkC,OAAQ,CACNtB,MAAOZ,KAId,EAGUmC,EAAiB,KACrB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.js","sources":["../../../../src/common/config/chartTypes/choropleth.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nexport const type = 'choropleth';\n\nexport const options = (ctx) => {\n const BorderColor = getTokenThemeVal('--kd-color-background-page-default');\n const LegendTicksColor = getTokenThemeVal('--kd-color-border-variants-light');\n\n return {\n borderWidth: 0.5,\n borderColor: BorderColor,\n plugins: {\n legend: {\n display: false,\n },\n },\n scales: {\n projection: {\n axis: 'x',\n projection: 'naturalEarth1',\n },\n x: {\n display: false,\n },\n y: {\n display: false,\n },\n color: {\n axis: 'x',\n interpolate: (value) => {\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'sequential01'\n );\n const Index = Math.round(value * (Colors.length - 1));\n return Colors[Index];\n },\n grid: {\n color: LegendTicksColor,\n },\n border: {\n color: LegendTicksColor,\n },\n },\n },\n };\n};\n\nexport const datasetOptions = () => {\n return {};\n};\n"],"names":["type","options","ctx","BorderColor","getTokenThemeVal","LegendTicksColor","borderWidth","borderColor","plugins","legend","display","scales","projection","axis","x","y","color","interpolate","value","Colors","getComputedColorPalette","colorPalette","Math","round","length","grid","border","datasetOptions"],"mappings":"gKAGY,MAACA,EAAO,aAEPC,EAAWC,IACtB,MAAMC,EAAcC,EAAiB,sCAC/BC,EAAmBD,EAAiB,oCAE1C,MAAO,CACLE,YAAa,GACbC,YAAaJ,EACbK,QAAS,CACPC,OAAQ,CACNC,SAAS,IAGbC,OAAQ,CACNC,WAAY,CACVC,KAAM,IACND,WAAY,iBAEdE,EAAG,CACDJ,SAAS,GAEXK,EAAG,CACDL,SAAS,GAEXM,MAAO,CACLH,KAAM,IACNI,YAAcC,IACZ,MAAMC,EAASC,EACblB,EAAID,QAAQoB,cAAgB,gBAG9B,OAAOF,EADOG,KAAKC,MAAML,GAASC,EAAOK,OAAS,IAC9B,EAEtBC,KAAM,CACJT,MAAOX,GAETqB,OAAQ,CACNV,MAAOX,KAId,EAGUsB,EAAiB,KACrB,
|
|
1
|
+
{"version":3,"file":"choropleth.js","sources":["../../../../src/common/config/chartTypes/choropleth.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nexport const type = 'choropleth';\n\nexport const options = (ctx) => {\n const BorderColor = getTokenThemeVal('--kd-color-background-page-default');\n const LegendTicksColor = getTokenThemeVal('--kd-color-border-variants-light');\n\n return {\n borderWidth: 0.5,\n borderColor: BorderColor,\n plugins: {\n legend: {\n display: false,\n },\n },\n scales: {\n projection: {\n axis: 'x',\n projection: 'naturalEarth1',\n },\n x: {\n display: false,\n },\n y: {\n display: false,\n },\n color: {\n axis: 'x',\n interpolate: (value) => {\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'sequential01'\n );\n const Index = Math.round(value * (Colors.length - 1));\n return Colors[Index];\n },\n grid: {\n color: LegendTicksColor,\n },\n border: {\n color: LegendTicksColor,\n },\n },\n },\n };\n};\n\nexport const datasetOptions = () => {\n return {};\n};\n"],"names":["type","options","ctx","BorderColor","getTokenThemeVal","LegendTicksColor","borderWidth","borderColor","plugins","legend","display","scales","projection","axis","x","y","color","interpolate","value","Colors","getComputedColorPalette","colorPalette","Math","round","length","grid","border","datasetOptions"],"mappings":"gKAGY,MAACA,EAAO,aAEPC,EAAWC,IACtB,MAAMC,EAAcC,EAAiB,sCAC/BC,EAAmBD,EAAiB,oCAE1C,MAAO,CACLE,YAAa,GACbC,YAAaJ,EACbK,QAAS,CACPC,OAAQ,CACNC,SAAS,IAGbC,OAAQ,CACNC,WAAY,CACVC,KAAM,IACND,WAAY,iBAEdE,EAAG,CACDJ,SAAS,GAEXK,EAAG,CACDL,SAAS,GAEXM,MAAO,CACLH,KAAM,IACNI,YAAcC,IACZ,MAAMC,EAASC,EACblB,EAAID,QAAQoB,cAAgB,gBAG9B,OAAOF,EADOG,KAAKC,MAAML,GAASC,EAAOK,OAAS,IAC9B,EAEtBC,KAAM,CACJT,MAAOX,GAETqB,OAAQ,CACNV,MAAOX,KAId,EAGUsB,EAAiB,KACrB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dendrogram.js","sources":["../../../../src/common/config/chartTypes/dendrogram.js"],"sourcesContent":["import { deepmerge } from 'deepmerge-ts';\nimport {\n graphCommonOptions,\n graphCommonDatasetOptions,\n} from './graphCommon.js';\n\nexport const type = 'dendrogram';\n\nexport const options = (ctx) => {\n return deepmerge(graphCommonOptions(ctx), {});\n};\n\nexport const datasetOptions = (ctx, index) => {\n return deepmerge(graphCommonDatasetOptions(ctx, index), {});\n};\n"],"names":["type","options","ctx","deepmerge","graphCommonOptions","datasetOptions","index","graphCommonDatasetOptions"],"mappings":"8HAMY,MAACA,EAAO,aAEPC,EAAWC,GACfC,EAAUC,IAAyB,IAG/BC,EAAiB,CAACH,EAAKI,IAC3BH,EAAUI,EAA0BL,EAAKI,GAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doughnut.js","sources":["../../../../src/common/config/chartTypes/doughnut.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'doughnut';\n\nexport const options = () => {\n return {\n radius: '80%',\n plugins: {\n datalabels: {\n font: {\n size: 14,\n },\n display: 'auto',\n align: 'end',\n anchor: 'end',\n formatter: function (value, context) {\n const total = context.chart.data.datasets[0].data\n .filter(\n (dataPoint, index) =>\n !context.chart.legend.legendItems[index]?.hidden\n )\n .reduce((a, b) => a + b, 0);\n\n const percentage =\n Math.round((value / total + Number.EPSILON) * 100) + '%';\n\n return !total ? '' : percentage;\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n return {\n backgroundColor: getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n ),\n };\n};\n"],"names":["type","options","radius","plugins","datalabels","font","size","display","align","anchor","formatter","value","context","total","chart","data","datasets","filter","dataPoint","index","legend","legendItems","hidden","reduce","a","b","percentage","Math","round","Number","EPSILON","datasetOptions","ctx","backgroundColor","getComputedColorPalette","colorPalette"],"mappings":"8DAEY,MAACA,EAAO,WAEPC,EAAU,KACd,CACLC,OAAQ,MACRC,QAAS,CACPC,WAAY,CACVC,KAAM,CACJC,KAAM,IAERC,QAAS,OACTC,MAAO,MACPC,OAAQ,MACRC,UAAW,SAAUC,EAAOC,GAC1B,MAAMC,EAAQD,EAAQE,MAAMC,KAAKC,SAAS,GAAGD,KAC1CE,QACC,CAACC,EAAWC,KACTP,EAAQE,MAAMM,OAAOC,YAAYF,IAAQG,SAE7CC,QAAO,CAACC,EAAGC,IAAMD,EAAIC,GAAG,GAErBC,EACJC,KAAKC,MAAyC,KAAlCjB,EAAQE,EAAQgB,OAAOC,UAAkB,IAEvD,OAAQjB,EAAaa,EAAL,
|
|
1
|
+
{"version":3,"file":"doughnut.js","sources":["../../../../src/common/config/chartTypes/doughnut.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'doughnut';\n\nexport const options = () => {\n return {\n radius: '80%',\n plugins: {\n datalabels: {\n font: {\n size: 14,\n },\n display: 'auto',\n align: 'end',\n anchor: 'end',\n formatter: function (value, context) {\n const total = context.chart.data.datasets[0].data\n .filter(\n (dataPoint, index) =>\n !context.chart.legend.legendItems[index]?.hidden\n )\n .reduce((a, b) => a + b, 0);\n\n const percentage =\n Math.round((value / total + Number.EPSILON) * 100) + '%';\n\n return !total ? '' : percentage;\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n return {\n backgroundColor: getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n ),\n };\n};\n"],"names":["type","options","radius","plugins","datalabels","font","size","display","align","anchor","formatter","value","context","total","chart","data","datasets","filter","dataPoint","index","legend","legendItems","hidden","reduce","a","b","percentage","Math","round","Number","EPSILON","datasetOptions","ctx","backgroundColor","getComputedColorPalette","colorPalette"],"mappings":"8DAEY,MAACA,EAAO,WAEPC,EAAU,KACd,CACLC,OAAQ,MACRC,QAAS,CACPC,WAAY,CACVC,KAAM,CACJC,KAAM,IAERC,QAAS,OACTC,MAAO,MACPC,OAAQ,MACRC,UAAW,SAAUC,EAAOC,GAC1B,MAAMC,EAAQD,EAAQE,MAAMC,KAAKC,SAAS,GAAGD,KAC1CE,QACC,CAACC,EAAWC,KACTP,EAAQE,MAAMM,OAAOC,YAAYF,IAAQG,SAE7CC,QAAO,CAACC,EAAGC,IAAMD,EAAIC,GAAG,GAErBC,EACJC,KAAKC,MAAyC,KAAlCjB,EAAQE,EAAQgB,OAAOC,UAAkB,IAEvD,OAAQjB,EAAaa,EAAL,EAClB,MAMKK,EAAkBC,IACtB,CACLC,gBAAiBC,EACfF,EAAI/B,QAAQkC,cAAgB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{deepmerge as o}from"deepmerge-ts";import{graphCommonOptions as r,graphCommonDatasetOptions as e}from"./graphCommon.js";const m="forceDirectedGraph",t=e=>o(r(),{animation:!1}),p=(r,m)=>o(e(r,m),{});export{p as datasetOptions,t as options,m as type};
|
|
2
|
+
//# sourceMappingURL=forceDirectedGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forceDirectedGraph.js","sources":["../../../../src/common/config/chartTypes/forceDirectedGraph.js"],"sourcesContent":["import { deepmerge } from 'deepmerge-ts';\nimport {\n graphCommonOptions,\n graphCommonDatasetOptions,\n} from './graphCommon.js';\n\nexport const type = 'forceDirectedGraph';\n\nexport const options = (ctx) => {\n // return {};\n return deepmerge(graphCommonOptions(ctx), {\n animation: false,\n });\n};\n\nexport const datasetOptions = (ctx, index) => {\n // return {};\n return deepmerge(graphCommonDatasetOptions(ctx, index), {});\n};\n"],"names":["type","options","ctx","deepmerge","graphCommonOptions","animation","datasetOptions","index","graphCommonDatasetOptions"],"mappings":"8HAMY,MAACA,EAAO,qBAEPC,EAAWC,GAEfC,EAAUC,IAAyB,CACxCC,WAAW,IAIFC,EAAiB,CAACJ,EAAKK,IAE3BJ,EAAUK,EAA0BN,EAAKK,GAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sources":["../../../../src/common/config/chartTypes/graph.js"],"sourcesContent":["import { deepmerge } from 'deepmerge-ts';\nimport {\n graphCommonOptions,\n graphCommonDatasetOptions,\n} from './graphCommon.js';\n\nexport const type = 'graph';\n\nexport const options = (ctx) => {\n // return {};\n return deepmerge(graphCommonOptions(ctx), {});\n};\n\nexport const datasetOptions = (ctx, index) => {\n // return {};\n return deepmerge(graphCommonDatasetOptions(ctx, index), {});\n};\n"],"names":["type","options","ctx","deepmerge","graphCommonOptions","datasetOptions","index","graphCommonDatasetOptions"],"mappings":"8HAMY,MAACA,EAAO,QAEPC,EAAWC,GAEfC,EAAUC,IAAyB,IAG/BC,EAAiB,CAACH,EAAKI,IAE3BH,EAAUI,EAA0BL,EAAKI,GAAQ,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getTokenThemeVal as o}from"@kyndryl-design-system/shidoka-foundation/common/helpers/color";import{getComputedColorPalette as r}from"../colorPalettes.js";const e=r=>({pointRadius:6,pointHoverRadius:7,pointBorderWidth:1,edgeLineBorderWidth:1,plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{title:()=>""}},datalabels:{align:"bottom",offset:8,backgroundColor:o("--kd-color-background-container-secondary"),borderRadius:2,formatter:o=>o.name}}}),t=(e,t)=>{const l=o("--kd-color-border-level-secondary"),n=r(e.options.colorPalette||"categorical"),a=Math.floor(t/(n.length-1));return{borderColor:l,backgroundColor:n[t>n.length-1?t-(n.length-1)*a:t]}};export{t as graphCommonDatasetOptions,e as graphCommonOptions};
|
|
2
|
+
//# sourceMappingURL=graphCommon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphCommon.js","sources":["../../../../src/common/config/chartTypes/graphCommon.js"],"sourcesContent":["import { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\nimport { getComputedColorPalette } from '../colorPalettes';\n\nexport const graphCommonOptions = (ctx) => {\n const labelBgColor = getTokenThemeVal(\n '--kd-color-background-container-secondary'\n );\n\n return {\n pointRadius: 6,\n pointHoverRadius: 7,\n pointBorderWidth: 1,\n edgeLineBorderWidth: 1,\n plugins: {\n legend: { display: false },\n tooltip: {\n enabled: true,\n callbacks: {\n title: () => '',\n },\n },\n datalabels: {\n align: 'bottom',\n offset: 8,\n backgroundColor: labelBgColor,\n borderRadius: 2,\n formatter: (v) => {\n return v.name;\n },\n },\n },\n // animation: {\n // duration: 100,\n // easing: 'easeInOutQuart',\n // delay: (context) => {\n // const dataIndex = context?.dataIndex || 0;\n // const depth = context?.raw?.depth || 0;\n // return depth * 300 + dataIndex * 50;\n // },\n // },\n };\n};\n\nexport const graphCommonDatasetOptions = (ctx, index) => {\n const borderColor = getTokenThemeVal('--kd-color-border-level-secondary');\n\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const ColorCycles = Math.floor(index / (Colors.length - 1));\n const Index =\n index > Colors.length - 1\n ? index - (Colors.length - 1) * ColorCycles\n : index;\n\n return {\n borderColor: borderColor,\n backgroundColor: Colors[Index],\n };\n};\n"],"names":["graphCommonOptions","ctx","pointRadius","pointHoverRadius","pointBorderWidth","edgeLineBorderWidth","plugins","legend","display","tooltip","enabled","callbacks","title","datalabels","align","offset","backgroundColor","getTokenThemeVal","borderRadius","formatter","v","name","graphCommonDatasetOptions","index","borderColor","Colors","getComputedColorPalette","options","colorPalette","ColorCycles","Math","floor","length"],"mappings":"gKAGY,MAACA,EAAsBC,IAK1B,CACLC,YAAa,EACbC,iBAAkB,EAClBC,iBAAkB,EAClBC,oBAAqB,EACrBC,QAAS,CACPC,OAAQ,CAAEC,SAAS,GACnBC,QAAS,CACPC,SAAS,EACTC,UAAW,CACTC,MAAO,IAAM,KAGjBC,WAAY,CACVC,MAAO,SACPC,OAAQ,EACRC,gBApBeC,EACnB,6CAoBIC,aAAc,EACdC,UAAYC,GACHA,EAAEC,SAgBNC,EAA4B,CAACrB,EAAKsB,KAC7C,MAAMC,EAAcP,EAAiB,qCAE/BQ,EAASC,EACbzB,EAAI0B,QAAQC,cAAgB,eAExBC,EAAcC,KAAKC,MAAMR,GAASE,EAAOO,OAAS,IAMxD,MAAO,CACLR,YAAaA,EACbR,gBAAiBS,EANjBF,EAAQE,EAAOO,OAAS,EACpBT,GAASE,EAAOO,OAAS,GAAKH,EAC9BN,GAKL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.js","sources":["../../../../src/common/config/chartTypes/line.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'line';\n\nexport const options = (ctx) => {\n const Horizontal = ctx.options.indexAxis === 'y';\n const FloatingBars = ctx.datasets.find((dataset) =>\n Array.isArray(dataset.data[0])\n );\n const Stacked = ctx.options.scales?.y?.stacked;\n\n return {\n interaction: {\n mode: Stacked ? 'index' : 'nearest',\n },\n pointRadius: 6,\n pointHoverRadius: 7,\n pointBorderWidth: 1,\n scales: {\n x: {\n grid: {\n display: FloatingBars || Horizontal,\n },\n },\n y: {\n beginAtZero: true,\n grid: {\n display: !Horizontal,\n },\n },\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: (tooltipItems) => {\n // add axis label to tooltip title\n const AxisLabel = Horizontal\n ? tooltipItems[0].chart.options.scales.y.title.text\n : tooltipItems[0].chart.options.scales.x.title.text;\n const Label = tooltipItems[0].label;\n\n return AxisLabel + ': ' + Label;\n },\n footer: (tooltipItems) => {\n // add total row\n let sum = 0;\n\n tooltipItems.forEach(function (tooltipItem) {\n sum += Horizontal ? tooltipItem.parsed.x : tooltipItem.parsed.y;\n });\n\n // Fix floating point rounding issues, show up to 2 decimals max\n const formattedSum = Math.round((sum + Number.EPSILON) * 100) / 100;\n\n return Stacked ? 'Total: ' + formattedSum : null;\n },\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const ColorCycles = Math.floor(index / (Colors.length - 1));\n const Index =\n index > Colors.length - 1\n ? index - (Colors.length - 1) * ColorCycles\n : index;\n\n return {\n // pointBorderColor:\n // getColorPalette(ctx.options.colorPalette || 'default')[index],\n pointBackgroundColor: Colors[Index] + '80', // 50% opacity\n borderColor: Colors[index],\n // backgroundColor: Colors[Index] + '80',\n backgroundColor: (context) => {\n const ctx = context.chart.ctx;\n const gradient = ctx.createLinearGradient(0, 0, 0, 200);\n gradient.addColorStop(0, Colors[Index] + '99'); // 60% opacity\n gradient.addColorStop(1, Colors[Index] + '4D'); // 30% opacity\n return gradient;\n },\n borderWidth: 2,\n };\n};\n"],"names":["type","options","ctx","Horizontal","indexAxis","FloatingBars","datasets","find","dataset","Array","isArray","data","Stacked","scales","y","stacked","interaction","mode","pointRadius","pointHoverRadius","pointBorderWidth","x","grid","display","beginAtZero","plugins","tooltip","callbacks","title","tooltipItems","chart","text","label","footer","sum","forEach","tooltipItem","parsed","formattedSum","Math","round","Number","EPSILON","datasetOptions","index","Colors","getComputedColorPalette","colorPalette","ColorCycles","floor","length","Index","pointBackgroundColor","borderColor","backgroundColor","context","gradient","createLinearGradient","addColorStop","borderWidth"],"mappings":"8DAEY,MAACA,EAAO,OAEPC,EAAWC,IACtB,MAAMC,EAAuC,MAA1BD,EAAID,QAAQG,UACzBC,EAAeH,EAAII,SAASC,MAAMC,GACtCC,MAAMC,QAAQF,EAAQG,KAAK,MAEvBC,EAAUV,EAAID,QAAQY,QAAQC,GAAGC,QAEvC,MAAO,CACLC,YAAa,CACXC,KAAML,EAAU,QAAU,WAE5BM,YAAa,EACbC,iBAAkB,EAClBC,iBAAkB,EAClBP,OAAQ,CACNQ,EAAG,CACDC,KAAM,CACJC,QAASlB,GAAgBF,IAG7BW,EAAG,CACDU,aAAa,EACbF,KAAM,CACJC,SAAUpB,KAIhBsB,QAAS,CACPC,QAAS,CACPC,UAAW,CACTC,MAAQC,IAEY1B,EACd0B,EAAa,GAAGC,MAAM7B,QAAQY,OAAOC,EAAEc,MAAMG,KAC7CF,EAAa,GAAGC,MAAM7B,QAAQY,OAAOQ,EAAEO,MAAMG,MAG9B,KAFLF,EAAa,GAAGG,MAIhCC,OAASJ,IAEP,IAAIK,EAAM,EAEVL,EAAaM,SAAQ,SAAUC,GAC7BF,GAAO/B,EAAaiC,EAAYC,OAAOhB,EAAIe,EAAYC,OAAOvB,
|
|
1
|
+
{"version":3,"file":"line.js","sources":["../../../../src/common/config/chartTypes/line.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'line';\n\nexport const options = (ctx) => {\n const Horizontal = ctx.options.indexAxis === 'y';\n const FloatingBars = ctx.datasets.find((dataset) =>\n Array.isArray(dataset.data[0])\n );\n const Stacked = ctx.options.scales?.y?.stacked;\n\n return {\n interaction: {\n mode: Stacked ? 'index' : 'nearest',\n },\n pointRadius: 6,\n pointHoverRadius: 7,\n pointBorderWidth: 1,\n scales: {\n x: {\n grid: {\n display: FloatingBars || Horizontal,\n },\n },\n y: {\n beginAtZero: true,\n grid: {\n display: !Horizontal,\n },\n },\n },\n plugins: {\n tooltip: {\n callbacks: {\n title: (tooltipItems) => {\n // add axis label to tooltip title\n const AxisLabel = Horizontal\n ? tooltipItems[0].chart.options.scales.y.title.text\n : tooltipItems[0].chart.options.scales.x.title.text;\n const Label = tooltipItems[0].label;\n\n return AxisLabel + ': ' + Label;\n },\n footer: (tooltipItems) => {\n // add total row\n let sum = 0;\n\n tooltipItems.forEach(function (tooltipItem) {\n sum += Horizontal ? tooltipItem.parsed.x : tooltipItem.parsed.y;\n });\n\n // Fix floating point rounding issues, show up to 2 decimals max\n const formattedSum = Math.round((sum + Number.EPSILON) * 100) / 100;\n\n return Stacked ? 'Total: ' + formattedSum : null;\n },\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const Colors = getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n );\n const ColorCycles = Math.floor(index / (Colors.length - 1));\n const Index =\n index > Colors.length - 1\n ? index - (Colors.length - 1) * ColorCycles\n : index;\n\n return {\n // pointBorderColor:\n // getColorPalette(ctx.options.colorPalette || 'default')[index],\n pointBackgroundColor: Colors[Index] + '80', // 50% opacity\n borderColor: Colors[index],\n // backgroundColor: Colors[Index] + '80',\n backgroundColor: (context) => {\n const ctx = context.chart.ctx;\n const gradient = ctx.createLinearGradient(0, 0, 0, 200);\n gradient.addColorStop(0, Colors[Index] + '99'); // 60% opacity\n gradient.addColorStop(1, Colors[Index] + '4D'); // 30% opacity\n return gradient;\n },\n borderWidth: 2,\n };\n};\n"],"names":["type","options","ctx","Horizontal","indexAxis","FloatingBars","datasets","find","dataset","Array","isArray","data","Stacked","scales","y","stacked","interaction","mode","pointRadius","pointHoverRadius","pointBorderWidth","x","grid","display","beginAtZero","plugins","tooltip","callbacks","title","tooltipItems","chart","text","label","footer","sum","forEach","tooltipItem","parsed","formattedSum","Math","round","Number","EPSILON","datasetOptions","index","Colors","getComputedColorPalette","colorPalette","ColorCycles","floor","length","Index","pointBackgroundColor","borderColor","backgroundColor","context","gradient","createLinearGradient","addColorStop","borderWidth"],"mappings":"8DAEY,MAACA,EAAO,OAEPC,EAAWC,IACtB,MAAMC,EAAuC,MAA1BD,EAAID,QAAQG,UACzBC,EAAeH,EAAII,SAASC,MAAMC,GACtCC,MAAMC,QAAQF,EAAQG,KAAK,MAEvBC,EAAUV,EAAID,QAAQY,QAAQC,GAAGC,QAEvC,MAAO,CACLC,YAAa,CACXC,KAAML,EAAU,QAAU,WAE5BM,YAAa,EACbC,iBAAkB,EAClBC,iBAAkB,EAClBP,OAAQ,CACNQ,EAAG,CACDC,KAAM,CACJC,QAASlB,GAAgBF,IAG7BW,EAAG,CACDU,aAAa,EACbF,KAAM,CACJC,SAAUpB,KAIhBsB,QAAS,CACPC,QAAS,CACPC,UAAW,CACTC,MAAQC,IAEY1B,EACd0B,EAAa,GAAGC,MAAM7B,QAAQY,OAAOC,EAAEc,MAAMG,KAC7CF,EAAa,GAAGC,MAAM7B,QAAQY,OAAOQ,EAAEO,MAAMG,MAG9B,KAFLF,EAAa,GAAGG,MAIhCC,OAASJ,IAEP,IAAIK,EAAM,EAEVL,EAAaM,SAAQ,SAAUC,GAC7BF,GAAO/B,EAAaiC,EAAYC,OAAOhB,EAAIe,EAAYC,OAAOvB,CAChE,IAGA,MAAMwB,EAAeC,KAAKC,MAA+B,KAAxBN,EAAMO,OAAOC,UAAkB,IAEhE,OAAO9B,EAAU,UAAY0B,EAAe,IAAI,KAKzD,EAGUK,EAAiB,CAACzC,EAAK0C,KAClC,MAAMC,EAASC,EACb5C,EAAID,QAAQ8C,cAAgB,eAExBC,EAAcT,KAAKU,MAAML,GAASC,EAAOK,OAAS,IAClDC,EACJP,EAAQC,EAAOK,OAAS,EACpBN,GAASC,EAAOK,OAAS,GAAKF,EAC9BJ,EAEN,MAAO,CAGLQ,qBAAsBP,EAAOM,GAAS,KACtCE,YAAaR,EAAOD,GAEpBU,gBAAkBC,IAChB,MACMC,EADMD,EAAQzB,MAAM5B,IACLuD,qBAAqB,EAAG,EAAG,EAAG,KAGnD,OAFAD,EAASE,aAAa,EAAGb,EAAOM,GAAS,MACzCK,EAASE,aAAa,EAAGb,EAAOM,GAAS,MAClCK,CAAQ,EAEjBG,YAAa,EACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.js","sources":["../../../../src/common/config/chartTypes/matrix.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'matrix';\n\nexport const createMatrixData = (data, options = {}) => {\n const { xAxis, yAxis, xKey = 'x', yKey = 'y', valueKey = 'value' } = options;\n\n if (!xAxis || !yAxis || !Array.isArray(xAxis) || !Array.isArray(yAxis)) {\n throw new Error('xAxis and yAxis must be provided as arrays');\n }\n\n const matrixData = [];\n const dataMap = new Map();\n\n data.forEach((item) => {\n const xValue = item[xKey];\n const yValue = item[yKey];\n const key = `${xValue}-${yValue}`;\n dataMap.set(key, item[valueKey]);\n });\n\n for (let y = 1; y <= yAxis.length; y++) {\n for (let x = 1; x <= xAxis.length; x++) {\n const yValue = yAxis[y - 1];\n const xValue = xAxis[x - 1];\n const key = `${xValue}-${yValue}`;\n const value = dataMap.has(key) ? dataMap.get(key) : undefined;\n matrixData.push({ x, y, value });\n }\n }\n\n return matrixData;\n};\n\nconst defaultOpacity = 0.8;\n\nlet isMatrixFullscreen = false;\n\nexport function setMatrixFullscreen(state) {\n isMatrixFullscreen = !!state;\n}\n\nfunction isFullScreen() {\n if (isMatrixFullscreen) {\n return true;\n }\n\n return !!(\n document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullscreenElement ||\n document.msFullscreenElement\n );\n}\n\nfunction parseColor(hex) {\n if (\n !hex ||\n typeof hex !== 'string' ||\n !hex.startsWith('#') ||\n hex.length < 7\n ) {\n return { r: 0, g: 0, b: 0 };\n }\n\n const r = parseInt(hex.slice(1, 3), 16);\n const g = parseInt(hex.slice(3, 5), 16);\n const b = parseInt(hex.slice(5, 7), 16);\n return { r: isNaN(r) ? 0 : r, g: isNaN(g) ? 0 : g, b: isNaN(b) ? 0 : b };\n}\n\nfunction getColorWithOpacity(color, opacity) {\n if (!color || typeof color !== 'string' || !color.startsWith('#')) {\n return `rgba(204, 204, 204, ${!isNaN(opacity) ? opacity : 0.7})`;\n }\n\n const finalOpacity = !isNaN(opacity) ? opacity : 0.7;\n const { r, g, b } = parseColor(color);\n return `rgba(${r}, ${g}, ${b}, ${finalOpacity})`;\n}\n\nfunction getPresetSymmetricColor(\n value,\n colors,\n neutral = 50,\n band = 15,\n opacity = 1,\n paletteKey\n) {\n if (!colors || !Array.isArray(colors) || colors.length === 0) {\n return `rgba(204, 204, 204, ${opacity})`;\n }\n\n const key = paletteKey || '';\n if (key.toLowerCase().includes('divergent')) {\n const minVal = -100;\n const maxVal = 100;\n const neutralIndex = Math.floor(colors.length / 2);\n if (value <= 0) {\n const ratio = (value - minVal) / (0 - minVal);\n const idx = Math.round(ratio * neutralIndex);\n return getColorWithOpacity(colors[Math.min(idx, neutralIndex)], opacity);\n } else {\n const ratio = value / maxVal;\n const idx =\n neutralIndex + Math.round(ratio * (colors.length - neutralIndex - 1));\n return getColorWithOpacity(\n colors[Math.min(idx, colors.length - 1)],\n opacity\n );\n }\n } else {\n const minVal = 0;\n const maxVal = 100;\n const ratio = (value - minVal) / (maxVal - minVal);\n const idx = Math.round(ratio * (colors.length - 1));\n return getColorWithOpacity(\n colors[Math.min(idx, colors.length - 1)],\n opacity\n );\n }\n}\n\nconst gradientLegendPlugin = {\n id: 'gradientLegend',\n afterDraw(chart, args, options) {\n if (!options || !options.display) return;\n const Colors =\n options.colors ||\n chart.options.plugins?.gradientLegend?.colors ||\n chart.options.colorScale?.colors ||\n chart.data?.datasets?.[0]?._colorPalette;\n if (!Colors || !Colors.length) return;\n\n const ctx = chart.ctx;\n const chartArea = chart.chartArea;\n const paletteKey = options.paletteKey || '';\n const isDivergentPalette = paletteKey.toLowerCase().includes('divergent');\n const computedScale = chart.options.colorScale || {};\n const minVal = computedScale.min ?? (isDivergentPalette ? -100 : 0);\n const neutralVal = computedScale.neutral ?? (isDivergentPalette ? 0 : 50);\n const maxVal = computedScale.max ?? (isDivergentPalette ? 100 : 100);\n\n const legendOptions = {\n position: options.position || 'bottom',\n width: options.width || Math.min(400, chartArea.width * 0.8),\n height: options.height || 20,\n margin: options.margin || 10,\n borderRadius: options.borderRadius || 4,\n gradientBorderRadius: 1,\n title: options.title || '',\n titleFontSize: options.titleFontSize || 12,\n labelFontSize: options.labelFontSize || 12,\n labelMargin: options.labelMargin || 5,\n opacity: typeof options.opacity === 'number' ? options.opacity : 0.7,\n ...options,\n };\n\n let x, y;\n if (legendOptions.position === 'bottom') {\n x = chartArea.left + (chartArea.width - legendOptions.width) / 2;\n y = chartArea.bottom + legendOptions.margin;\n } else if (legendOptions.position === 'top') {\n x = chartArea.left + (chartArea.width - legendOptions.width) / 2;\n y = chartArea.top - legendOptions.margin - legendOptions.height;\n } else if (legendOptions.position === 'bottom-left') {\n x = chartArea.left - 70;\n y = chartArea.bottom + 70;\n } else {\n x = chartArea.left + (chartArea.width - legendOptions.width) / 2;\n y = chartArea.bottom + legendOptions.margin;\n }\n\n const gradient = ctx.createLinearGradient(x, y, x + legendOptions.width, y);\n const neutralIndex = Colors.findIndex((c) =>\n c.toLowerCase().includes('neutral')\n );\n if (neutralIndex > 0) {\n const negativeColors = Colors.slice(0, neutralIndex);\n const neutralColor = Colors[neutralIndex];\n const positiveColors = Colors.slice(neutralIndex + 1);\n negativeColors.forEach((color, i) => {\n const t =\n negativeColors.length > 1\n ? (i / (negativeColors.length - 1)) * 0.5\n : 0;\n gradient.addColorStop(\n t,\n getColorWithOpacity(color, legendOptions.opacity)\n );\n });\n gradient.addColorStop(\n 0.5,\n getColorWithOpacity(neutralColor, legendOptions.opacity)\n );\n positiveColors.forEach((color, i) => {\n const t =\n 0.5 +\n (positiveColors.length > 1\n ? (i / (positiveColors.length - 1)) * 0.5\n : 0);\n gradient.addColorStop(\n t,\n getColorWithOpacity(color, legendOptions.opacity)\n );\n });\n } else {\n Colors.forEach((color, i) => {\n gradient.addColorStop(\n i / (Colors.length - 1),\n getColorWithOpacity(color, legendOptions.opacity)\n );\n });\n }\n\n if (legendOptions.title) {\n ctx.font = `500 ${legendOptions.titleFontSize}px ${\n chart.options.font?.family || 'Arial'\n }`;\n ctx.textAlign = 'left';\n ctx.textBaseline = 'bottom';\n ctx.fillStyle = chart.options.color || '#666';\n ctx.fillText(legendOptions.title, x, y - legendOptions.labelMargin);\n }\n\n function drawRoundedRect(xx, yy, w, h, radius) {\n ctx.beginPath();\n ctx.moveTo(xx + radius, yy);\n ctx.lineTo(xx + w - radius, yy);\n ctx.arcTo(xx + w, yy, xx + w, yy + radius, radius);\n ctx.lineTo(xx + w, yy + h - radius);\n ctx.arcTo(xx + w, yy + h, xx + w - radius, yy + h, radius);\n ctx.lineTo(xx + radius, yy + h);\n ctx.arcTo(xx, yy + h, xx, yy + h - radius, radius);\n ctx.lineTo(xx, yy + radius);\n ctx.arcTo(xx, yy, xx + radius, yy, radius);\n ctx.closePath();\n }\n\n ctx.fillStyle = '#fff';\n drawRoundedRect(\n x,\n y,\n legendOptions.width,\n legendOptions.height,\n legendOptions.borderRadius\n );\n ctx.fill();\n\n ctx.fillStyle = gradient;\n drawRoundedRect(\n x,\n y,\n legendOptions.width,\n legendOptions.height,\n legendOptions.gradientBorderRadius\n );\n ctx.fill();\n\n ctx.font = `${legendOptions.labelFontSize}px ${\n chart.options.font?.family || 'Arial'\n }`;\n ctx.fillStyle = chart.options.color || '#666';\n const formatValue = (val) => val.toString();\n\n ctx.textAlign = 'left';\n ctx.textBaseline = 'top';\n ctx.fillText(\n formatValue(minVal),\n x,\n y + legendOptions.height + legendOptions.labelMargin\n );\n\n if (Colors.length >= 3 && neutralVal !== undefined) {\n ctx.textAlign = 'center';\n ctx.fillText(\n formatValue(neutralVal),\n x + legendOptions.width / 2,\n y + legendOptions.height + legendOptions.labelMargin\n );\n }\n\n ctx.textAlign = 'right';\n ctx.fillText(\n formatValue(maxVal),\n x + legendOptions.width,\n y + legendOptions.height + legendOptions.labelMargin\n );\n },\n};\n\nexport const options = (ctx) => {\n const ds = ctx?.datasets?.[0];\n const data = ds?.data ?? [];\n const allValues = data\n .map((d) => (typeof d.value === 'number' ? d.value : undefined))\n .filter((v) => v !== undefined);\n\n const paletteKey = ctx.options?.colorPalette || 'sequential02';\n const Colors = getComputedColorPalette(paletteKey);\n const minValue = allValues.length ? Math.min(...allValues) : 0;\n const maxValue = allValues.length ? Math.max(...allValues) : 0;\n const isDivergent = paletteKey.toLowerCase().includes('divergent');\n const computedNeutral = isDivergent ? 0 : 50;\n const legendEnabled = ctx.options?.plugins?.gradientLegend?.display;\n const legendPadding = legendEnabled ? { bottom: 35 } : { bottom: 0 };\n\n return {\n responsive: false,\n maintainAspectRatio: true,\n aspectRatio: 2,\n layout: { padding: legendPadding },\n plugins: {\n tooltip: {\n callbacks: {\n title() {\n return '';\n },\n label(context) {\n const v = context.dataset.data[context.dataIndex];\n const rowLabel = ctx.labels.y?.[v.y - 1] || ctx.labels[v.y - 1];\n const colLabel = ctx.labels.x?.[v.x - 1] || ctx.labels[v.x - 1];\n return [`${rowLabel} - ${colLabel}`, `Value: ${v.value ?? 'N/A'}`];\n },\n },\n },\n legend: { display: false },\n gradientLegend: {\n display: legendEnabled,\n position: 'bottom-left',\n title: ctx.options?.plugins?.gradientLegend?.title || '',\n margin: 0,\n height: 15,\n width: 280,\n opacity: defaultOpacity,\n colors: Colors,\n paletteKey,\n legendLabels: [minValue, computedNeutral, maxValue],\n },\n },\n colorPalette: Colors,\n colorScale: {\n min: minValue,\n neutral: computedNeutral,\n max: maxValue,\n colors: Colors,\n },\n scales: {\n x: {\n grid: { display: false },\n min: 1,\n max: ctx.labels.x?.length ?? ctx.labels?.length ?? 3,\n offset: true,\n ticks: {\n autoSkip: false,\n maxTicksLimit: 15,\n callback: (value) =>\n ctx.labels.x?.[value - 1] ?? ctx.labels?.[value - 1] ?? '',\n padding: function () {\n return isFullScreen() ? 30 : 20;\n },\n },\n afterFit(scale) {\n if (legendEnabled) {\n scale.height -= 10;\n }\n },\n },\n y: {\n grid: { display: false },\n min: 1,\n max: ctx.labels.y?.length ?? ctx.labels?.length ?? 3,\n ticks: {\n autoSkip: false,\n maxTicksLimit: 15,\n callback: (value) =>\n ctx.labels.y?.[value - 1] ?? ctx.labels?.[value - 1] ?? '',\n padding: function () {\n return isFullScreen() ? 15 : 8;\n },\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n const paletteKey = ctx.options?.colorPalette || 'categorical';\n const Colors = getComputedColorPalette(paletteKey);\n const numCols = ctx.labels.x?.length ?? ctx.labels?.length ?? 3;\n const numRows = ctx.labels.y?.length ?? ctx.labels?.length ?? 3;\n\n return {\n borderWidth: 0,\n borderColor: 'transparent',\n width({ chart }) {\n const gap = 2;\n const totalWidth = chart.chartArea?.width ?? 0;\n const cellWidth = totalWidth / numCols - gap;\n return cellWidth > 0 ? cellWidth : 1;\n },\n height({ chart }) {\n const gap = 0;\n const totalHeight = chart.chartArea?.height ?? 0;\n const cellHeight = totalHeight / numRows - gap;\n return isFullScreen() ? totalHeight / 11.75 : Math.min(cellHeight, 60);\n },\n backgroundColor({ raw }) {\n if (raw?.value !== undefined) {\n return getPresetSymmetricColor(\n raw.value,\n Colors,\n 50,\n 15,\n defaultOpacity,\n paletteKey\n );\n }\n return 'rgba(204, 204, 204, 0.8)';\n },\n hoverBackgroundColor({ raw }) {\n if (raw?.value !== undefined) {\n return getPresetSymmetricColor(\n raw.value,\n Colors,\n 50,\n 15,\n 1,\n paletteKey\n );\n }\n return '#999';\n },\n };\n};\n\nexport default {\n options,\n datasetOptions,\n plugins: [gradientLegendPlugin],\n};\n"],"names":["type","createMatrixData","data","options","xAxis","yAxis","xKey","yKey","valueKey","Array","isArray","Error","matrixData","dataMap","Map","forEach","item","key","set","y","length","x","yValue","value","has","get","undefined","push","isMatrixFullscreen","setMatrixFullscreen","state","isFullScreen","document","fullscreenElement","webkitFullscreenElement","mozFullscreenElement","msFullscreenElement","getColorWithOpacity","color","opacity","startsWith","isNaN","finalOpacity","r","g","b","hex","parseInt","slice","parseColor","getPresetSymmetricColor","colors","neutral","band","paletteKey","toLowerCase","includes","minVal","maxVal","neutralIndex","Math","floor","ratio","idx","round","min","gradientLegendPlugin","id","afterDraw","chart","args","display","Colors","plugins","gradientLegend","colorScale","datasets","_colorPalette","ctx","chartArea","isDivergentPalette","computedScale","neutralVal","max","legendOptions","position","width","height","margin","borderRadius","gradientBorderRadius","title","titleFontSize","labelFontSize","labelMargin","left","bottom","top","gradient","createLinearGradient","findIndex","c","negativeColors","neutralColor","positiveColors","i","t","addColorStop","drawRoundedRect","xx","yy","w","h","radius","beginPath","moveTo","lineTo","arcTo","closePath","font","family","textAlign","textBaseline","fillStyle","fillText","fill","formatValue","val","toString","ds","allValues","map","d","filter","v","colorPalette","getComputedColorPalette","minValue","maxValue","computedNeutral","legendEnabled","responsive","maintainAspectRatio","aspectRatio","layout","padding","tooltip","callbacks","label","context","dataset","dataIndex","labels","legend","legendLabels","scales","grid","offset","ticks","autoSkip","maxTicksLimit","callback","afterFit","scale","datasetOptions","numCols","numRows","borderWidth","borderColor","cellWidth","totalHeight","cellHeight","backgroundColor","raw","hoverBackgroundColor","matrix"],"mappings":"8DAEY,MAACA,EAAO,SAEPC,EAAmB,CAACC,EAAMC,EAAU,MAC/C,MAAMC,MAAEA,EAAKC,MAAEA,EAAKC,KAAEA,EAAO,IAAGC,KAAEA,EAAO,IAAGC,SAAEA,EAAW,SAAYL,EAErE,KAAKC,GAAUC,GAAUI,MAAMC,QAAQN,IAAWK,MAAMC,QAAQL,IAC9D,MAAM,IAAIM,MAAM,8CAGlB,MAAMC,EAAa,GACbC,EAAU,IAAIC,IAEpBZ,EAAKa,SAASC,IACZ,MAEMC,EAAM,GAFGD,EAAKV,MACLU,EAAKT,KAEpBM,EAAQK,IAAID,EAAKD,EAAKR,GAAU,IAGlC,IAAK,IAAIW,EAAI,EAAGA,GAAKd,EAAMe,OAAQD,IACjC,IAAK,IAAIE,EAAI,EAAGA,GAAKjB,EAAMgB,OAAQC,IAAK,CACtC,MAAMC,EAASjB,EAAMc,EAAI,GAEnBF,EAAM,GADGb,EAAMiB,EAAI,MACAC,IACnBC,EAAQV,EAAQW,IAAIP,GAAOJ,EAAQY,IAAIR,QAAOS,EACpDd,EAAWe,KAAK,CAAEN,IAAGF,IAAGI,SAC9B,CAGE,OAAOX,CAAU,EAKnB,IAAIgB,GAAqB,EAElB,SAASC,EAAoBC,GAClCF,IAAuBE,CACzB,CAEA,SAASC,IACP,QAAIH,MAKFI,SAASC,mBACTD,SAASE,yBACTF,SAASG,sBACTH,SAASI,oBAEb,CAkBA,SAASC,EAAoBC,EAAOC,GAClC,IAAKD,GAA0B,iBAAVA,IAAuBA,EAAME,WAAW,KAC3D,MAAO,uBAAwBC,MAAMF,GAAqB,GAAVA,KAGlD,MAAMG,EAAgBD,MAAMF,GAAqB,GAAVA,GACjCI,EAAEA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I,QAAU,EAE9D,MAAO,CACLmJ,YAAa,EACbC,YAAa,cACb,KAAAlF,EAAMjB,MAAEA,IACN,MAEMoG,GADapG,EAAMU,WAAWO,OAAS,GACd+E,EAFnB,EAGZ,OAAOI,EAAY,EAAIA,EAAY,CACpC,EACD,MAAAlF,EAAOlB,MAAEA,IACP,MACMqG,EAAcrG,EAAMU,WAAWQ,QAAU,EACzCoF,EAAaD,EAAcJ,EAFrB,EAGZ,OAAOvI,IAAiB2I,EAAc,MAAQ9G,KAAKK,IAAI0G,EAAY,GACpE,EACDC,gBAAe,EAACC,IAAEA,UACGnJ,IAAfmJ,GAAKtJ,MACA2B,EACL2H,EAAItJ,MACJiD,EACA,GACA,GA3Xa,GA6XblB,GAGG,2BAETwH,qBAAoB,EAACD,IAAEA,UACFnJ,IAAfmJ,GAAKtJ,MACA2B,EACL2H,EAAItJ,MACJiD,EACA,GACA,GACA,EACAlB,GAGG,OAEV,EAGH,IAAeyH,EAAA,CACb5K,UACAiK,iBACA3F,QAAS,CAACP"}
|
|
1
|
+
{"version":3,"file":"matrix.js","sources":["../../../../src/common/config/chartTypes/matrix.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'matrix';\n\nexport const createMatrixData = (data, options = {}) => {\n const { xAxis, yAxis, xKey = 'x', yKey = 'y', valueKey = 'value' } = options;\n\n if (!xAxis || !yAxis || !Array.isArray(xAxis) || !Array.isArray(yAxis)) {\n throw new Error('xAxis and yAxis must be provided as arrays');\n }\n\n const matrixData = [];\n const dataMap = new Map();\n\n data.forEach((item) => {\n const xValue = item[xKey];\n const yValue = item[yKey];\n const key = `${xValue}-${yValue}`;\n dataMap.set(key, item[valueKey]);\n });\n\n for (let y = 1; y <= yAxis.length; y++) {\n for (let x = 1; x <= xAxis.length; x++) {\n const yValue = yAxis[y - 1];\n const xValue = xAxis[x - 1];\n const key = `${xValue}-${yValue}`;\n const value = dataMap.has(key) ? dataMap.get(key) : undefined;\n matrixData.push({ x, y, value });\n }\n }\n\n return matrixData;\n};\n\nconst defaultOpacity = 0.8;\n\nlet isMatrixFullscreen = false;\n\nexport function setMatrixFullscreen(state) {\n isMatrixFullscreen = !!state;\n}\n\nfunction isFullScreen() {\n if (isMatrixFullscreen) {\n return true;\n }\n\n return !!(\n document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullscreenElement ||\n document.msFullscreenElement\n );\n}\n\nfunction parseColor(hex) {\n if (\n !hex ||\n typeof hex !== 'string' ||\n !hex.startsWith('#') ||\n hex.length < 7\n ) {\n return { r: 0, g: 0, b: 0 };\n }\n\n const r = parseInt(hex.slice(1, 3), 16);\n const g = parseInt(hex.slice(3, 5), 16);\n const b = parseInt(hex.slice(5, 7), 16);\n return { r: isNaN(r) ? 0 : r, g: isNaN(g) ? 0 : g, b: isNaN(b) ? 0 : b };\n}\n\nfunction getColorWithOpacity(color, opacity) {\n if (!color || typeof color !== 'string' || !color.startsWith('#')) {\n return `rgba(204, 204, 204, ${!isNaN(opacity) ? opacity : 0.7})`;\n }\n\n const finalOpacity = !isNaN(opacity) ? opacity : 0.7;\n const { r, g, b } = parseColor(color);\n return `rgba(${r}, ${g}, ${b}, ${finalOpacity})`;\n}\n\nfunction getPresetSymmetricColor(\n value,\n colors,\n neutral = 50,\n band = 15,\n opacity = 1,\n paletteKey\n) {\n if (!colors || !Array.isArray(colors) || colors.length === 0) {\n return `rgba(204, 204, 204, ${opacity})`;\n }\n\n const key = paletteKey || '';\n if (key.toLowerCase().includes('divergent')) {\n const minVal = -100;\n const maxVal = 100;\n const neutralIndex = Math.floor(colors.length / 2);\n if (value <= 0) {\n const ratio = (value - minVal) / (0 - minVal);\n const idx = Math.round(ratio * neutralIndex);\n return getColorWithOpacity(colors[Math.min(idx, neutralIndex)], opacity);\n } else {\n const ratio = value / maxVal;\n const idx =\n neutralIndex + Math.round(ratio * (colors.length - neutralIndex - 1));\n return getColorWithOpacity(\n colors[Math.min(idx, colors.length - 1)],\n opacity\n );\n }\n } else {\n const minVal = 0;\n const maxVal = 100;\n const ratio = (value - minVal) / (maxVal - minVal);\n const idx = Math.round(ratio * (colors.length - 1));\n return getColorWithOpacity(\n colors[Math.min(idx, colors.length - 1)],\n opacity\n );\n }\n}\n\nconst gradientLegendPlugin = {\n id: 'gradientLegend',\n afterDraw(chart, args, options) {\n if (!options || !options.display) return;\n const Colors =\n options.colors ||\n chart.options.plugins?.gradientLegend?.colors ||\n chart.options.colorScale?.colors ||\n chart.data?.datasets?.[0]?._colorPalette;\n if (!Colors || !Colors.length) return;\n\n const ctx = chart.ctx;\n const chartArea = chart.chartArea;\n const paletteKey = options.paletteKey || '';\n const isDivergentPalette = paletteKey.toLowerCase().includes('divergent');\n const computedScale = chart.options.colorScale || {};\n const minVal = computedScale.min ?? (isDivergentPalette ? -100 : 0);\n const neutralVal = computedScale.neutral ?? (isDivergentPalette ? 0 : 50);\n const maxVal = computedScale.max ?? (isDivergentPalette ? 100 : 100);\n\n const legendOptions = {\n position: options.position || 'bottom',\n width: options.width || Math.min(400, chartArea.width * 0.8),\n height: options.height || 20,\n margin: options.margin || 10,\n borderRadius: options.borderRadius || 4,\n gradientBorderRadius: 1,\n title: options.title || '',\n titleFontSize: options.titleFontSize || 12,\n labelFontSize: options.labelFontSize || 12,\n labelMargin: options.labelMargin || 5,\n opacity: typeof options.opacity === 'number' ? options.opacity : 0.7,\n ...options,\n };\n\n let x, y;\n if (legendOptions.position === 'bottom') {\n x = chartArea.left + (chartArea.width - legendOptions.width) / 2;\n y = chartArea.bottom + legendOptions.margin;\n } else if (legendOptions.position === 'top') {\n x = chartArea.left + (chartArea.width - legendOptions.width) / 2;\n y = chartArea.top - legendOptions.margin - legendOptions.height;\n } else if (legendOptions.position === 'bottom-left') {\n x = chartArea.left - 70;\n y = chartArea.bottom + 70;\n } else {\n x = chartArea.left + (chartArea.width - legendOptions.width) / 2;\n y = chartArea.bottom + legendOptions.margin;\n }\n\n const gradient = ctx.createLinearGradient(x, y, x + legendOptions.width, y);\n const neutralIndex = Colors.findIndex((c) =>\n c.toLowerCase().includes('neutral')\n );\n if (neutralIndex > 0) {\n const negativeColors = Colors.slice(0, neutralIndex);\n const neutralColor = Colors[neutralIndex];\n const positiveColors = Colors.slice(neutralIndex + 1);\n negativeColors.forEach((color, i) => {\n const t =\n negativeColors.length > 1\n ? (i / (negativeColors.length - 1)) * 0.5\n : 0;\n gradient.addColorStop(\n t,\n getColorWithOpacity(color, legendOptions.opacity)\n );\n });\n gradient.addColorStop(\n 0.5,\n getColorWithOpacity(neutralColor, legendOptions.opacity)\n );\n positiveColors.forEach((color, i) => {\n const t =\n 0.5 +\n (positiveColors.length > 1\n ? (i / (positiveColors.length - 1)) * 0.5\n : 0);\n gradient.addColorStop(\n t,\n getColorWithOpacity(color, legendOptions.opacity)\n );\n });\n } else {\n Colors.forEach((color, i) => {\n gradient.addColorStop(\n i / (Colors.length - 1),\n getColorWithOpacity(color, legendOptions.opacity)\n );\n });\n }\n\n if (legendOptions.title) {\n ctx.font = `500 ${legendOptions.titleFontSize}px ${\n chart.options.font?.family || 'Arial'\n }`;\n ctx.textAlign = 'left';\n ctx.textBaseline = 'bottom';\n ctx.fillStyle = chart.options.color || '#666';\n ctx.fillText(legendOptions.title, x, y - legendOptions.labelMargin);\n }\n\n function drawRoundedRect(xx, yy, w, h, radius) {\n ctx.beginPath();\n ctx.moveTo(xx + radius, yy);\n ctx.lineTo(xx + w - radius, yy);\n ctx.arcTo(xx + w, yy, xx + w, yy + radius, radius);\n ctx.lineTo(xx + w, yy + h - radius);\n ctx.arcTo(xx + w, yy + h, xx + w - radius, yy + h, radius);\n ctx.lineTo(xx + radius, yy + h);\n ctx.arcTo(xx, yy + h, xx, yy + h - radius, radius);\n ctx.lineTo(xx, yy + radius);\n ctx.arcTo(xx, yy, xx + radius, yy, radius);\n ctx.closePath();\n }\n\n ctx.fillStyle = '#fff';\n drawRoundedRect(\n x,\n y,\n legendOptions.width,\n legendOptions.height,\n legendOptions.borderRadius\n );\n ctx.fill();\n\n ctx.fillStyle = gradient;\n drawRoundedRect(\n x,\n y,\n legendOptions.width,\n legendOptions.height,\n legendOptions.gradientBorderRadius\n );\n ctx.fill();\n\n ctx.font = `${legendOptions.labelFontSize}px ${\n chart.options.font?.family || 'Arial'\n }`;\n ctx.fillStyle = chart.options.color || '#666';\n const formatValue = (val) => val.toString();\n\n ctx.textAlign = 'left';\n ctx.textBaseline = 'top';\n ctx.fillText(\n formatValue(minVal),\n x,\n y + legendOptions.height + legendOptions.labelMargin\n );\n\n if (Colors.length >= 3 && neutralVal !== undefined) {\n ctx.textAlign = 'center';\n ctx.fillText(\n formatValue(neutralVal),\n x + legendOptions.width / 2,\n y + legendOptions.height + legendOptions.labelMargin\n );\n }\n\n ctx.textAlign = 'right';\n ctx.fillText(\n formatValue(maxVal),\n x + legendOptions.width,\n y + legendOptions.height + legendOptions.labelMargin\n );\n },\n};\n\nexport const options = (ctx) => {\n const ds = ctx?.datasets?.[0];\n const data = ds?.data ?? [];\n const allValues = data\n .map((d) => (typeof d.value === 'number' ? d.value : undefined))\n .filter((v) => v !== undefined);\n\n const paletteKey = ctx.options?.colorPalette || 'sequential02';\n const Colors = getComputedColorPalette(paletteKey);\n const minValue = allValues.length ? Math.min(...allValues) : 0;\n const maxValue = allValues.length ? Math.max(...allValues) : 0;\n const isDivergent = paletteKey.toLowerCase().includes('divergent');\n const computedNeutral = isDivergent ? 0 : 50;\n const legendEnabled = ctx.options?.plugins?.gradientLegend?.display;\n const legendPadding = legendEnabled ? { bottom: 35 } : { bottom: 0 };\n\n return {\n responsive: false,\n maintainAspectRatio: true,\n aspectRatio: 2,\n layout: { padding: legendPadding },\n plugins: {\n tooltip: {\n callbacks: {\n title() {\n return '';\n },\n label(context) {\n const v = context.dataset.data[context.dataIndex];\n const rowLabel = ctx.labels.y?.[v.y - 1] || ctx.labels[v.y - 1];\n const colLabel = ctx.labels.x?.[v.x - 1] || ctx.labels[v.x - 1];\n return [`${rowLabel} - ${colLabel}`, `Value: ${v.value ?? 'N/A'}`];\n },\n },\n },\n legend: { display: false },\n gradientLegend: {\n display: legendEnabled,\n position: 'bottom-left',\n title: ctx.options?.plugins?.gradientLegend?.title || '',\n margin: 0,\n height: 15,\n width: 280,\n opacity: defaultOpacity,\n colors: Colors,\n paletteKey,\n legendLabels: [minValue, computedNeutral, maxValue],\n },\n },\n colorPalette: Colors,\n colorScale: {\n min: minValue,\n neutral: computedNeutral,\n max: maxValue,\n colors: Colors,\n },\n scales: {\n x: {\n grid: { display: false },\n min: 1,\n max: ctx.labels.x?.length ?? ctx.labels?.length ?? 3,\n offset: true,\n ticks: {\n autoSkip: false,\n maxTicksLimit: 15,\n callback: (value) =>\n ctx.labels.x?.[value - 1] ?? ctx.labels?.[value - 1] ?? '',\n padding: function () {\n return isFullScreen() ? 30 : 20;\n },\n },\n afterFit(scale) {\n if (legendEnabled) {\n scale.height -= 10;\n }\n },\n },\n y: {\n grid: { display: false },\n min: 1,\n max: ctx.labels.y?.length ?? ctx.labels?.length ?? 3,\n ticks: {\n autoSkip: false,\n maxTicksLimit: 15,\n callback: (value) =>\n ctx.labels.y?.[value - 1] ?? ctx.labels?.[value - 1] ?? '',\n padding: function () {\n return isFullScreen() ? 15 : 8;\n },\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n const paletteKey = ctx.options?.colorPalette || 'categorical';\n const Colors = getComputedColorPalette(paletteKey);\n const numCols = ctx.labels.x?.length ?? ctx.labels?.length ?? 3;\n const numRows = ctx.labels.y?.length ?? ctx.labels?.length ?? 3;\n\n return {\n borderWidth: 0,\n borderColor: 'transparent',\n width({ chart }) {\n const gap = 2;\n const totalWidth = chart.chartArea?.width ?? 0;\n const cellWidth = totalWidth / numCols - gap;\n return cellWidth > 0 ? cellWidth : 1;\n },\n height({ chart }) {\n const gap = 0;\n const totalHeight = chart.chartArea?.height ?? 0;\n const cellHeight = totalHeight / numRows - gap;\n return isFullScreen() ? totalHeight / 11.75 : Math.min(cellHeight, 60);\n },\n backgroundColor({ raw }) {\n if (raw?.value !== undefined) {\n return getPresetSymmetricColor(\n raw.value,\n Colors,\n 50,\n 15,\n defaultOpacity,\n paletteKey\n );\n }\n return 'rgba(204, 204, 204, 0.8)';\n },\n hoverBackgroundColor({ raw }) {\n if (raw?.value !== undefined) {\n return getPresetSymmetricColor(\n raw.value,\n Colors,\n 50,\n 15,\n 1,\n paletteKey\n );\n }\n return '#999';\n },\n };\n};\n\nexport default {\n options,\n datasetOptions,\n plugins: [gradientLegendPlugin],\n};\n"],"names":["type","createMatrixData","data","options","xAxis","yAxis","xKey","yKey","valueKey","Array","isArray","Error","matrixData","dataMap","Map","forEach","item","key","set","y","length","x","yValue","value","has","get","undefined","push","isMatrixFullscreen","setMatrixFullscreen","state","isFullScreen","document","fullscreenElement","webkitFullscreenElement","mozFullscreenElement","msFullscreenElement","getColorWithOpacity","color","opacity","startsWith","isNaN","finalOpacity","r","g","b","hex","parseInt","slice","parseColor","getPresetSymmetricColor","colors","neutral","band","paletteKey","toLowerCase","includes","minVal","maxVal","neutralIndex","Math","floor","ratio","idx","round","min","gradientLegendPlugin","id","afterDraw","chart","args","display","Colors","plugins","gradientLegend","colorScale","datasets","_colorPalette","ctx","chartArea","isDivergentPalette","computedScale","neutralVal","max","legendOptions","position","width","height","margin","borderRadius","gradientBorderRadius","title","titleFontSize","labelFontSize","labelMargin","left","bottom","top","gradient","createLinearGradient","findIndex","c","negativeColors","neutralColor","positiveColors","i","t","addColorStop","drawRoundedRect","xx","yy","w","h","radius","beginPath","moveTo","lineTo","arcTo","closePath","font","family","textAlign","textBaseline","fillStyle","fillText","fill","formatValue","val","toString","ds","allValues","map","d","filter","v","colorPalette","getComputedColorPalette","minValue","maxValue","computedNeutral","legendEnabled","responsive","maintainAspectRatio","aspectRatio","layout","padding","tooltip","callbacks","label","context","dataset","dataIndex","labels","legend","legendLabels","scales","grid","offset","ticks","autoSkip","maxTicksLimit","callback","afterFit","scale","datasetOptions","numCols","numRows","borderWidth","borderColor","cellWidth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,EAFnB,EAGZ,OAAOI,EAAY,EAAIA,EAAY,CACrC,EACA,MAAAlF,EAAOlB,MAAEA,IACP,MACMqG,EAAcrG,EAAMU,WAAWQ,QAAU,EACzCoF,EAAaD,EAAcJ,EAFrB,EAGZ,OAAOvI,IAAiB2I,EAAc,MAAQ9G,KAAKK,IAAI0G,EAAY,GACrE,EACAC,gBAAe,EAACC,IAAEA,UACGnJ,IAAfmJ,GAAKtJ,MACA2B,EACL2H,EAAItJ,MACJiD,EACA,GACA,GA3Xa,GA6XblB,GAGG,2BAETwH,qBAAoB,EAACD,IAAEA,UACFnJ,IAAfmJ,GAAKtJ,MACA2B,EACL2H,EAAItJ,MACJiD,EACA,GACA,GACA,EACAlB,GAGG,OAEV,EAGH,IAAAyH,EAAe,CACb5K,UACAiK,iBACA3F,QAAS,CAACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.js","sources":["../../../../src/common/config/chartTypes/meter.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'meter';\n\nexport const options = () => {\n return {\n radius: '80%',\n circumference: 180,\n rotation: 270,\n aspectRatio: 1.3,\n borderWidth: 2,\n cutout: '80%',\n datasets: {\n borderWidth: 2,\n cutout: '80%',\n },\n plugins: {\n legend: {\n display: false,\n },\n\n datalabels: {\n font: function (context) {\n var w = context.chart.width;\n return {\n size: w < 512 ? 10 : 12,\n weight: 'bold',\n };\n },\n display: 'auto',\n align: 'end',\n anchor: 'end',\n formatter: function (value, context) {\n return context.chart.data.labels[context.dataIndex];\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n return {\n backgroundColor: getComputedColorPalette(\n ctx.options.colorPalette || 'statusDark'\n ),\n };\n};\n"],"names":["type","options","radius","circumference","rotation","aspectRatio","borderWidth","cutout","datasets","plugins","legend","display","datalabels","font","context","size","chart","width","weight","align","anchor","formatter","value","data","labels","dataIndex","datasetOptions","ctx","backgroundColor","getComputedColorPalette","colorPalette"],"mappings":"8DAEY,MAACA,EAAO,QAEPC,EAAU,KACd,CACLC,OAAQ,MACRC,cAAe,IACfC,SAAU,IACVC,YAAa,IACbC,YAAa,EACbC,OAAQ,MACRC,SAAU,CACRF,YAAa,EACbC,OAAQ,OAEVE,QAAS,CACPC,OAAQ,CACNC,SAAS,GAGXC,WAAY,CACVC,KAAM,SAAUC,GAEd,MAAO,CACLC,KAFMD,EAAQE,MAAMC,MAEV,IAAM,GAAK,GACrBC,OAAQ,
|
|
1
|
+
{"version":3,"file":"meter.js","sources":["../../../../src/common/config/chartTypes/meter.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'meter';\n\nexport const options = () => {\n return {\n radius: '80%',\n circumference: 180,\n rotation: 270,\n aspectRatio: 1.3,\n borderWidth: 2,\n cutout: '80%',\n datasets: {\n borderWidth: 2,\n cutout: '80%',\n },\n plugins: {\n legend: {\n display: false,\n },\n\n datalabels: {\n font: function (context) {\n var w = context.chart.width;\n return {\n size: w < 512 ? 10 : 12,\n weight: 'bold',\n };\n },\n display: 'auto',\n align: 'end',\n anchor: 'end',\n formatter: function (value, context) {\n return context.chart.data.labels[context.dataIndex];\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n return {\n backgroundColor: getComputedColorPalette(\n ctx.options.colorPalette || 'statusDark'\n ),\n };\n};\n"],"names":["type","options","radius","circumference","rotation","aspectRatio","borderWidth","cutout","datasets","plugins","legend","display","datalabels","font","context","size","chart","width","weight","align","anchor","formatter","value","data","labels","dataIndex","datasetOptions","ctx","backgroundColor","getComputedColorPalette","colorPalette"],"mappings":"8DAEY,MAACA,EAAO,QAEPC,EAAU,KACd,CACLC,OAAQ,MACRC,cAAe,IACfC,SAAU,IACVC,YAAa,IACbC,YAAa,EACbC,OAAQ,MACRC,SAAU,CACRF,YAAa,EACbC,OAAQ,OAEVE,QAAS,CACPC,OAAQ,CACNC,SAAS,GAGXC,WAAY,CACVC,KAAM,SAAUC,GAEd,MAAO,CACLC,KAFMD,EAAQE,MAAMC,MAEV,IAAM,GAAK,GACrBC,OAAQ,OAEZ,EACAP,QAAS,OACTQ,MAAO,MACPC,OAAQ,MACRC,UAAW,SAAUC,EAAOR,GAC1B,OAAOA,EAAQE,MAAMO,KAAKC,OAAOV,EAAQW,UAC3C,MAMKC,EAAkBC,IACtB,CACLC,gBAAiBC,EACfF,EAAI1B,QAAQ6B,cAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie.js","sources":["../../../../src/common/config/chartTypes/pie.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'pie';\n\nexport const options = () => {\n return {\n radius: '80%',\n plugins: {\n datalabels: {\n font: {\n size: 14,\n },\n display: 'auto',\n align: 'end',\n anchor: 'end',\n formatter: function (value, context) {\n const total = context.chart.data.datasets[0].data\n .filter(\n (dataPoint, index) =>\n !context.chart.legend.legendItems[index]?.hidden\n )\n .reduce((a, b) => a + b, 0);\n\n const percentage =\n Math.round((value / total + Number.EPSILON) * 100) + '%';\n\n return !total ? '' : percentage;\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n return {\n backgroundColor: getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n ),\n };\n};\n"],"names":["type","options","radius","plugins","datalabels","font","size","display","align","anchor","formatter","value","context","total","chart","data","datasets","filter","dataPoint","index","legend","legendItems","hidden","reduce","a","b","percentage","Math","round","Number","EPSILON","datasetOptions","ctx","backgroundColor","getComputedColorPalette","colorPalette"],"mappings":"8DAEY,MAACA,EAAO,MAEPC,EAAU,KACd,CACLC,OAAQ,MACRC,QAAS,CACPC,WAAY,CACVC,KAAM,CACJC,KAAM,IAERC,QAAS,OACTC,MAAO,MACPC,OAAQ,MACRC,UAAW,SAAUC,EAAOC,GAC1B,MAAMC,EAAQD,EAAQE,MAAMC,KAAKC,SAAS,GAAGD,KAC1CE,QACC,CAACC,EAAWC,KACTP,EAAQE,MAAMM,OAAOC,YAAYF,IAAQG,SAE7CC,QAAO,CAACC,EAAGC,IAAMD,EAAIC,GAAG,GAErBC,EACJC,KAAKC,MAAyC,KAAlCjB,EAAQE,EAAQgB,OAAOC,UAAkB,IAEvD,OAAQjB,EAAaa,EAAL,
|
|
1
|
+
{"version":3,"file":"pie.js","sources":["../../../../src/common/config/chartTypes/pie.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\n\nexport const type = 'pie';\n\nexport const options = () => {\n return {\n radius: '80%',\n plugins: {\n datalabels: {\n font: {\n size: 14,\n },\n display: 'auto',\n align: 'end',\n anchor: 'end',\n formatter: function (value, context) {\n const total = context.chart.data.datasets[0].data\n .filter(\n (dataPoint, index) =>\n !context.chart.legend.legendItems[index]?.hidden\n )\n .reduce((a, b) => a + b, 0);\n\n const percentage =\n Math.round((value / total + Number.EPSILON) * 100) + '%';\n\n return !total ? '' : percentage;\n },\n },\n },\n };\n};\n\nexport const datasetOptions = (ctx) => {\n return {\n backgroundColor: getComputedColorPalette(\n ctx.options.colorPalette || 'categorical'\n ),\n };\n};\n"],"names":["type","options","radius","plugins","datalabels","font","size","display","align","anchor","formatter","value","context","total","chart","data","datasets","filter","dataPoint","index","legend","legendItems","hidden","reduce","a","b","percentage","Math","round","Number","EPSILON","datasetOptions","ctx","backgroundColor","getComputedColorPalette","colorPalette"],"mappings":"8DAEY,MAACA,EAAO,MAEPC,EAAU,KACd,CACLC,OAAQ,MACRC,QAAS,CACPC,WAAY,CACVC,KAAM,CACJC,KAAM,IAERC,QAAS,OACTC,MAAO,MACPC,OAAQ,MACRC,UAAW,SAAUC,EAAOC,GAC1B,MAAMC,EAAQD,EAAQE,MAAMC,KAAKC,SAAS,GAAGD,KAC1CE,QACC,CAACC,EAAWC,KACTP,EAAQE,MAAMM,OAAOC,YAAYF,IAAQG,SAE7CC,QAAO,CAACC,EAAGC,IAAMD,EAAIC,GAAG,GAErBC,EACJC,KAAKC,MAAyC,KAAlCjB,EAAQE,EAAQgB,OAAOC,UAAkB,IAEvD,OAAQjB,EAAaa,EAAL,EAClB,MAMKK,EAAkBC,IACtB,CACLC,gBAAiBC,EACfF,EAAI/B,QAAQkC,cAAgB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{deepmerge as e}from"deepmerge-ts";import{graphCommonOptions as r,graphCommonDatasetOptions as o}from"./graphCommon.js";const t="tree",m=o=>e(r(),{edgeLineBorderWidth:e=>e.dataIndex}),d=(r,t)=>e(o(r,t),{});export{d as datasetOptions,m as options,t as type};
|
|
2
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sources":["../../../../src/common/config/chartTypes/tree.js"],"sourcesContent":["import { deepmerge } from 'deepmerge-ts';\nimport {\n graphCommonOptions,\n graphCommonDatasetOptions,\n} from './graphCommon.js';\n\nexport const type = 'tree';\n\nexport const options = (ctx) => {\n return deepmerge(graphCommonOptions(ctx), {\n edgeLineBorderWidth: (ctx) => {\n return ctx.dataIndex;\n },\n });\n};\n\nexport const datasetOptions = (ctx, index) => {\n return deepmerge(graphCommonDatasetOptions(ctx, index), {});\n};\n"],"names":["type","options","ctx","deepmerge","graphCommonOptions","edgeLineBorderWidth","dataIndex","datasetOptions","index","graphCommonDatasetOptions"],"mappings":"8HAMY,MAACA,EAAO,OAEPC,EAAWC,GACfC,EAAUC,IAAyB,CACxCC,oBAAsBH,GACbA,EAAII,YAKJC,EAAiB,CAACL,EAAKM,IAC3BL,EAAUM,EAA0BP,EAAKM,GAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treemap.js","sources":["../../../../src/common/config/chartTypes/treemap.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\nimport { getTextColor } from '../../helpers/helpers';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nexport const type = 'treemap';\n\nexport const options = (ctx) => {\n const BorderColor = getTokenThemeVal('--kd-color-background-page-default');\n\n return {\n plugins: {\n legend: {\n display: false,\n },\n },\n spacing: function (context) {\n const Dataset = context.dataset;\n const Grouped = Dataset.groups !== undefined;\n\n return Grouped ? 0 : 1;\n },\n borderWidth: function (context) {\n const Dataset = context.dataset;\n return Dataset.groups ? 1 : 0;\n },\n borderColor: BorderColor,\n labels: {\n align: 'left',\n display: true,\n color: function (context) {\n return getTextColor(context.element.options.backgroundColor);\n },\n font: {\n size: 12,\n weight: 500,\n },\n position: 'top',\n overflow: 'hidden',\n },\n captions: {\n align: 'center',\n display: true,\n color: function (context) {\n return getTextColor(context.element.options.backgroundColor);\n },\n font: {\n size: 12,\n weight: 700,\n },\n padding: 2,\n },\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const palette = getComputedColorPalette(\n ctx.options?.colorPalette || 'categorical'\n );\n\n return {\n backgroundColor: function (context) {\n const Dataset = context.dataset;\n const dataIndex =\n typeof context.dataIndex === 'number' ? context.dataIndex : 0;\n const paletteLen = (palette && palette.length) || 1;\n\n if (Dataset && Dataset.groups !== undefined) {\n const groupIndex = getGroupColorIndex(context);\n return palette[groupIndex % paletteLen];\n }\n\n const nested =\n typeof (Dataset && Dataset.tree) === 'object' &&\n !Array.isArray(Dataset && Dataset.tree);\n if (\n nested &&\n context.raw &&\n context.raw._data &&\n typeof context.raw._data.path === 'string'\n ) {\n const parent = String(context.raw._data.path).split('.')[0];\n const groups = Object.keys(Dataset.tree || {});\n const idx = Math.max(0, groups.indexOf(parent));\n return palette[idx % paletteLen];\n }\n\n return palette[dataIndex % paletteLen];\n },\n };\n};\n\n/**\n * The function `getGroupColorIndex` returns the index of a group color based on the context provided.\n * Works for grouped charts, not nested data charts yet.\n * @param context - The `context` parameter is an object that contains information about the current\n * context or state of the program. It is used to determine the group color index based on the dataset\n * and data index.\n * @returns the index of the group color for a given context.\n */\nconst getGroupColorIndex = (context) => {\n const Dataset = context.dataset;\n let index = 0;\n\n if (Dataset.groups !== undefined) {\n const DataIndex = context.dataIndex;\n const GroupKey = Dataset.groups ? Dataset.groups[0] : null;\n const Nested =\n typeof Dataset.tree === 'object' && !Array.isArray(Dataset.tree);\n let Groups = [];\n\n if (Nested) {\n Groups = Object.keys(Dataset.tree);\n\n if (context.raw) {\n const Path = context.raw._data.path;\n const Parent = Path.split('.')[0];\n\n index = Groups.indexOf(Parent);\n }\n } else {\n Dataset.tree.forEach((leaf) => {\n if (!Groups.includes(leaf[GroupKey])) {\n Groups.push(leaf[GroupKey]);\n }\n });\n\n const Leaf = Dataset.data[DataIndex];\n\n if (Leaf) {\n index = Groups.indexOf(Leaf._data[GroupKey]);\n }\n }\n }\n\n return index < 0 ? 0 : index;\n};\n"],"names":["type","options","ctx","plugins","legend","display","spacing","context","undefined","dataset","groups","borderWidth","borderColor","getTokenThemeVal","labels","align","color","getTextColor","element","backgroundColor","font","size","weight","position","overflow","captions","padding","datasetOptions","index","palette","getComputedColorPalette","colorPalette","Dataset","dataIndex","paletteLen","length","groupIndex","getGroupColorIndex","tree","Array","isArray","raw","_data","path","parent","String","split","Object","keys","idx","Math","max","indexOf","DataIndex","GroupKey","Nested","Groups","Parent","forEach","leaf","includes","push","Leaf","data"],"mappings":"wNAIY,MAACA,EAAO,UAEPC,EAAWC,IAGf,CACLC,QAAS,CACPC,OAAQ,CACNC,SAAS,IAGbC,QAAS,SAAUC,GAIjB,YAFmCC,IADnBD,EAAQE,QACAC,OAEP,EAAI,
|
|
1
|
+
{"version":3,"file":"treemap.js","sources":["../../../../src/common/config/chartTypes/treemap.js"],"sourcesContent":["import { getComputedColorPalette } from '../colorPalettes';\nimport { getTextColor } from '../../helpers/helpers';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nexport const type = 'treemap';\n\nexport const options = (ctx) => {\n const BorderColor = getTokenThemeVal('--kd-color-background-page-default');\n\n return {\n plugins: {\n legend: {\n display: false,\n },\n },\n spacing: function (context) {\n const Dataset = context.dataset;\n const Grouped = Dataset.groups !== undefined;\n\n return Grouped ? 0 : 1;\n },\n borderWidth: function (context) {\n const Dataset = context.dataset;\n return Dataset.groups ? 1 : 0;\n },\n borderColor: BorderColor,\n labels: {\n align: 'left',\n display: true,\n color: function (context) {\n return getTextColor(context.element.options.backgroundColor);\n },\n font: {\n size: 12,\n weight: 500,\n },\n position: 'top',\n overflow: 'hidden',\n },\n captions: {\n align: 'center',\n display: true,\n color: function (context) {\n return getTextColor(context.element.options.backgroundColor);\n },\n font: {\n size: 12,\n weight: 700,\n },\n padding: 2,\n },\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const palette = getComputedColorPalette(\n ctx.options?.colorPalette || 'categorical'\n );\n\n return {\n backgroundColor: function (context) {\n const Dataset = context.dataset;\n const dataIndex =\n typeof context.dataIndex === 'number' ? context.dataIndex : 0;\n const paletteLen = (palette && palette.length) || 1;\n\n if (Dataset && Dataset.groups !== undefined) {\n const groupIndex = getGroupColorIndex(context);\n return palette[groupIndex % paletteLen];\n }\n\n const nested =\n typeof (Dataset && Dataset.tree) === 'object' &&\n !Array.isArray(Dataset && Dataset.tree);\n if (\n nested &&\n context.raw &&\n context.raw._data &&\n typeof context.raw._data.path === 'string'\n ) {\n const parent = String(context.raw._data.path).split('.')[0];\n const groups = Object.keys(Dataset.tree || {});\n const idx = Math.max(0, groups.indexOf(parent));\n return palette[idx % paletteLen];\n }\n\n return palette[dataIndex % paletteLen];\n },\n };\n};\n\n/**\n * The function `getGroupColorIndex` returns the index of a group color based on the context provided.\n * Works for grouped charts, not nested data charts yet.\n * @param context - The `context` parameter is an object that contains information about the current\n * context or state of the program. It is used to determine the group color index based on the dataset\n * and data index.\n * @returns the index of the group color for a given context.\n */\nconst getGroupColorIndex = (context) => {\n const Dataset = context.dataset;\n let index = 0;\n\n if (Dataset.groups !== undefined) {\n const DataIndex = context.dataIndex;\n const GroupKey = Dataset.groups ? Dataset.groups[0] : null;\n const Nested =\n typeof Dataset.tree === 'object' && !Array.isArray(Dataset.tree);\n let Groups = [];\n\n if (Nested) {\n Groups = Object.keys(Dataset.tree);\n\n if (context.raw) {\n const Path = context.raw._data.path;\n const Parent = Path.split('.')[0];\n\n index = Groups.indexOf(Parent);\n }\n } else {\n Dataset.tree.forEach((leaf) => {\n if (!Groups.includes(leaf[GroupKey])) {\n Groups.push(leaf[GroupKey]);\n }\n });\n\n const Leaf = Dataset.data[DataIndex];\n\n if (Leaf) {\n index = Groups.indexOf(Leaf._data[GroupKey]);\n }\n }\n }\n\n return index < 0 ? 0 : index;\n};\n"],"names":["type","options","ctx","plugins","legend","display","spacing","context","undefined","dataset","groups","borderWidth","borderColor","getTokenThemeVal","labels","align","color","getTextColor","element","backgroundColor","font","size","weight","position","overflow","captions","padding","datasetOptions","index","palette","getComputedColorPalette","colorPalette","Dataset","dataIndex","paletteLen","length","groupIndex","getGroupColorIndex","tree","Array","isArray","raw","_data","path","parent","String","split","Object","keys","idx","Math","max","indexOf","DataIndex","GroupKey","Nested","Groups","Parent","forEach","leaf","includes","push","Leaf","data"],"mappings":"wNAIY,MAACA,EAAO,UAEPC,EAAWC,IAGf,CACLC,QAAS,CACPC,OAAQ,CACNC,SAAS,IAGbC,QAAS,SAAUC,GAIjB,YAFmCC,IADnBD,EAAQE,QACAC,OAEP,EAAI,CACvB,EACAC,YAAa,SAAUJ,GAErB,OADgBA,EAAQE,QACTC,OAAS,EAAI,CAC9B,EACAE,YAlBkBC,EAAiB,sCAmBnCC,OAAQ,CACNC,MAAO,OACPV,SAAS,EACTW,MAAO,SAAUT,GACf,OAAOU,EAAaV,EAAQW,QAAQjB,QAAQkB,gBAC9C,EACAC,KAAM,CACJC,KAAM,GACNC,OAAQ,KAEVC,SAAU,MACVC,SAAU,UAEZC,SAAU,CACRV,MAAO,SACPV,SAAS,EACTW,MAAO,SAAUT,GACf,OAAOU,EAAaV,EAAQW,QAAQjB,QAAQkB,gBAC9C,EACAC,KAAM,CACJC,KAAM,GACNC,OAAQ,KAEVI,QAAS,KAKFC,EAAiB,CAACzB,EAAK0B,KAClC,M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OI,SAASD,EAAKL,KACxBE,EAAOK,KAAKF,EAAKL,GACnB,IAGF,MAAMQ,EAAO9B,EAAQ+B,KAAKV,GAEtBS,IACFlC,EAAQ4B,EAAOJ,QAAQU,EAAKpB,MAAMY,IAEtC,CACF,CAEA,OAAO1B,EAAQ,EAAI,EAAIA,CAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"violin.js","sources":["../../../../src/common/config/chartTypes/violin.js"],"sourcesContent":["import Chart from 'chart.js/auto';\nimport { getComputedColorPalette } from '../colorPalettes';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\nimport {\n BoxPlotController,\n BoxAndWiskers,\n ViolinController,\n} from '@sgratzl/chartjs-chart-boxplot';\n\nChart.register(BoxPlotController, BoxAndWiskers, ViolinController);\n\nexport const type = 'violin';\nexport const defaultBorderWidth = 1;\nconst borderColor = getTokenThemeVal(\n '--kd-color-data-viz-neutral-border-primary'\n);\nconst meanMedianOutlierBackgroundColor = getTokenThemeVal(\n '--kd-color-data-viz-neutral-background-color'\n);\n\nexport const options = (ctx) => {\n const horizontal = ctx.options?.indexAxis === 'y';\n\n return {\n scales: {\n x: { grid: { display: horizontal } },\n y: { grid: { display: !horizontal } },\n },\n plugins: {\n legend: { display: true, position: 'bottom' },\n tooltip: {\n enabled: true,\n callbacks: {\n title: (items) => {\n const axisLabel = horizontal\n ? items[0].chart.options.scales.y.title?.text\n : items[0].chart.options.scales.x.title?.text;\n return axisLabel\n ? `${axisLabel}: ${items[0].label}`\n : items[0].label;\n },\n },\n },\n },\n elements: {\n boxplot: {\n borderWidth: defaultBorderWidth,\n backgroundColor: meanMedianOutlierBackgroundColor,\n lowerBackgroundColor: meanMedianOutlierBackgroundColor,\n upperBackgroundColor: meanMedianOutlierBackgroundColor,\n medianStyle: 'circle',\n medianRadius: 6,\n medianBorderWidth: defaultBorderWidth,\n medianBorderColor: borderColor,\n medianBackgroundColor: meanMedianOutlierBackgroundColor,\n },\n },\n ...ctx.options,\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const {\n colorPalette = 'categorical',\n backgroundAlpha = '95',\n pointCount = 100,\n violinWidth = 0.8,\n datasetOptionsOverride = {},\n } = ctx.options || {};\n\n const palette = getComputedColorPalette(colorPalette);\n const fill = palette[index % palette.length] + backgroundAlpha;\n\n return {\n backgroundColor: fill,\n borderColor: borderColor,\n borderWidth: defaultBorderWidth,\n meanStyle: 'circle',\n meanRadius: 4,\n meanBorderWidth: defaultBorderWidth,\n meanBorderColor: borderColor,\n meanBackgroundColor: meanMedianOutlierBackgroundColor,\n points: pointCount,\n width: violinWidth,\n lowerBackgroundColor: meanMedianOutlierBackgroundColor,\n upperBackgroundColor: meanMedianOutlierBackgroundColor,\n ...datasetOptionsOverride,\n };\n};\n\nexport const generateRandomData = (count, min, max, outliers = 0) => {\n const values = Array.from({ length: count }, () =>\n Math.floor(Math.random() * (max - min) + min)\n ).sort((a, b) => a - b);\n\n for (let i = 0; i < outliers; i++) {\n if (Math.random() > 0.5) {\n values.push(max + Math.floor(Math.random() * max * 0.5));\n } else {\n values.unshift(Math.max(0, min - Math.floor(Math.random() * min * 0.5)));\n }\n }\n\n return values;\n};\n"],"names":["Chart","register","BoxPlotController","BoxAndWiskers","ViolinController","type","defaultBorderWidth","borderColor","getTokenThemeVal","meanMedianOutlierBackgroundColor","options","ctx","horizontal","indexAxis","scales","x","grid","display","y","plugins","legend","position","tooltip","enabled","callbacks","title","items","axisLabel","chart","text","label","elements","boxplot","borderWidth","backgroundColor","lowerBackgroundColor","upperBackgroundColor","medianStyle","medianRadius","medianBorderWidth","medianBorderColor","medianBackgroundColor","datasetOptions","index","colorPalette","backgroundAlpha","pointCount","violinWidth","datasetOptionsOverride","palette","getComputedColorPalette","length","meanStyle","meanRadius","meanBorderWidth","meanBorderColor","meanBackgroundColor","points","width","generateRandomData","count","min","max","outliers","values","Array","from","Math","floor","random","sort","a","b","i","push","unshift"],"mappings":"ySASAA,EAAMC,SAASC,EAAmBC,EAAeC,GAErC,MAACC,EAAO,SACPC,EAAqB,EAC5BC,EAAcC,EAClB,8CAEIC,EAAmCD,EACvC,gDAGWE,EAAWC,IACtB,MAAMC,EAAwC,MAA3BD,EAAID,SAASG,UAEhC,MAAO,CACLC,OAAQ,CACNC,EAAG,CAAEC,KAAM,CAAEC,QAASL,IACtBM,EAAG,CAAEF,KAAM,CAAEC,SAAUL,KAEzBO,QAAS,CACPC,OAAQ,CAAEH,SAAS,EAAMI,SAAU,UACnCC,QAAS,CACPC,SAAS,EACTC,UAAW,CACTC,MAAQC,IACN,MAAMC,EAAYf,EACdc,EAAM,GAAGE,MAAMlB,QAAQI,OAAOI,EAAEO,OAAOI,KACvCH,EAAM,GAAGE,MAAMlB,QAAQI,OAAOC,EAAEU,OAAOI,KAC3C,OAAOF,EACH,GAAGA,MAAcD,EAAM,GAAGI,QAC1BJ,EAAM,GAAGI,KAAK,KAK1BC,SAAU,CACRC,QAAS,CACPC,YAlC0B,EAmC1BC,gBAAiBzB,EACjB0B,qBAAsB1B,EACtB2B,qBAAsB3B,EACtB4B,YAAa,SACbC,aAAc,EACdC,kBAxC0B,EAyC1BC,kBAAmBjC,EACnBkC,sBAAuBhC,OAGxBE,EAAID,QACR,EAGUgC,EAAiB,CAAC/B,EAAKgC,KAClC,MAAMC,aACJA,EAAe,cAAaC,gBAC5BA,EAAkB,KAAIC,WACtBA,EAAa,IAAGC,YAChBA,EAAc,GAAGC,uBACjBA,EAAyB,
|
|
1
|
+
{"version":3,"file":"violin.js","sources":["../../../../src/common/config/chartTypes/violin.js"],"sourcesContent":["import Chart from 'chart.js/auto';\nimport { getComputedColorPalette } from '../colorPalettes';\nimport { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\nimport {\n BoxPlotController,\n BoxAndWiskers,\n ViolinController,\n} from '@sgratzl/chartjs-chart-boxplot';\n\nChart.register(BoxPlotController, BoxAndWiskers, ViolinController);\n\nexport const type = 'violin';\nexport const defaultBorderWidth = 1;\nconst borderColor = getTokenThemeVal(\n '--kd-color-data-viz-neutral-border-primary'\n);\nconst meanMedianOutlierBackgroundColor = getTokenThemeVal(\n '--kd-color-data-viz-neutral-background-color'\n);\n\nexport const options = (ctx) => {\n const horizontal = ctx.options?.indexAxis === 'y';\n\n return {\n scales: {\n x: { grid: { display: horizontal } },\n y: { grid: { display: !horizontal } },\n },\n plugins: {\n legend: { display: true, position: 'bottom' },\n tooltip: {\n enabled: true,\n callbacks: {\n title: (items) => {\n const axisLabel = horizontal\n ? items[0].chart.options.scales.y.title?.text\n : items[0].chart.options.scales.x.title?.text;\n return axisLabel\n ? `${axisLabel}: ${items[0].label}`\n : items[0].label;\n },\n },\n },\n },\n elements: {\n boxplot: {\n borderWidth: defaultBorderWidth,\n backgroundColor: meanMedianOutlierBackgroundColor,\n lowerBackgroundColor: meanMedianOutlierBackgroundColor,\n upperBackgroundColor: meanMedianOutlierBackgroundColor,\n medianStyle: 'circle',\n medianRadius: 6,\n medianBorderWidth: defaultBorderWidth,\n medianBorderColor: borderColor,\n medianBackgroundColor: meanMedianOutlierBackgroundColor,\n },\n },\n ...ctx.options,\n };\n};\n\nexport const datasetOptions = (ctx, index) => {\n const {\n colorPalette = 'categorical',\n backgroundAlpha = '95',\n pointCount = 100,\n violinWidth = 0.8,\n datasetOptionsOverride = {},\n } = ctx.options || {};\n\n const palette = getComputedColorPalette(colorPalette);\n const fill = palette[index % palette.length] + backgroundAlpha;\n\n return {\n backgroundColor: fill,\n borderColor: borderColor,\n borderWidth: defaultBorderWidth,\n meanStyle: 'circle',\n meanRadius: 4,\n meanBorderWidth: defaultBorderWidth,\n meanBorderColor: borderColor,\n meanBackgroundColor: meanMedianOutlierBackgroundColor,\n points: pointCount,\n width: violinWidth,\n lowerBackgroundColor: meanMedianOutlierBackgroundColor,\n upperBackgroundColor: meanMedianOutlierBackgroundColor,\n ...datasetOptionsOverride,\n };\n};\n\nexport const generateRandomData = (count, min, max, outliers = 0) => {\n const values = Array.from({ length: count }, () =>\n Math.floor(Math.random() * (max - min) + min)\n ).sort((a, b) => a - b);\n\n for (let i = 0; i < outliers; i++) {\n if (Math.random() > 0.5) {\n values.push(max + Math.floor(Math.random() * max * 0.5));\n } else {\n values.unshift(Math.max(0, min - Math.floor(Math.random() * min * 0.5)));\n }\n }\n\n return values;\n};\n"],"names":["Chart","register","BoxPlotController","BoxAndWiskers","ViolinController","type","defaultBorderWidth","borderColor","getTokenThemeVal","meanMedianOutlierBackgroundColor","options","ctx","horizontal","indexAxis","scales","x","grid","display","y","plugins","legend","position","tooltip","enabled","callbacks","title","items","axisLabel","chart","text","label","elements","boxplot","borderWidth","backgroundColor","lowerBackgroundColor","upperBackgroundColor","medianStyle","medianRadius","medianBorderWidth","medianBorderColor","medianBackgroundColor","datasetOptions","index","colorPalette","backgroundAlpha","pointCount","violinWidth","datasetOptionsOverride","palette","getComputedColorPalette","length","meanStyle","meanRadius","meanBorderWidth","meanBorderColor","meanBackgroundColor","points","width","generateRandomData","count","min","max","outliers","values","Array","from","Math","floor","random","sort","a","b","i","push","unshift"],"mappings":"ySASAA,EAAMC,SAASC,EAAmBC,EAAeC,GAErC,MAACC,EAAO,SACPC,EAAqB,EAC5BC,EAAcC,EAClB,8CAEIC,EAAmCD,EACvC,gDAGWE,EAAWC,IACtB,MAAMC,EAAwC,MAA3BD,EAAID,SAASG,UAEhC,MAAO,CACLC,OAAQ,CACNC,EAAG,CAAEC,KAAM,CAAEC,QAASL,IACtBM,EAAG,CAAEF,KAAM,CAAEC,SAAUL,KAEzBO,QAAS,CACPC,OAAQ,CAAEH,SAAS,EAAMI,SAAU,UACnCC,QAAS,CACPC,SAAS,EACTC,UAAW,CACTC,MAAQC,IACN,MAAMC,EAAYf,EACdc,EAAM,GAAGE,MAAMlB,QAAQI,OAAOI,EAAEO,OAAOI,KACvCH,EAAM,GAAGE,MAAMlB,QAAQI,OAAOC,EAAEU,OAAOI,KAC3C,OAAOF,EACH,GAAGA,MAAcD,EAAM,GAAGI,QAC1BJ,EAAM,GAAGI,KAAK,KAK1BC,SAAU,CACRC,QAAS,CACPC,YAlC0B,EAmC1BC,gBAAiBzB,EACjB0B,qBAAsB1B,EACtB2B,qBAAsB3B,EACtB4B,YAAa,SACbC,aAAc,EACdC,kBAxC0B,EAyC1BC,kBAAmBjC,EACnBkC,sBAAuBhC,OAGxBE,EAAID,QACR,EAGUgC,EAAiB,CAAC/B,EAAKgC,KAClC,MAAMC,aACJA,EAAe,cAAaC,gBAC5BA,EAAkB,KAAIC,WACtBA,EAAa,IAAGC,YAChBA,EAAc,GAAGC,uBACjBA,EAAyB,CAAA,GACvBrC,EAAID,SAAW,CAAA,EAEbuC,EAAUC,EAAwBN,GAGxC,MAAO,CACLV,gBAHWe,EAAQN,EAAQM,EAAQE,QAAUN,EAI7CtC,YAAaA,EACb0B,YAhE8B,EAiE9BmB,UAAW,SACXC,WAAY,EACZC,gBAnE8B,EAoE9BC,gBAAiBhD,EACjBiD,oBAAqB/C,EACrBgD,OAAQX,EACRY,MAAOX,EACPZ,qBAAsB1B,EACtB2B,qBAAsB3B,KACnBuC,EACJ,EAGUW,EAAqB,CAACC,EAAOC,EAAKC,EAAKC,EAAW,KAC7D,MAAMC,EAASC,MAAMC,KAAK,CAAEf,OAAQS,IAAS,IAC3CO,KAAKC,MAAMD,KAAKE,UAAYP,EAAMD,GAAOA,KACzCS,MAAK,CAACC,EAAGC,IAAMD,EAAIC,IAErB,IAAK,IAAIC,EAAI,EAAGA,EAAIV,EAAUU,IACxBN,KAAKE,SAAW,GAClBL,EAAOU,KAAKZ,EAAMK,KAAKC,MAAMD,KAAKE,SAAWP,EAAM,KAEnDE,EAAOW,QAAQR,KAAKL,IAAI,EAAGD,EAAMM,KAAKC,MAAMD,KAAKE,SAAWR,EAAM,MAItE,OAAOG,CAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalOptions.js","sources":["../../../src/common/config/globalOptions.js"],"sourcesContent":["import { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nconst defaultConfig = (ctx) => {\n const PrimaryTextColor = getTokenThemeVal('--kd-color-text-level-primary');\n const SecondaryTextColor = getTokenThemeVal(\n '--kd-color-text-level-secondary'\n );\n const TooltipBgColor = getTokenThemeVal(\n '--kd-color-background-ui-default-dark'\n );\n const TooltipTextColor = getTokenThemeVal('--kd-color-text-variant-inversed');\n const ExplicitSize = ctx.height !== null || ctx.width !== null;\n\n return {\n resizeDelay: 50, //debounce the resize\n maintainAspectRatio: !ExplicitSize,\n plugins: {\n canvasBackground: {\n color: 'transparent',\n },\n legend: {\n display: false,\n position: 'bottom',\n labels: {\n color: PrimaryTextColor,\n boxWidth: 16,\n boxHeight: 16,\n borderRadius: 2,\n useBorderRadius: true,\n padding: 8,\n },\n },\n tooltip: {\n bodyColor: TooltipTextColor,\n footerColor: TooltipTextColor,\n titleColor: TooltipTextColor,\n backgroundColor: TooltipBgColor,\n multiKeyBackground: 'transparent',\n titleFont: {\n weight: '400',\n },\n footerFont: {\n weight: '400',\n },\n titleMarginBottom: 8,\n bodySpacing: 4,\n footerMarginTop: 10,\n cornerRadius: 2,\n boxWidth: 16,\n boxHeight: 16,\n boxPadding: 4,\n },\n datalabels: {\n display: false,\n color: SecondaryTextColor,\n },\n chartjs2music: {\n internal: {},\n cc: ctx.ccDiv,\n },\n },\n };\n};\n\nexport default defaultConfig;\n\n/**\n * The function `handleLegendHover` updates the background and border colors of a chart legend item\n * when it is hovered over.\n * @param e - The `e` parameter is an event object that represents the event that triggered the\n * function. It can be used to access information about the event, such as the target element or the\n * event type.\n * @param item - The `item` parameter represents the legend item that was hovered over. It contains\n * information about the dataset index and the index of the hovered item within that dataset.\n * @param legend - The `legend` parameter is the legend object of a chart. It contains information\n * about the chart's legend, such as the labels and colors of the legend items.\n */\nexport const handleLegendHover = (e, item, legend) => {\n const DatasetIndex = item.datasetIndex || 0;\n const Datasets = legend.chart.data.datasets;\n const Dataset = Datasets[DatasetIndex];\n const AlphaHexLength = 9; // includes #\n const Alpha = '4D'; // 30% opacity\n\n if (Array.isArray(Dataset.backgroundColor)) {\n Dataset.backgroundColor.forEach((color, index, colors) => {\n colors[index] =\n index === item.index || color.length === AlphaHexLength\n ? color\n : color + Alpha;\n });\n } else {\n Datasets.forEach((dataset, index) => {\n const backgroundColor = dataset.backgroundColor;\n const borderColor = dataset.borderColor;\n\n if (backgroundColor) {\n dataset.backgroundColor =\n index === DatasetIndex || backgroundColor.length === AlphaHexLength\n ? backgroundColor\n : backgroundColor + Alpha;\n }\n\n if (borderColor) {\n dataset.borderColor =\n index === DatasetIndex || borderColor.length === AlphaHexLength\n ? borderColor\n : borderColor + Alpha;\n }\n });\n }\n\n legend.chart.update();\n};\n\n/**\n * The function `handleLegendLeave` updates the background and border colors of a chart legend when the\n * mouse leaves the legend item.\n * @param e - The event object that triggered the legend leave event.\n * @param item - The `item` parameter represents the legend item that was interacted with. It contains\n * information about the dataset index and other properties related to the legend item.\n * @param legend - The `legend` parameter is the legend object of a chart. It contains information\n * about the chart's legend, such as the labels and colors of the legend items.\n */\nexport const handleLegendLeave = (e, item, legend) => {\n const DatasetIndex = item.datasetIndex || 0;\n const Datasets = legend.chart.data.datasets;\n const Dataset = Datasets[DatasetIndex];\n const AlphaHexLength = 9;\n\n if (Array.isArray(Dataset.backgroundColor)) {\n Dataset.backgroundColor.forEach((color, index, colors) => {\n colors[index] =\n color.length === AlphaHexLength ? color.slice(0, -2) : color;\n });\n } else {\n Datasets.forEach((dataset) => {\n const backgroundColor = dataset.backgroundColor;\n const borderColor = dataset.borderColor;\n\n if (backgroundColor) {\n dataset.backgroundColor =\n backgroundColor.length === AlphaHexLength\n ? backgroundColor.slice(0, -2)\n : backgroundColor;\n }\n\n if (borderColor) {\n dataset.borderColor =\n borderColor.length === AlphaHexLength\n ? borderColor.slice(0, -2)\n : borderColor;\n }\n });\n }\n\n legend.chart.update();\n};\n"],"names":["defaultConfig","ctx","PrimaryTextColor","getTokenThemeVal","SecondaryTextColor","TooltipBgColor","TooltipTextColor","resizeDelay","maintainAspectRatio","height","width","plugins","canvasBackground","color","legend","display","position","labels","boxWidth","boxHeight","borderRadius","useBorderRadius","padding","tooltip","bodyColor","footerColor","titleColor","backgroundColor","multiKeyBackground","titleFont","weight","footerFont","titleMarginBottom","bodySpacing","footerMarginTop","cornerRadius","boxPadding","datalabels","chartjs2music","internal","cc","ccDiv"],"mappings":"kGAEK,MAACA,EAAiBC,IACrB,MAAMC,EAAmBC,EAAiB,iCACpCC,EAAqBD,EACzB,mCAEIE,EAAiBF,EACrB,yCAEIG,EAAmBH,EAAiB,oCAG1C,MAAO,CACLI,YAAa,GACbC,sBAJkC,OAAfP,EAAIQ,QAAiC,OAAdR,EAAIS,OAK9CC,QAAS,CACPC,iBAAkB,CAChBC,MAAO,eAETC,OAAQ,CACNC,SAAS,EACTC,SAAU,SACVC,OAAQ,CACNJ,MAAOX,EACPgB,SAAU,GACVC,UAAW,GACXC,aAAc,EACdC,iBAAiB,EACjBC,QAAS,IAGbC,QAAS,CACPC,UAAWlB,EACXmB,YAAanB,EACboB,WAAYpB,EACZqB,gBAAiBtB,EACjBuB,mBAAoB,cACpBC,UAAW,CACTC,OAAQ,OAEVC,WAAY,CACVD,OAAQ,OAEVE,kBAAmB,EACnBC,YAAa,EACbC,gBAAiB,GACjBC,aAAc,EACdjB,SAAU,GACVC,UAAW,GACXiB,WAAY,GAEdC,WAAY,CACVtB,SAAS,EACTF,MAAOT,GAETkC,cAAe,CACbC,SAAU,
|
|
1
|
+
{"version":3,"file":"globalOptions.js","sources":["../../../src/common/config/globalOptions.js"],"sourcesContent":["import { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nconst defaultConfig = (ctx) => {\n const PrimaryTextColor = getTokenThemeVal('--kd-color-text-level-primary');\n const SecondaryTextColor = getTokenThemeVal(\n '--kd-color-text-level-secondary'\n );\n const TooltipBgColor = getTokenThemeVal(\n '--kd-color-background-ui-default-dark'\n );\n const TooltipTextColor = getTokenThemeVal('--kd-color-text-variant-inversed');\n const ExplicitSize = ctx.height !== null || ctx.width !== null;\n\n return {\n resizeDelay: 50, //debounce the resize\n maintainAspectRatio: !ExplicitSize,\n plugins: {\n canvasBackground: {\n color: 'transparent',\n },\n legend: {\n display: false,\n position: 'bottom',\n labels: {\n color: PrimaryTextColor,\n boxWidth: 16,\n boxHeight: 16,\n borderRadius: 2,\n useBorderRadius: true,\n padding: 8,\n },\n },\n tooltip: {\n bodyColor: TooltipTextColor,\n footerColor: TooltipTextColor,\n titleColor: TooltipTextColor,\n backgroundColor: TooltipBgColor,\n multiKeyBackground: 'transparent',\n titleFont: {\n weight: '400',\n },\n footerFont: {\n weight: '400',\n },\n titleMarginBottom: 8,\n bodySpacing: 4,\n footerMarginTop: 10,\n cornerRadius: 2,\n boxWidth: 16,\n boxHeight: 16,\n boxPadding: 4,\n },\n datalabels: {\n display: false,\n color: SecondaryTextColor,\n },\n chartjs2music: {\n internal: {},\n cc: ctx.ccDiv,\n },\n },\n };\n};\n\nexport default defaultConfig;\n\n/**\n * The function `handleLegendHover` updates the background and border colors of a chart legend item\n * when it is hovered over.\n * @param e - The `e` parameter is an event object that represents the event that triggered the\n * function. It can be used to access information about the event, such as the target element or the\n * event type.\n * @param item - The `item` parameter represents the legend item that was hovered over. It contains\n * information about the dataset index and the index of the hovered item within that dataset.\n * @param legend - The `legend` parameter is the legend object of a chart. It contains information\n * about the chart's legend, such as the labels and colors of the legend items.\n */\nexport const handleLegendHover = (e, item, legend) => {\n const DatasetIndex = item.datasetIndex || 0;\n const Datasets = legend.chart.data.datasets;\n const Dataset = Datasets[DatasetIndex];\n const AlphaHexLength = 9; // includes #\n const Alpha = '4D'; // 30% opacity\n\n if (Array.isArray(Dataset.backgroundColor)) {\n Dataset.backgroundColor.forEach((color, index, colors) => {\n colors[index] =\n index === item.index || color.length === AlphaHexLength\n ? color\n : color + Alpha;\n });\n } else {\n Datasets.forEach((dataset, index) => {\n const backgroundColor = dataset.backgroundColor;\n const borderColor = dataset.borderColor;\n\n if (backgroundColor) {\n dataset.backgroundColor =\n index === DatasetIndex || backgroundColor.length === AlphaHexLength\n ? backgroundColor\n : backgroundColor + Alpha;\n }\n\n if (borderColor) {\n dataset.borderColor =\n index === DatasetIndex || borderColor.length === AlphaHexLength\n ? borderColor\n : borderColor + Alpha;\n }\n });\n }\n\n legend.chart.update();\n};\n\n/**\n * The function `handleLegendLeave` updates the background and border colors of a chart legend when the\n * mouse leaves the legend item.\n * @param e - The event object that triggered the legend leave event.\n * @param item - The `item` parameter represents the legend item that was interacted with. It contains\n * information about the dataset index and other properties related to the legend item.\n * @param legend - The `legend` parameter is the legend object of a chart. It contains information\n * about the chart's legend, such as the labels and colors of the legend items.\n */\nexport const handleLegendLeave = (e, item, legend) => {\n const DatasetIndex = item.datasetIndex || 0;\n const Datasets = legend.chart.data.datasets;\n const Dataset = Datasets[DatasetIndex];\n const AlphaHexLength = 9;\n\n if (Array.isArray(Dataset.backgroundColor)) {\n Dataset.backgroundColor.forEach((color, index, colors) => {\n colors[index] =\n color.length === AlphaHexLength ? color.slice(0, -2) : color;\n });\n } else {\n Datasets.forEach((dataset) => {\n const backgroundColor = dataset.backgroundColor;\n const borderColor = dataset.borderColor;\n\n if (backgroundColor) {\n dataset.backgroundColor =\n backgroundColor.length === AlphaHexLength\n ? backgroundColor.slice(0, -2)\n : backgroundColor;\n }\n\n if (borderColor) {\n dataset.borderColor =\n borderColor.length === AlphaHexLength\n ? borderColor.slice(0, -2)\n : borderColor;\n }\n });\n }\n\n legend.chart.update();\n};\n"],"names":["defaultConfig","ctx","PrimaryTextColor","getTokenThemeVal","SecondaryTextColor","TooltipBgColor","TooltipTextColor","resizeDelay","maintainAspectRatio","height","width","plugins","canvasBackground","color","legend","display","position","labels","boxWidth","boxHeight","borderRadius","useBorderRadius","padding","tooltip","bodyColor","footerColor","titleColor","backgroundColor","multiKeyBackground","titleFont","weight","footerFont","titleMarginBottom","bodySpacing","footerMarginTop","cornerRadius","boxPadding","datalabels","chartjs2music","internal","cc","ccDiv"],"mappings":"kGAEK,MAACA,EAAiBC,IACrB,MAAMC,EAAmBC,EAAiB,iCACpCC,EAAqBD,EACzB,mCAEIE,EAAiBF,EACrB,yCAEIG,EAAmBH,EAAiB,oCAG1C,MAAO,CACLI,YAAa,GACbC,sBAJkC,OAAfP,EAAIQ,QAAiC,OAAdR,EAAIS,OAK9CC,QAAS,CACPC,iBAAkB,CAChBC,MAAO,eAETC,OAAQ,CACNC,SAAS,EACTC,SAAU,SACVC,OAAQ,CACNJ,MAAOX,EACPgB,SAAU,GACVC,UAAW,GACXC,aAAc,EACdC,iBAAiB,EACjBC,QAAS,IAGbC,QAAS,CACPC,UAAWlB,EACXmB,YAAanB,EACboB,WAAYpB,EACZqB,gBAAiBtB,EACjBuB,mBAAoB,cACpBC,UAAW,CACTC,OAAQ,OAEVC,WAAY,CACVD,OAAQ,OAEVE,kBAAmB,EACnBC,YAAa,EACbC,gBAAiB,GACjBC,aAAc,EACdjB,SAAU,GACVC,UAAW,GACXiB,WAAY,GAEdC,WAAY,CACVtB,SAAS,EACTF,MAAOT,GAETkC,cAAe,CACbC,SAAU,CAAA,EACVC,GAAIvC,EAAIwC,QAGb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalOptionsNonRadial.js","sources":["../../../src/common/config/globalOptionsNonRadial.js"],"sourcesContent":["import { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nconst defaultConfig = (ctx) => {\n const GridLinesColor = getTokenThemeVal('--kd-color-border-variants-light');\n const AxisTextColor = getTokenThemeVal('--kd-color-text-level-primary');\n\n const MultiAxis =\n ctx.options.scales && Object.keys(ctx.options.scales).length > 2;\n\n const CommonAxisOptions = {\n grid: {\n drawTicks: false,\n color: GridLinesColor,\n },\n ticks: {\n padding: 8,\n color: AxisTextColor,\n },\n border: {\n display: false,\n },\n title: {\n color: AxisTextColor,\n display: true,\n },\n };\n\n const options = {\n scales: {\n x: {\n title: {\n display: true,\n text: 'X Axis ',\n padding: 8,\n },\n ...CommonAxisOptions,\n },\n y: {\n title: {\n display: true,\n text: 'Y Axis ',\n padding: { bottom: 8, top: 0 },\n },\n ...CommonAxisOptions,\n },\n },\n plugins: {\n tooltip: {\n callbacks: {\n labelColor: function (context) {\n const PerDatapointColors = Array.isArray(\n context.dataset.backgroundColor\n );\n const IsFunction =\n typeof context.dataset.backgroundColor == 'function';\n const BgColor = IsFunction\n ? context.dataset.borderColor + '80'\n : context.dataset.backgroundColor;\n\n return {\n borderColor: context.dataset.borderColor,\n backgroundColor: PerDatapointColors\n ? BgColor[context.dataIndex]\n : BgColor,\n borderRadius: 2,\n };\n },\n },\n },\n },\n };\n\n if (MultiAxis) {\n const ThirdAxisId = Object.keys(ctx.options.scales).find(\n (scaleId) => scaleId !== 'x' && scaleId !== 'y'\n );\n\n options.scales[ThirdAxisId] = {\n title: {\n display: true,\n padding: { bottom: 8, top: 0 },\n },\n position: 'right',\n grid: {\n drawOnChartArea: false,\n drawTicks: false,\n color: GridLinesColor,\n },\n border: {\n display: false,\n },\n };\n }\n\n return options;\n};\n\nexport default defaultConfig;\n"],"names":["defaultConfig","ctx","GridLinesColor","getTokenThemeVal","AxisTextColor","MultiAxis","options","scales","Object","keys","length","CommonAxisOptions","grid","drawTicks","color","ticks","padding","border","display","title","x","text","y","bottom","top","plugins","tooltip","callbacks","labelColor","context","PerDatapointColors","Array","isArray","dataset","backgroundColor","BgColor","borderColor","dataIndex","borderRadius","ThirdAxisId","find","scaleId","position","drawOnChartArea"],"mappings":"kGAEK,MAACA,EAAiBC,IACrB,MAAMC,EAAiBC,EAAiB,oCAClCC,EAAgBD,EAAiB,iCAEjCE,EACJJ,EAAIK,QAAQC,QAAUC,OAAOC,KAAKR,EAAIK,QAAQC,QAAQG,OAAS,EAE3DC,EAAoB,CACxBC,KAAM,CACJC,WAAW,EACXC,MAAOZ,GAETa,MAAO,CACLC,QAAS,EACTF,MAAOV,GAETa,OAAQ,CACNC,SAAS,GAEXC,MAAO,CACLL,MAAOV,EACPc,SAAS,IAIPZ,EAAU,CACdC,OAAQ,CACNa,EAAG,CACDD,MAAO,CACLD,SAAS,EACTG,KAAM,UACNL,QAAS,MAERL,GAELW,EAAG,CACDH,MAAO,CACLD,SAAS,EACTG,KAAM,UACNL,QAAS,CAAEO,OAAQ,EAAGC,IAAK,OAE1Bb,IAGPc,QAAS,CACPC,QAAS,CACPC,UAAW,CACTC,WAAY,SAAUC,GACpB,MAAMC,EAAqBC,MAAMC,QAC/BH,EAAQI,QAAQC,iBAIZC,EADsC,mBAAnCN,EAAQI,QAAQC,gBAErBL,EAAQI,QAAQG,YAAc,KAC9BP,EAAQI,QAAQC,gBAEpB,MAAO,CACLE,YAAaP,EAAQI,QAAQG,YAC7BF,gBAAiBJ,EACbK,EAAQN,EAAQQ,WAChBF,EACJG,aAAc,
|
|
1
|
+
{"version":3,"file":"globalOptionsNonRadial.js","sources":["../../../src/common/config/globalOptionsNonRadial.js"],"sourcesContent":["import { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nconst defaultConfig = (ctx) => {\n const GridLinesColor = getTokenThemeVal('--kd-color-border-variants-light');\n const AxisTextColor = getTokenThemeVal('--kd-color-text-level-primary');\n\n const MultiAxis =\n ctx.options.scales && Object.keys(ctx.options.scales).length > 2;\n\n const CommonAxisOptions = {\n grid: {\n drawTicks: false,\n color: GridLinesColor,\n },\n ticks: {\n padding: 8,\n color: AxisTextColor,\n },\n border: {\n display: false,\n },\n title: {\n color: AxisTextColor,\n display: true,\n },\n };\n\n const options = {\n scales: {\n x: {\n title: {\n display: true,\n text: 'X Axis ',\n padding: 8,\n },\n ...CommonAxisOptions,\n },\n y: {\n title: {\n display: true,\n text: 'Y Axis ',\n padding: { bottom: 8, top: 0 },\n },\n ...CommonAxisOptions,\n },\n },\n plugins: {\n tooltip: {\n callbacks: {\n labelColor: function (context) {\n const PerDatapointColors = Array.isArray(\n context.dataset.backgroundColor\n );\n const IsFunction =\n typeof context.dataset.backgroundColor == 'function';\n const BgColor = IsFunction\n ? context.dataset.borderColor + '80'\n : context.dataset.backgroundColor;\n\n return {\n borderColor: context.dataset.borderColor,\n backgroundColor: PerDatapointColors\n ? BgColor[context.dataIndex]\n : BgColor,\n borderRadius: 2,\n };\n },\n },\n },\n },\n };\n\n if (MultiAxis) {\n const ThirdAxisId = Object.keys(ctx.options.scales).find(\n (scaleId) => scaleId !== 'x' && scaleId !== 'y'\n );\n\n options.scales[ThirdAxisId] = {\n title: {\n display: true,\n padding: { bottom: 8, top: 0 },\n },\n position: 'right',\n grid: {\n drawOnChartArea: false,\n drawTicks: false,\n color: GridLinesColor,\n },\n border: {\n display: false,\n },\n };\n }\n\n return options;\n};\n\nexport default defaultConfig;\n"],"names":["defaultConfig","ctx","GridLinesColor","getTokenThemeVal","AxisTextColor","MultiAxis","options","scales","Object","keys","length","CommonAxisOptions","grid","drawTicks","color","ticks","padding","border","display","title","x","text","y","bottom","top","plugins","tooltip","callbacks","labelColor","context","PerDatapointColors","Array","isArray","dataset","backgroundColor","BgColor","borderColor","dataIndex","borderRadius","ThirdAxisId","find","scaleId","position","drawOnChartArea"],"mappings":"kGAEK,MAACA,EAAiBC,IACrB,MAAMC,EAAiBC,EAAiB,oCAClCC,EAAgBD,EAAiB,iCAEjCE,EACJJ,EAAIK,QAAQC,QAAUC,OAAOC,KAAKR,EAAIK,QAAQC,QAAQG,OAAS,EAE3DC,EAAoB,CACxBC,KAAM,CACJC,WAAW,EACXC,MAAOZ,GAETa,MAAO,CACLC,QAAS,EACTF,MAAOV,GAETa,OAAQ,CACNC,SAAS,GAEXC,MAAO,CACLL,MAAOV,EACPc,SAAS,IAIPZ,EAAU,CACdC,OAAQ,CACNa,EAAG,CACDD,MAAO,CACLD,SAAS,EACTG,KAAM,UACNL,QAAS,MAERL,GAELW,EAAG,CACDH,MAAO,CACLD,SAAS,EACTG,KAAM,UACNL,QAAS,CAAEO,OAAQ,EAAGC,IAAK,OAE1Bb,IAGPc,QAAS,CACPC,QAAS,CACPC,UAAW,CACTC,WAAY,SAAUC,GACpB,MAAMC,EAAqBC,MAAMC,QAC/BH,EAAQI,QAAQC,iBAIZC,EADsC,mBAAnCN,EAAQI,QAAQC,gBAErBL,EAAQI,QAAQG,YAAc,KAC9BP,EAAQI,QAAQC,gBAEpB,MAAO,CACLE,YAAaP,EAAQI,QAAQG,YAC7BF,gBAAiBJ,EACbK,EAAQN,EAAQQ,WAChBF,EACJG,aAAc,EAElB,MAMR,GAAIjC,EAAW,CACb,MAAMkC,EAAc/B,OAAOC,KAAKR,EAAIK,QAAQC,QAAQiC,MACjDC,GAAwB,MAAZA,GAA+B,MAAZA,IAGlCnC,EAAQC,OAAOgC,GAAe,CAC5BpB,MAAO,CACLD,SAAS,EACTF,QAAS,CAAEO,OAAQ,EAAGC,IAAK,IAE7BkB,SAAU,QACV9B,KAAM,CACJ+B,iBAAiB,EACjB9B,WAAW,EACXC,MAAOZ,GAETe,OAAQ,CACNC,SAAS,GAGf,CAEA,OAAOZ,CAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalOptionsRadial.js","sources":["../../../src/common/config/globalOptionsRadial.js"],"sourcesContent":["import { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nconst defaultConfig = (ctx) => {\n const ArcColor = getTokenThemeVal('--kd-color-background-page-default');\n const AxisTextColor = getTokenThemeVal('--kd-color-text-level-primary');\n\n const scales = {\n x: {\n title: { text: 'X Axis', color: AxisTextColor },\n grid: { display: false },\n ticks: { display: false, color: AxisTextColor },\n border: { display: false },\n },\n y: {\n title: { text: 'Y Axis', color: AxisTextColor },\n grid: { display: false },\n ticks: { display: false, color: AxisTextColor },\n border: { display: false },\n },\n };\n\n const chartType = ctx.type || ctx.chart?.config.type;\n if (chartType === 'radar' || chartType === 'polarArea') {\n scales.r = {\n grid: { display: true },\n angleLines: { display: true },\n ticks: { color: AxisTextColor },\n pointLabels: { color: AxisTextColor },\n };\n }\n\n return {\n elements: {\n arc: { borderColor: ArcColor },\n },\n scales,\n plugins: {\n tooltip: {\n callbacks: {\n labelColor(context) {\n const bg = context.dataset.backgroundColor;\n const perPoint = Array.isArray(bg);\n return {\n borderColor: context.dataset.borderColor,\n backgroundColor: perPoint ? bg[context.dataIndex] : bg,\n borderRadius: 2,\n };\n },\n },\n },\n },\n };\n};\n\nexport default defaultConfig;\n"],"names":["defaultConfig","ctx","ArcColor","getTokenThemeVal","AxisTextColor","scales","x","title","text","color","grid","display","ticks","border","y","chartType","type","chart","config","r","angleLines","pointLabels","elements","arc","borderColor","plugins","tooltip","callbacks","labelColor","context","bg","dataset","backgroundColor","perPoint","Array","isArray","dataIndex","borderRadius"],"mappings":"kGAEK,MAACA,EAAiBC,IACrB,MAAMC,EAAWC,EAAiB,sCAC5BC,EAAgBD,EAAiB,iCAEjCE,EAAS,CACbC,EAAG,CACDC,MAAO,CAAEC,KAAM,SAAUC,MAAOL,GAChCM,KAAM,CAAEC,SAAS,GACjBC,MAAO,CAAED,SAAS,EAAOF,MAAOL,GAChCS,OAAQ,CAAEF,SAAS,IAErBG,EAAG,CACDP,MAAO,CAAEC,KAAM,SAAUC,MAAOL,GAChCM,KAAM,CAAEC,SAAS,GACjBC,MAAO,CAAED,SAAS,EAAOF,MAAOL,GAChCS,OAAQ,CAAEF,SAAS,KAIjBI,EAAYd,EAAIe,MAAQf,EAAIgB,OAAOC,OAAOF,KAUhD,MATkB,UAAdD,GAAuC,cAAdA,IAC3BV,EAAOc,EAAI,CACTT,KAAM,CAAEC,SAAS,GACjBS,WAAY,CAAET,SAAS,GACvBC,MAAO,CAAEH,MAAOL,GAChBiB,YAAa,CAAEZ,MAAOL,KAInB,CACLkB,SAAU,CACRC,IAAK,CAAEC,YAAatB,IAEtBG,SACAoB,QAAS,CACPC,QAAS,CACPC,UAAW,CACT,UAAAC,CAAWC,GACT,MAAMC,EAAKD,EAAQE,QAAQC,gBACrBC,EAAWC,MAAMC,QAAQL,GAC/B,MAAO,CACLN,YAAaK,EAAQE,QAAQP,YAC7BQ,gBAAiBC,EAAWH,EAAGD,EAAQO,WAAaN,EACpDO,aAAc,
|
|
1
|
+
{"version":3,"file":"globalOptionsRadial.js","sources":["../../../src/common/config/globalOptionsRadial.js"],"sourcesContent":["import { getTokenThemeVal } from '@kyndryl-design-system/shidoka-foundation/common/helpers/color';\n\nconst defaultConfig = (ctx) => {\n const ArcColor = getTokenThemeVal('--kd-color-background-page-default');\n const AxisTextColor = getTokenThemeVal('--kd-color-text-level-primary');\n\n const scales = {\n x: {\n title: { text: 'X Axis', color: AxisTextColor },\n grid: { display: false },\n ticks: { display: false, color: AxisTextColor },\n border: { display: false },\n },\n y: {\n title: { text: 'Y Axis', color: AxisTextColor },\n grid: { display: false },\n ticks: { display: false, color: AxisTextColor },\n border: { display: false },\n },\n };\n\n const chartType = ctx.type || ctx.chart?.config.type;\n if (chartType === 'radar' || chartType === 'polarArea') {\n scales.r = {\n grid: { display: true },\n angleLines: { display: true },\n ticks: { color: AxisTextColor },\n pointLabels: { color: AxisTextColor },\n };\n }\n\n return {\n elements: {\n arc: { borderColor: ArcColor },\n },\n scales,\n plugins: {\n tooltip: {\n callbacks: {\n labelColor(context) {\n const bg = context.dataset.backgroundColor;\n const perPoint = Array.isArray(bg);\n return {\n borderColor: context.dataset.borderColor,\n backgroundColor: perPoint ? bg[context.dataIndex] : bg,\n borderRadius: 2,\n };\n },\n },\n },\n },\n };\n};\n\nexport default defaultConfig;\n"],"names":["defaultConfig","ctx","ArcColor","getTokenThemeVal","AxisTextColor","scales","x","title","text","color","grid","display","ticks","border","y","chartType","type","chart","config","r","angleLines","pointLabels","elements","arc","borderColor","plugins","tooltip","callbacks","labelColor","context","bg","dataset","backgroundColor","perPoint","Array","isArray","dataIndex","borderRadius"],"mappings":"kGAEK,MAACA,EAAiBC,IACrB,MAAMC,EAAWC,EAAiB,sCAC5BC,EAAgBD,EAAiB,iCAEjCE,EAAS,CACbC,EAAG,CACDC,MAAO,CAAEC,KAAM,SAAUC,MAAOL,GAChCM,KAAM,CAAEC,SAAS,GACjBC,MAAO,CAAED,SAAS,EAAOF,MAAOL,GAChCS,OAAQ,CAAEF,SAAS,IAErBG,EAAG,CACDP,MAAO,CAAEC,KAAM,SAAUC,MAAOL,GAChCM,KAAM,CAAEC,SAAS,GACjBC,MAAO,CAAED,SAAS,EAAOF,MAAOL,GAChCS,OAAQ,CAAEF,SAAS,KAIjBI,EAAYd,EAAIe,MAAQf,EAAIgB,OAAOC,OAAOF,KAUhD,MATkB,UAAdD,GAAuC,cAAdA,IAC3BV,EAAOc,EAAI,CACTT,KAAM,CAAEC,SAAS,GACjBS,WAAY,CAAET,SAAS,GACvBC,MAAO,CAAEH,MAAOL,GAChBiB,YAAa,CAAEZ,MAAOL,KAInB,CACLkB,SAAU,CACRC,IAAK,CAAEC,YAAatB,IAEtBG,SACAoB,QAAS,CACPC,QAAS,CACPC,UAAW,CACT,UAAAC,CAAWC,GACT,MAAMC,EAAKD,EAAQE,QAAQC,gBACrBC,EAAWC,MAAMC,QAAQL,GAC/B,MAAO,CACLN,YAAaK,EAAQE,QAAQP,YAC7BQ,gBAAiBC,EAAWH,EAAGD,EAAQO,WAAaN,EACpDO,aAAc,EAElB,KAIP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphTreeTableRenderer.d.ts","sourceRoot":"","sources":["../../../src/common/helpers/graphTreeTableRenderer.ts"],"names":[],"mappings":"AAEA,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,EAAE,wCAoEnD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{html as t}from"lit";function r(r){var a;if(!r||!r.length||!(null===(a=r[0])||void 0===a?void 0:a.data))return t`
|
|
2
|
+
<thead>
|
|
3
|
+
<tr>
|
|
4
|
+
<th>No data available</th>
|
|
5
|
+
</tr>
|
|
6
|
+
</thead>
|
|
7
|
+
<tbody>
|
|
8
|
+
<tr>
|
|
9
|
+
<td>No data available for display</td>
|
|
10
|
+
</tr>
|
|
11
|
+
</tbody>
|
|
12
|
+
`;const e=r[0].data,n=(t,r=new Set)=>{if(r.has(t))return 0;r.add(t);const a=e[t];return a&&null!==a.parent&&void 0!==a.parent?1+n(a.parent,r):0};return t`
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>Parent Name</th>
|
|
16
|
+
<th>Depth/Level</th>
|
|
17
|
+
<th>Children Count</th>
|
|
18
|
+
</tr>
|
|
19
|
+
</thead>
|
|
20
|
+
<tbody>
|
|
21
|
+
${e.map(((r,a)=>{const d=n(a),o=(t=>{if(null==t)return"Root";const r=e[t];return r?r.name:`Unknown (${t})`})(r.parent),h=(l=a,e.filter((t=>t.parent===l)).length);var l;return t`
|
|
22
|
+
<tr class="depth-${d}">
|
|
23
|
+
<td>${o}</td>
|
|
24
|
+
<td>${d}</td>
|
|
25
|
+
<td>${h}</td>
|
|
26
|
+
</tr>
|
|
27
|
+
`}))}
|
|
28
|
+
</tbody>
|
|
29
|
+
`}export{r as renderGraphTreeTable};
|
|
30
|
+
//# sourceMappingURL=graphTreeTableRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphTreeTableRenderer.js","sources":["../../../src/common/helpers/graphTreeTableRenderer.ts"],"sourcesContent":["import { html } from 'lit';\n\nexport function renderGraphTreeTable(datasets: any[]) {\n if (!datasets || !datasets.length || !datasets[0]?.data) {\n return html`\n <thead>\n <tr>\n <th>No data available</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>No data available for display</td>\n </tr>\n </tbody>\n `;\n }\n\n const data = datasets[0].data;\n\n // get parent name by index\n const getParentName = (parentIndex: number | null): string => {\n if (parentIndex === null || parentIndex === undefined) {\n return 'Root';\n }\n const parent = data[parentIndex];\n return parent ? parent.name : `Unknown (${parentIndex})`;\n };\n\n // calculate depth/level\n const getDepth = (index: number, visited = new Set()): number => {\n if (visited.has(index)) return 0;\n visited.add(index);\n\n const item = data[index];\n if (!item || item.parent === null || item.parent === undefined) {\n return 0;\n }\n return 1 + getDepth(item.parent, visited);\n };\n\n // get children count\n const getChildrenCount = (parentIndex: number): number => {\n return data.filter((item: any) => item.parent === parentIndex).length;\n };\n\n return html`\n <thead>\n <tr>\n <th>Parent Name</th>\n <th>Depth/Level</th>\n <th>Children Count</th>\n </tr>\n </thead>\n <tbody>\n ${data.map((item: any, index: number) => {\n const depth = getDepth(index);\n const parentName = getParentName(item.parent);\n const childrenCount = getChildrenCount(index);\n\n return html`\n <tr class=\"depth-${depth}\">\n <td>${parentName}</td>\n <td>${depth}</td>\n <td>${childrenCount}</td>\n </tr>\n `;\n })}\n </tbody>\n `;\n}\n"],"names":["renderGraphTreeTable","datasets","length","_a","data","html","getDepth","index","visited","Set","has","add","item","parent","undefined","map","depth","parentName","parentIndex","name","getParentName","childrenCount","filter"],"mappings":"2BAEM,SAAUA,EAAqBC,SACnC,IAAKA,IAAaA,EAASC,kBAAWC,EAAAF,EAAS,yBAAIG,MACjD,OAAOC,CAAI;;;;;;;;;;;MAcb,MAAMD,EAAOH,EAAS,GAAGG,KAYnBE,EAAW,CAACC,EAAeC,EAAU,IAAIC,OAC7C,GAAID,EAAQE,IAAIH,GAAQ,OAAO,EAC/BC,EAAQG,IAAIJ,GAEZ,MAAMK,EAAOR,EAAKG,GAClB,OAAKK,GAAwB,OAAhBA,EAAKC,aAAmCC,IAAhBF,EAAKC,OAGnC,EAAIP,EAASM,EAAKC,OAAQL,GAFxB,CAEgC,EAQ3C,OAAOH,CAAI;;;;;;;;;QASLD,EAAKW,KAAI,CAACH,EAAWL,KACrB,MAAMS,EAAQV,EAASC,GACjBU,EApCU,CAACC,IACrB,GAAIA,QACF,MAAO,OAET,MAAML,EAAST,EAAKc,GACpB,OAAOL,EAASA,EAAOM,KAAO,YAAYD,IAAc,EA+BjCE,CAAcR,EAAKC,QAChCQ,GAhBcH,EAgBmBX,EAfpCH,EAAKkB,QAAQV,GAAcA,EAAKC,SAAWK,IAAahB,QADxC,IAACgB,EAkBpB,OAAOb,CAAI;6BACUW;kBACXC;kBACAD;kBACAK;;SAET;;GAIT"}
|
|
@@ -21,4 +21,5 @@ export declare function getRandomData(arrayLength?: number, min?: number, max?:
|
|
|
21
21
|
* returns the inversed text color (InverseTextColor).
|
|
22
22
|
*/
|
|
23
23
|
export declare function getTextColor(bgHexColor: string): "#3d3c3c" | "#f9f9f9";
|
|
24
|
+
export declare function convertTreeDataToCSV(datasets: any[]): string;
|
|
24
25
|
//# sourceMappingURL=helpers.d.ts.map
|