pace-chart-lib 1.0.48 → 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
|
);
|
|
@@ -13353,7 +13353,8 @@ function commonAnnotations(chartData, xScale, yScaleLeft, yScaleRight, margin, d
|
|
|
13353
13353
|
let axis2 = d.x.axis;
|
|
13354
13354
|
return dataLabelsPositionForBarChartFamily(formatOptions, d.x.measure ? d.x.measure : 0, d.position, requiredXScale, minValue, void 0, chartType, isSensitivityChart, axis2);
|
|
13355
13355
|
} else if (chartType === chartTypes.ColumnChart) {
|
|
13356
|
-
const
|
|
13356
|
+
const legendUniqueId = d.legendUniqueId.includes("~$~") ? d.legendUniqueId.split("~$~")[0] : d.legendUniqueId;
|
|
13357
|
+
const legend = xScaleForLegends(legendUniqueId);
|
|
13357
13358
|
const x2 = legend != null ? xScale(d.x) + legend - (columnWidth - xScaleForLegends.bandwidth()) / 2 : xScale(d.x);
|
|
13358
13359
|
return x2;
|
|
13359
13360
|
} else {
|
|
@@ -15461,10 +15462,10 @@ const initYaxisBar = (formatOptions, gTag, xLabel, innerHeight2, innerWidth2, yA
|
|
|
15461
15462
|
const isRotationZero = formatOptions.xAxisLabel.xAxisLabelRotation == 0;
|
|
15462
15463
|
let yRect = gTag.append("rect").attr("id", "yAxisRect").attr(
|
|
15463
15464
|
"transform",
|
|
15464
|
-
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)`
|
|
15465
15466
|
).attr("height", innerHeight2).attr(
|
|
15466
15467
|
"width",
|
|
15467
|
-
chartType === chartTypes.TornadoChart ? xLabelMargin
|
|
15468
|
+
chartType === chartTypes.TornadoChart ? xLabelMargin : xLabelMargin + 5
|
|
15468
15469
|
).attr(
|
|
15469
15470
|
"fill",
|
|
15470
15471
|
formatOptions.xAxisLabel.xAxisLabelVisibility ? formatOptions.xAxisLabel.xAxisBackgroundColor ? formatOptions.xAxisLabel.xAxisBackgroundColor !== commonColors.white ? formatOptions.xAxisLabel.xAxisBackgroundColor : "none" : formatOptions.chartArea.chartAreaColor : formatOptions.chartArea.chartAreaColor
|
|
@@ -15729,7 +15730,7 @@ const horizontalScrollBar = (seriesData, height, width, svg, margin, innerWidth2
|
|
|
15729
15730
|
);
|
|
15730
15731
|
svg.on("wheel", (event2) => {
|
|
15731
15732
|
event2.preventDefault();
|
|
15732
|
-
const scrollDelta =
|
|
15733
|
+
const scrollDelta = isBarChart ? event2.deltaY : event2.deltaX;
|
|
15733
15734
|
const step2 = scrollDelta > 0 ? 1 : -1;
|
|
15734
15735
|
updateFromScrollPosition(step2, scrollMax, handleWidth, handle, true);
|
|
15735
15736
|
if (isBarChart) {
|
|
@@ -17585,9 +17586,7 @@ const ColumnChart = ({
|
|
|
17585
17586
|
(data2.properties.alias || data2.properties.name || "Legend").replace(/ /g, "-");
|
|
17586
17587
|
hideTooltipOnMouseOut();
|
|
17587
17588
|
});
|
|
17588
|
-
columnGroups.exit().remove()
|
|
17589
|
-
console.log("Exiting:", d.dimension, d.legend);
|
|
17590
|
-
});
|
|
17589
|
+
columnGroups.exit().remove();
|
|
17591
17590
|
});
|
|
17592
17591
|
gTag.selectAll(".parentGroup").raise();
|
|
17593
17592
|
};
|
|
@@ -18213,6 +18212,7 @@ const CustomColumnChart = ({
|
|
|
18213
18212
|
const getChartType = (lineData) => {
|
|
18214
18213
|
lineData.forEach((data2) => {
|
|
18215
18214
|
switch (data2.properties.type) {
|
|
18215
|
+
default:
|
|
18216
18216
|
case chartTypes.ColumnChart:
|
|
18217
18217
|
drawColumnChart(data2);
|
|
18218
18218
|
break;
|
|
@@ -18314,7 +18314,7 @@ const CustomColumnChart = ({
|
|
|
18314
18314
|
(d) => xScale(d.dimension) ? xScale(d.dimension) : null
|
|
18315
18315
|
).y(
|
|
18316
18316
|
(d) => d.axis == axisTypes.primary ? yScaleLeft(d.value) : yScaleRight(d.value)
|
|
18317
|
-
).defined((d) =>
|
|
18317
|
+
).defined((d) => formatOptions?.plotArea?.hideZeroValues ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
|
|
18318
18318
|
let lines = gTag.selectAll(".lines.parentGroup").data([1]);
|
|
18319
18319
|
lines = lines.enter().append("g").attr("class", "lines parentGroup").merge(lines);
|
|
18320
18320
|
let lineGroups = lines.selectAll(".line-group").data(lineData, (d) => d.properties.legendUniqueId);
|
|
@@ -30763,11 +30763,7 @@ const Speedometer = ({
|
|
|
30763
30763
|
"font-family",
|
|
30764
30764
|
chartFormatOptions.pointerValue.pointerValueFontFamily
|
|
30765
30765
|
).text(
|
|
30766
|
-
(d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ?
|
|
30767
|
-
"None",
|
|
30768
|
-
chartFormatOptions.pointerValue.pointerValueNumberFormat,
|
|
30769
|
-
chartFormatOptions.pointerValue.pointerValueDecimalPrecision
|
|
30770
|
-
)(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}`
|
|
30771
30767
|
).attr(
|
|
30772
30768
|
"visibility",
|
|
30773
30769
|
chartFormatOptions.plotArea.dataLabels ? "visible" : "hidden"
|
|
@@ -30776,6 +30772,45 @@ const Speedometer = ({
|
|
|
30776
30772
|
logError$2(fileName2, "setPointerValueText", error);
|
|
30777
30773
|
}
|
|
30778
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
|
+
}
|
|
30779
30814
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30780
30815
|
"svg",
|
|
30781
30816
|
{
|
|
@@ -30982,7 +31017,7 @@ const RadialBarChart = ({
|
|
|
30982
31017
|
"visibility",
|
|
30983
31018
|
chartFormatOptions.plotArea.axialAxis ? "visible" : "hidden"
|
|
30984
31019
|
);
|
|
30985
|
-
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) => {
|
|
30986
31021
|
showTooltipOnMouseMove(
|
|
30987
31022
|
[
|
|
30988
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
|
);
|
|
@@ -13356,7 +13356,8 @@
|
|
|
13356
13356
|
let axis2 = d.x.axis;
|
|
13357
13357
|
return dataLabelsPositionForBarChartFamily(formatOptions, d.x.measure ? d.x.measure : 0, d.position, requiredXScale, minValue, void 0, chartType, isSensitivityChart, axis2);
|
|
13358
13358
|
} else if (chartType === chartTypes.ColumnChart) {
|
|
13359
|
-
const
|
|
13359
|
+
const legendUniqueId = d.legendUniqueId.includes("~$~") ? d.legendUniqueId.split("~$~")[0] : d.legendUniqueId;
|
|
13360
|
+
const legend = xScaleForLegends(legendUniqueId);
|
|
13360
13361
|
const x2 = legend != null ? xScale(d.x) + legend - (columnWidth - xScaleForLegends.bandwidth()) / 2 : xScale(d.x);
|
|
13361
13362
|
return x2;
|
|
13362
13363
|
} else {
|
|
@@ -15464,10 +15465,10 @@
|
|
|
15464
15465
|
const isRotationZero = formatOptions.xAxisLabel.xAxisLabelRotation == 0;
|
|
15465
15466
|
let yRect = gTag.append("rect").attr("id", "yAxisRect").attr(
|
|
15466
15467
|
"transform",
|
|
15467
|
-
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)`
|
|
15468
15469
|
).attr("height", innerHeight2).attr(
|
|
15469
15470
|
"width",
|
|
15470
|
-
chartType === chartTypes.TornadoChart ? xLabelMargin
|
|
15471
|
+
chartType === chartTypes.TornadoChart ? xLabelMargin : xLabelMargin + 5
|
|
15471
15472
|
).attr(
|
|
15472
15473
|
"fill",
|
|
15473
15474
|
formatOptions.xAxisLabel.xAxisLabelVisibility ? formatOptions.xAxisLabel.xAxisBackgroundColor ? formatOptions.xAxisLabel.xAxisBackgroundColor !== commonColors.white ? formatOptions.xAxisLabel.xAxisBackgroundColor : "none" : formatOptions.chartArea.chartAreaColor : formatOptions.chartArea.chartAreaColor
|
|
@@ -15732,7 +15733,7 @@
|
|
|
15732
15733
|
);
|
|
15733
15734
|
svg.on("wheel", (event2) => {
|
|
15734
15735
|
event2.preventDefault();
|
|
15735
|
-
const scrollDelta =
|
|
15736
|
+
const scrollDelta = isBarChart ? event2.deltaY : event2.deltaX;
|
|
15736
15737
|
const step2 = scrollDelta > 0 ? 1 : -1;
|
|
15737
15738
|
updateFromScrollPosition(step2, scrollMax, handleWidth, handle, true);
|
|
15738
15739
|
if (isBarChart) {
|
|
@@ -17588,9 +17589,7 @@
|
|
|
17588
17589
|
(data2.properties.alias || data2.properties.name || "Legend").replace(/ /g, "-");
|
|
17589
17590
|
hideTooltipOnMouseOut();
|
|
17590
17591
|
});
|
|
17591
|
-
columnGroups.exit().remove()
|
|
17592
|
-
console.log("Exiting:", d.dimension, d.legend);
|
|
17593
|
-
});
|
|
17592
|
+
columnGroups.exit().remove();
|
|
17594
17593
|
});
|
|
17595
17594
|
gTag.selectAll(".parentGroup").raise();
|
|
17596
17595
|
};
|
|
@@ -18216,6 +18215,7 @@
|
|
|
18216
18215
|
const getChartType = (lineData) => {
|
|
18217
18216
|
lineData.forEach((data2) => {
|
|
18218
18217
|
switch (data2.properties.type) {
|
|
18218
|
+
default:
|
|
18219
18219
|
case chartTypes.ColumnChart:
|
|
18220
18220
|
drawColumnChart(data2);
|
|
18221
18221
|
break;
|
|
@@ -18317,7 +18317,7 @@
|
|
|
18317
18317
|
(d) => xScale(d.dimension) ? xScale(d.dimension) : null
|
|
18318
18318
|
).y(
|
|
18319
18319
|
(d) => d.axis == axisTypes.primary ? yScaleLeft(d.value) : yScaleRight(d.value)
|
|
18320
|
-
).defined((d) =>
|
|
18320
|
+
).defined((d) => formatOptions?.plotArea?.hideZeroValues ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
|
|
18321
18321
|
let lines = gTag.selectAll(".lines.parentGroup").data([1]);
|
|
18322
18322
|
lines = lines.enter().append("g").attr("class", "lines parentGroup").merge(lines);
|
|
18323
18323
|
let lineGroups = lines.selectAll(".line-group").data(lineData, (d) => d.properties.legendUniqueId);
|
|
@@ -30766,11 +30766,7 @@
|
|
|
30766
30766
|
"font-family",
|
|
30767
30767
|
chartFormatOptions.pointerValue.pointerValueFontFamily
|
|
30768
30768
|
).text(
|
|
30769
|
-
(d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ?
|
|
30770
|
-
"None",
|
|
30771
|
-
chartFormatOptions.pointerValue.pointerValueNumberFormat,
|
|
30772
|
-
chartFormatOptions.pointerValue.pointerValueDecimalPrecision
|
|
30773
|
-
)(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}`
|
|
30774
30770
|
).attr(
|
|
30775
30771
|
"visibility",
|
|
30776
30772
|
chartFormatOptions.plotArea.dataLabels ? "visible" : "hidden"
|
|
@@ -30779,6 +30775,45 @@
|
|
|
30779
30775
|
logError$2(fileName2, "setPointerValueText", error);
|
|
30780
30776
|
}
|
|
30781
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
|
+
}
|
|
30782
30817
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
30783
30818
|
"svg",
|
|
30784
30819
|
{
|
|
@@ -30985,7 +31020,7 @@
|
|
|
30985
31020
|
"visibility",
|
|
30986
31021
|
chartFormatOptions.plotArea.axialAxis ? "visible" : "hidden"
|
|
30987
31022
|
);
|
|
30988
|
-
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) => {
|
|
30989
31024
|
showTooltipOnMouseMove(
|
|
30990
31025
|
[
|
|
30991
31026
|
{
|