pace-chart-lib 1.0.49 → 1.0.50
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.
|
@@ -245,7 +245,7 @@ export declare function initChartArea(svg: any, margin: TMargin): any;
|
|
|
245
245
|
*
|
|
246
246
|
* @returns {void} Does not return a value.
|
|
247
247
|
*/
|
|
248
|
-
export declare function initPlotArea(g: any, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, innerWidth: number, innerHeight: number, chartType: string): void;
|
|
248
|
+
export declare function initPlotArea(g: any, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, innerWidth: number, innerHeight: number, chartType: string, chartId?: string): void;
|
|
249
249
|
/**
|
|
250
250
|
* Checks whether two objects overlap vertically based on their y-position and height.
|
|
251
251
|
*
|
|
@@ -12374,10 +12374,10 @@ function initChartArea$1(svg, margin) {
|
|
|
12374
12374
|
throw error;
|
|
12375
12375
|
}
|
|
12376
12376
|
}
|
|
12377
|
-
function initPlotArea(g, formatOptions, dataTableHeight, innerWidth2, innerHeight2, chartType) {
|
|
12377
|
+
function initPlotArea(g, formatOptions, dataTableHeight, innerWidth2, innerHeight2, chartType, chartId) {
|
|
12378
12378
|
try {
|
|
12379
|
-
let uniqueID = crypto.randomUUID().toUpperCase();
|
|
12380
|
-
g.append("defs").append("clipPath").attr("id", uniqueID).append("rect").attr("width", innerWidth2).attr(
|
|
12379
|
+
let uniqueID = chartId ?? crypto.randomUUID().toUpperCase();
|
|
12380
|
+
g.append("defs").append("clipPath").attr("id", uniqueID + "-clip").append("rect").attr("width", innerWidth2).attr(
|
|
12381
12381
|
"height",
|
|
12382
12382
|
dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2
|
|
12383
12383
|
);
|
|
@@ -15462,10 +15462,10 @@ const initYaxisBar = (formatOptions, gTag, xLabel, innerHeight2, innerWidth2, yA
|
|
|
15462
15462
|
const isRotationZero = formatOptions.xAxisLabel.xAxisLabelRotation == 0;
|
|
15463
15463
|
let yRect = gTag.append("rect").attr("id", "yAxisRect").attr(
|
|
15464
15464
|
"transform",
|
|
15465
|
-
chartType === chartTypes.TornadoChart ? `translate(${-xLabelMargin
|
|
15465
|
+
chartType === chartTypes.TornadoChart ? `translate(${-xLabelMargin - 1},0)` : `translate(${xaxisLabelPosition === 0 ? -xLabelMargin - 5 : xaxisLabelPosition === 1 ? innerWidth2 : xScaleBottom(0) + (-xLabelMargin - 5)},0)`
|
|
15466
15466
|
).attr("height", innerHeight2).attr(
|
|
15467
15467
|
"width",
|
|
15468
|
-
chartType === chartTypes.TornadoChart ? xLabelMargin
|
|
15468
|
+
chartType === chartTypes.TornadoChart ? xLabelMargin : xLabelMargin + 5
|
|
15469
15469
|
).attr(
|
|
15470
15470
|
"fill",
|
|
15471
15471
|
formatOptions.xAxisLabel.xAxisLabelVisibility ? formatOptions.xAxisLabel.xAxisBackgroundColor ? formatOptions.xAxisLabel.xAxisBackgroundColor !== commonColors.white ? formatOptions.xAxisLabel.xAxisBackgroundColor : "none" : formatOptions.chartArea.chartAreaColor : formatOptions.chartArea.chartAreaColor
|
|
@@ -15730,7 +15730,7 @@ const horizontalScrollBar = (seriesData, height, width, svg, margin, innerWidth2
|
|
|
15730
15730
|
);
|
|
15731
15731
|
svg.on("wheel", (event2) => {
|
|
15732
15732
|
event2.preventDefault();
|
|
15733
|
-
const scrollDelta =
|
|
15733
|
+
const scrollDelta = isBarChart ? event2.deltaY : event2.deltaX;
|
|
15734
15734
|
const step2 = scrollDelta > 0 ? 1 : -1;
|
|
15735
15735
|
updateFromScrollPosition(step2, scrollMax, handleWidth, handle, true);
|
|
15736
15736
|
if (isBarChart) {
|
|
@@ -17586,9 +17586,7 @@ const ColumnChart = ({
|
|
|
17586
17586
|
(data2.properties.alias || data2.properties.name || "Legend").replace(/ /g, "-");
|
|
17587
17587
|
hideTooltipOnMouseOut();
|
|
17588
17588
|
});
|
|
17589
|
-
columnGroups.exit().remove()
|
|
17590
|
-
console.log("Exiting:", d.dimension, d.legend);
|
|
17591
|
-
});
|
|
17589
|
+
columnGroups.exit().remove();
|
|
17592
17590
|
});
|
|
17593
17591
|
gTag.selectAll(".parentGroup").raise();
|
|
17594
17592
|
};
|
|
@@ -18316,7 +18314,7 @@ const CustomColumnChart = ({
|
|
|
18316
18314
|
(d) => xScale(d.dimension) ? xScale(d.dimension) : null
|
|
18317
18315
|
).y(
|
|
18318
18316
|
(d) => d.axis == axisTypes.primary ? yScaleLeft(d.value) : yScaleRight(d.value)
|
|
18319
|
-
).defined((d) =>
|
|
18317
|
+
).defined((d) => formatOptions?.plotArea?.hideZeroValues ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
|
|
18320
18318
|
let lines = gTag.selectAll(".lines.parentGroup").data([1]);
|
|
18321
18319
|
lines = lines.enter().append("g").attr("class", "lines parentGroup").merge(lines);
|
|
18322
18320
|
let lineGroups = lines.selectAll(".line-group").data(lineData, (d) => d.properties.legendUniqueId);
|
|
@@ -30765,11 +30763,7 @@ const Speedometer = ({
|
|
|
30765
30763
|
"font-family",
|
|
30766
30764
|
chartFormatOptions.pointerValue.pointerValueFontFamily
|
|
30767
30765
|
).text(
|
|
30768
|
-
(d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ?
|
|
30769
|
-
"None",
|
|
30770
|
-
chartFormatOptions.pointerValue.pointerValueNumberFormat,
|
|
30771
|
-
chartFormatOptions.pointerValue.pointerValueDecimalPrecision
|
|
30772
|
-
)(ChartData[1].data[0].value) : chartFormatOptions.pointerValue.pointerValueAliasText}`
|
|
30766
|
+
(d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ? connectorNumberFormat2(ChartData[0].data[0].value, ChartData[1].data[0].value) : chartFormatOptions.pointerValue.pointerValueAliasText}`
|
|
30773
30767
|
).attr(
|
|
30774
30768
|
"visibility",
|
|
30775
30769
|
chartFormatOptions.plotArea.dataLabels ? "visible" : "hidden"
|
|
@@ -30778,6 +30772,45 @@ const Speedometer = ({
|
|
|
30778
30772
|
logError$2(fileName2, "setPointerValueText", error);
|
|
30779
30773
|
}
|
|
30780
30774
|
}
|
|
30775
|
+
function connectorNumberFormat2(numerator, denominator) {
|
|
30776
|
+
try {
|
|
30777
|
+
let Measure = numerator - denominator;
|
|
30778
|
+
let noOfYears = 1;
|
|
30779
|
+
let KPI = parseInt(
|
|
30780
|
+
chartFormatOptions.pointerValue.connectorKPIforSpeedometer
|
|
30781
|
+
);
|
|
30782
|
+
let formatter;
|
|
30783
|
+
let value2;
|
|
30784
|
+
const decimalValues = chartFormatOptions.pointerValue.pointerValueDecimalPrecision;
|
|
30785
|
+
switch (KPI) {
|
|
30786
|
+
case 1:
|
|
30787
|
+
Measure = denominator;
|
|
30788
|
+
break;
|
|
30789
|
+
case 2:
|
|
30790
|
+
Measure = Math.abs(Measure);
|
|
30791
|
+
break;
|
|
30792
|
+
case 3:
|
|
30793
|
+
formatter = `.${decimalValues}%`;
|
|
30794
|
+
Measure = Math.pow(denominator / numerator, 1 / noOfYears) - 1;
|
|
30795
|
+
value2 = format(formatter)(Measure);
|
|
30796
|
+
return value2;
|
|
30797
|
+
case 4:
|
|
30798
|
+
formatter = `.${decimalValues}%`;
|
|
30799
|
+
Measure = Math.round(denominator / numerator * 100 - 100) / 100;
|
|
30800
|
+
value2 = format(formatter)(Measure);
|
|
30801
|
+
return value2;
|
|
30802
|
+
}
|
|
30803
|
+
isNaN(Measure) ? Measure = 0 : Measure;
|
|
30804
|
+
return getNumberWithFormatFunction(
|
|
30805
|
+
chartFormatOptions.pointerValue.pointerValueDisplayUnits,
|
|
30806
|
+
chartFormatOptions.pointerValue.pointerValueNumberFormat,
|
|
30807
|
+
decimalValues
|
|
30808
|
+
)(Measure);
|
|
30809
|
+
} catch (error) {
|
|
30810
|
+
logError$2(fileName2, "connectorNumberFormat", error);
|
|
30811
|
+
return "";
|
|
30812
|
+
}
|
|
30813
|
+
}
|
|
30781
30814
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30782
30815
|
"svg",
|
|
30783
30816
|
{
|
|
@@ -30984,7 +31017,7 @@ const RadialBarChart = ({
|
|
|
30984
31017
|
"visibility",
|
|
30985
31018
|
chartFormatOptions.plotArea.axialAxis ? "visible" : "hidden"
|
|
30986
31019
|
);
|
|
30987
|
-
let arcs = svg2.attr("class", "data").selectAll("path").data(ChartData).enter().append("path").attr("class", "parentGroup").attr("hoverId", (d) => d.data[0].legend).style("fill", (d, i) => d.properties.color).on("mousemove", (event2, d) => {
|
|
31020
|
+
let arcs = svg2.attr("class", "data").selectAll("path").data(ChartData).enter().append("path").attr("class", "parentGroup").attr("hoverId", (d) => d.data[0].legend.replaceAll(" ", "-")).style("fill", (d, i) => d.properties.color).on("mousemove", (event2, d) => {
|
|
30988
31021
|
showTooltipOnMouseMove(
|
|
30989
31022
|
[
|
|
30990
31023
|
{
|
|
@@ -12377,10 +12377,10 @@
|
|
|
12377
12377
|
throw error;
|
|
12378
12378
|
}
|
|
12379
12379
|
}
|
|
12380
|
-
function initPlotArea(g, formatOptions, dataTableHeight, innerWidth2, innerHeight2, chartType) {
|
|
12380
|
+
function initPlotArea(g, formatOptions, dataTableHeight, innerWidth2, innerHeight2, chartType, chartId) {
|
|
12381
12381
|
try {
|
|
12382
|
-
let uniqueID = crypto.randomUUID().toUpperCase();
|
|
12383
|
-
g.append("defs").append("clipPath").attr("id", uniqueID).append("rect").attr("width", innerWidth2).attr(
|
|
12382
|
+
let uniqueID = chartId ?? crypto.randomUUID().toUpperCase();
|
|
12383
|
+
g.append("defs").append("clipPath").attr("id", uniqueID + "-clip").append("rect").attr("width", innerWidth2).attr(
|
|
12384
12384
|
"height",
|
|
12385
12385
|
dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2
|
|
12386
12386
|
);
|
|
@@ -15465,10 +15465,10 @@
|
|
|
15465
15465
|
const isRotationZero = formatOptions.xAxisLabel.xAxisLabelRotation == 0;
|
|
15466
15466
|
let yRect = gTag.append("rect").attr("id", "yAxisRect").attr(
|
|
15467
15467
|
"transform",
|
|
15468
|
-
chartType === chartTypes.TornadoChart ? `translate(${-xLabelMargin
|
|
15468
|
+
chartType === chartTypes.TornadoChart ? `translate(${-xLabelMargin - 1},0)` : `translate(${xaxisLabelPosition === 0 ? -xLabelMargin - 5 : xaxisLabelPosition === 1 ? innerWidth2 : xScaleBottom(0) + (-xLabelMargin - 5)},0)`
|
|
15469
15469
|
).attr("height", innerHeight2).attr(
|
|
15470
15470
|
"width",
|
|
15471
|
-
chartType === chartTypes.TornadoChart ? xLabelMargin
|
|
15471
|
+
chartType === chartTypes.TornadoChart ? xLabelMargin : xLabelMargin + 5
|
|
15472
15472
|
).attr(
|
|
15473
15473
|
"fill",
|
|
15474
15474
|
formatOptions.xAxisLabel.xAxisLabelVisibility ? formatOptions.xAxisLabel.xAxisBackgroundColor ? formatOptions.xAxisLabel.xAxisBackgroundColor !== commonColors.white ? formatOptions.xAxisLabel.xAxisBackgroundColor : "none" : formatOptions.chartArea.chartAreaColor : formatOptions.chartArea.chartAreaColor
|
|
@@ -15733,7 +15733,7 @@
|
|
|
15733
15733
|
);
|
|
15734
15734
|
svg.on("wheel", (event2) => {
|
|
15735
15735
|
event2.preventDefault();
|
|
15736
|
-
const scrollDelta =
|
|
15736
|
+
const scrollDelta = isBarChart ? event2.deltaY : event2.deltaX;
|
|
15737
15737
|
const step2 = scrollDelta > 0 ? 1 : -1;
|
|
15738
15738
|
updateFromScrollPosition(step2, scrollMax, handleWidth, handle, true);
|
|
15739
15739
|
if (isBarChart) {
|
|
@@ -17589,9 +17589,7 @@
|
|
|
17589
17589
|
(data2.properties.alias || data2.properties.name || "Legend").replace(/ /g, "-");
|
|
17590
17590
|
hideTooltipOnMouseOut();
|
|
17591
17591
|
});
|
|
17592
|
-
columnGroups.exit().remove()
|
|
17593
|
-
console.log("Exiting:", d.dimension, d.legend);
|
|
17594
|
-
});
|
|
17592
|
+
columnGroups.exit().remove();
|
|
17595
17593
|
});
|
|
17596
17594
|
gTag.selectAll(".parentGroup").raise();
|
|
17597
17595
|
};
|
|
@@ -18319,7 +18317,7 @@
|
|
|
18319
18317
|
(d) => xScale(d.dimension) ? xScale(d.dimension) : null
|
|
18320
18318
|
).y(
|
|
18321
18319
|
(d) => d.axis == axisTypes.primary ? yScaleLeft(d.value) : yScaleRight(d.value)
|
|
18322
|
-
).defined((d) =>
|
|
18320
|
+
).defined((d) => formatOptions?.plotArea?.hideZeroValues ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
|
|
18323
18321
|
let lines = gTag.selectAll(".lines.parentGroup").data([1]);
|
|
18324
18322
|
lines = lines.enter().append("g").attr("class", "lines parentGroup").merge(lines);
|
|
18325
18323
|
let lineGroups = lines.selectAll(".line-group").data(lineData, (d) => d.properties.legendUniqueId);
|
|
@@ -30768,11 +30766,7 @@
|
|
|
30768
30766
|
"font-family",
|
|
30769
30767
|
chartFormatOptions.pointerValue.pointerValueFontFamily
|
|
30770
30768
|
).text(
|
|
30771
|
-
(d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ?
|
|
30772
|
-
"None",
|
|
30773
|
-
chartFormatOptions.pointerValue.pointerValueNumberFormat,
|
|
30774
|
-
chartFormatOptions.pointerValue.pointerValueDecimalPrecision
|
|
30775
|
-
)(ChartData[1].data[0].value) : chartFormatOptions.pointerValue.pointerValueAliasText}`
|
|
30769
|
+
(d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ? connectorNumberFormat2(ChartData[0].data[0].value, ChartData[1].data[0].value) : chartFormatOptions.pointerValue.pointerValueAliasText}`
|
|
30776
30770
|
).attr(
|
|
30777
30771
|
"visibility",
|
|
30778
30772
|
chartFormatOptions.plotArea.dataLabels ? "visible" : "hidden"
|
|
@@ -30781,6 +30775,45 @@
|
|
|
30781
30775
|
logError$2(fileName2, "setPointerValueText", error);
|
|
30782
30776
|
}
|
|
30783
30777
|
}
|
|
30778
|
+
function connectorNumberFormat2(numerator, denominator) {
|
|
30779
|
+
try {
|
|
30780
|
+
let Measure = numerator - denominator;
|
|
30781
|
+
let noOfYears = 1;
|
|
30782
|
+
let KPI = parseInt(
|
|
30783
|
+
chartFormatOptions.pointerValue.connectorKPIforSpeedometer
|
|
30784
|
+
);
|
|
30785
|
+
let formatter;
|
|
30786
|
+
let value2;
|
|
30787
|
+
const decimalValues = chartFormatOptions.pointerValue.pointerValueDecimalPrecision;
|
|
30788
|
+
switch (KPI) {
|
|
30789
|
+
case 1:
|
|
30790
|
+
Measure = denominator;
|
|
30791
|
+
break;
|
|
30792
|
+
case 2:
|
|
30793
|
+
Measure = Math.abs(Measure);
|
|
30794
|
+
break;
|
|
30795
|
+
case 3:
|
|
30796
|
+
formatter = `.${decimalValues}%`;
|
|
30797
|
+
Measure = Math.pow(denominator / numerator, 1 / noOfYears) - 1;
|
|
30798
|
+
value2 = format(formatter)(Measure);
|
|
30799
|
+
return value2;
|
|
30800
|
+
case 4:
|
|
30801
|
+
formatter = `.${decimalValues}%`;
|
|
30802
|
+
Measure = Math.round(denominator / numerator * 100 - 100) / 100;
|
|
30803
|
+
value2 = format(formatter)(Measure);
|
|
30804
|
+
return value2;
|
|
30805
|
+
}
|
|
30806
|
+
isNaN(Measure) ? Measure = 0 : Measure;
|
|
30807
|
+
return getNumberWithFormatFunction(
|
|
30808
|
+
chartFormatOptions.pointerValue.pointerValueDisplayUnits,
|
|
30809
|
+
chartFormatOptions.pointerValue.pointerValueNumberFormat,
|
|
30810
|
+
decimalValues
|
|
30811
|
+
)(Measure);
|
|
30812
|
+
} catch (error) {
|
|
30813
|
+
logError$2(fileName2, "connectorNumberFormat", error);
|
|
30814
|
+
return "";
|
|
30815
|
+
}
|
|
30816
|
+
}
|
|
30784
30817
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30785
30818
|
"svg",
|
|
30786
30819
|
{
|
|
@@ -30987,7 +31020,7 @@
|
|
|
30987
31020
|
"visibility",
|
|
30988
31021
|
chartFormatOptions.plotArea.axialAxis ? "visible" : "hidden"
|
|
30989
31022
|
);
|
|
30990
|
-
let arcs = svg2.attr("class", "data").selectAll("path").data(ChartData).enter().append("path").attr("class", "parentGroup").attr("hoverId", (d) => d.data[0].legend).style("fill", (d, i) => d.properties.color).on("mousemove", (event2, d) => {
|
|
31023
|
+
let arcs = svg2.attr("class", "data").selectAll("path").data(ChartData).enter().append("path").attr("class", "parentGroup").attr("hoverId", (d) => d.data[0].legend.replaceAll(" ", "-")).style("fill", (d, i) => d.properties.color).on("mousemove", (event2, d) => {
|
|
30991
31024
|
showTooltipOnMouseMove(
|
|
30992
31025
|
[
|
|
30993
31026
|
{
|