pace-chart-lib 1.0.9 → 1.0.10
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.
|
@@ -15774,6 +15774,7 @@ const firstFunctionBeforeRender = (svgRef, formatOptions) => {
|
|
|
15774
15774
|
const marginCalculationsForChartsWithoutAxis = (chartFormatOptions, width, height, maxLegendDimensions, margins, isVennChart = false) => {
|
|
15775
15775
|
try {
|
|
15776
15776
|
let legendPosition = chartFormatOptions.legends.legendPosition;
|
|
15777
|
+
legendPosition = chartFormatOptions.legends.legendVisibility ? chartFormatOptions.legends.legendPosition : staticLegendPosition.none;
|
|
15777
15778
|
let width15Percent = width * 0.15 * 0.8;
|
|
15778
15779
|
let legendListWidth = isVennChart ? maxLegendDimensions[0] : width15Percent < maxLegendDimensions[0] + 15 ? width15Percent : maxLegendDimensions[0] + 15;
|
|
15779
15780
|
let chartTitleHeight = chartFormatOptions.chartTitle.chartTitleVisibility ? chartFormatOptions.chartTitle.dynamicTitleText.length !== 0 ? preCalculateTextDimensions(
|
|
@@ -15787,10 +15788,10 @@ const marginCalculationsForChartsWithoutAxis = (chartFormatOptions, width, heigh
|
|
|
15787
15788
|
).height : 5;
|
|
15788
15789
|
switch (legendPosition) {
|
|
15789
15790
|
case staticLegendPosition.none:
|
|
15790
|
-
margins.top = chartTitleHeight +
|
|
15791
|
-
margins.bottom =
|
|
15792
|
-
margins.right =
|
|
15793
|
-
margins.left =
|
|
15791
|
+
margins.top = chartTitleHeight + 10;
|
|
15792
|
+
margins.bottom = 15;
|
|
15793
|
+
margins.right = 15;
|
|
15794
|
+
margins.left = 15;
|
|
15794
15795
|
break;
|
|
15795
15796
|
case staticLegendPosition.top:
|
|
15796
15797
|
margins.top = chartTitleHeight + 50;
|
|
@@ -16678,7 +16679,10 @@ const CustomColumnChart = ({
|
|
|
16678
16679
|
let stackChartData = [];
|
|
16679
16680
|
const chartType = actualChartTypes.customColumnChart;
|
|
16680
16681
|
const svgRef = useRef();
|
|
16681
|
-
const seriesData = generalizedChartData(
|
|
16682
|
+
const seriesData = generalizedChartData(
|
|
16683
|
+
data.ChartData,
|
|
16684
|
+
data.DimensionList
|
|
16685
|
+
);
|
|
16682
16686
|
const dimensionList = data.DimensionList;
|
|
16683
16687
|
const barChart = false;
|
|
16684
16688
|
let isSecondaryAxisDrawn = false;
|
|
@@ -17169,7 +17173,9 @@ const CustomColumnChart = ({
|
|
|
17169
17173
|
)
|
|
17170
17174
|
).tickSize(
|
|
17171
17175
|
formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 + 0 : 0 : 0
|
|
17172
|
-
).tickValues(
|
|
17176
|
+
).tickValues(
|
|
17177
|
+
responsiveLablesObj.autoLabelFlag ? void 0 : responsiveLablesObj.yAxisLabelArray
|
|
17178
|
+
).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
|
|
17173
17179
|
}
|
|
17174
17180
|
if (isSecondaryAxisDrawn) {
|
|
17175
17181
|
yAxisRight = axisRight(yScaleRight).tickFormat(
|
|
@@ -19899,7 +19905,7 @@ const setnumberOfBubbles = (svg, legendPosition, chartFormatOptions, height, wid
|
|
|
19899
19905
|
function logError$1(fileName2, functionName, error) {
|
|
19900
19906
|
console.error(`[${fileName2}] [${functionName}]`, error);
|
|
19901
19907
|
}
|
|
19902
|
-
const ColumnHistogramChart = ({
|
|
19908
|
+
const ColumnHistogramChart$1 = ({
|
|
19903
19909
|
isDateType,
|
|
19904
19910
|
formatOptions,
|
|
19905
19911
|
data
|
|
@@ -19908,7 +19914,7 @@ const ColumnHistogramChart = ({
|
|
|
19908
19914
|
const columnWidth = 0;
|
|
19909
19915
|
const chartType = actualChartTypes.columnHistogram;
|
|
19910
19916
|
const svgRef = useRef();
|
|
19911
|
-
const seriesData =
|
|
19917
|
+
const seriesData = data.ChartData;
|
|
19912
19918
|
const dimensionList = data.DimensionList;
|
|
19913
19919
|
const barChart = false;
|
|
19914
19920
|
const isSecondaryAxisDrawn = false;
|
|
@@ -20202,7 +20208,8 @@ const ColumnHistogramChart = ({
|
|
|
20202
20208
|
};
|
|
20203
20209
|
const initScale = () => {
|
|
20204
20210
|
xScale = linear$1().domain([chartJSON.xMin, chartJSON.xMax]).range([0, innerWidth2]);
|
|
20205
|
-
|
|
20211
|
+
const numberOfBins = periods.length > 0 ? periods : xScale.ticks(thresholds);
|
|
20212
|
+
let histogram = bin().value((d) => d).domain(xScale.domain()).thresholds(numberOfBins);
|
|
20206
20213
|
filteredData.forEach((d) => {
|
|
20207
20214
|
let tempArray = histogram(d.data.map((val) => val.value));
|
|
20208
20215
|
bins.push(tempArray);
|
|
@@ -20260,7 +20267,7 @@ const ColumnHistogramChart = ({
|
|
|
20260
20267
|
)
|
|
20261
20268
|
).tickSize(
|
|
20262
20269
|
formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesVertical ? formatOptions.plotArea.gridLinesVertical ? -(dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2) : parseFloat(formatOptions.plotArea.ticksHeight) * ((dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2) / 100) * (formatOptions.xAxisLabel.xAxisPosition == "1" ? 1 : -1) : 0 : 0
|
|
20263
|
-
).
|
|
20270
|
+
).tickSizeOuter(0);
|
|
20264
20271
|
formatOptions.bins.binsCalculation === "Automatic" ? xAxis.ticks(thresholds) : xAxis.tickValues(periods).ticks(innerWidth2 / 50);
|
|
20265
20272
|
};
|
|
20266
20273
|
const getChartType = (lineData) => {
|
|
@@ -20292,6 +20299,7 @@ const ColumnHistogramChart = ({
|
|
|
20292
20299
|
event2
|
|
20293
20300
|
);
|
|
20294
20301
|
}).on("mouseout", hideTooltipOnMouseOut);
|
|
20302
|
+
gTag.selectAll(".parentGroup").raise();
|
|
20295
20303
|
};
|
|
20296
20304
|
const setSVGContainer = (margin2) => {
|
|
20297
20305
|
innerWidth2 = width - margin2.left - margin2.right;
|
|
@@ -20311,7 +20319,6 @@ const ColumnHistogramChart = ({
|
|
|
20311
20319
|
(d) => filteredDimension.includes(d.dimension)
|
|
20312
20320
|
)
|
|
20313
20321
|
);
|
|
20314
|
-
getXAxis();
|
|
20315
20322
|
svg2.append("rect").attr("x", margin2.left).attr("y", scrollbarY).attr("width", innerWidth22).attr("height", 8).attr("fill", "#ddd").attr("rx", 4);
|
|
20316
20323
|
const handleWidth = innerWidth22 * visibleBars / chartJSON.dimensionList.length;
|
|
20317
20324
|
const handle = svg2.append("rect").attr("x", margin2.left).attr("y", scrollbarY).attr("width", handleWidth).attr("height", 8).attr("fill", "#999").attr("rx", 4).style("cursor", "ew-resize").call(
|
|
@@ -20358,7 +20365,6 @@ const ColumnHistogramChart = ({
|
|
|
20358
20365
|
drawColumnChart();
|
|
20359
20366
|
};
|
|
20360
20367
|
const drawColumnChart = () => {
|
|
20361
|
-
getChartType();
|
|
20362
20368
|
initXaxis$1(
|
|
20363
20369
|
gTag,
|
|
20364
20370
|
chartJSON,
|
|
@@ -20375,6 +20381,7 @@ const ColumnHistogramChart = ({
|
|
|
20375
20381
|
innerHeight2,
|
|
20376
20382
|
filteredDimension
|
|
20377
20383
|
);
|
|
20384
|
+
getChartType();
|
|
20378
20385
|
};
|
|
20379
20386
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
20380
20387
|
"svg",
|
|
@@ -24310,26 +24317,28 @@ const LayeredHorizontalBarChart = ({
|
|
|
24310
24317
|
}
|
|
24311
24318
|
) });
|
|
24312
24319
|
};
|
|
24313
|
-
const
|
|
24320
|
+
const ColumnHistogramChart = ({
|
|
24314
24321
|
isDateType,
|
|
24315
24322
|
formatOptions,
|
|
24316
24323
|
data
|
|
24317
24324
|
}) => {
|
|
24318
24325
|
const chartId = crypto.randomUUID();
|
|
24319
|
-
|
|
24320
|
-
const chartType = actualChartTypes.
|
|
24326
|
+
const columnWidth = 0;
|
|
24327
|
+
const chartType = actualChartTypes.columnHistogram;
|
|
24321
24328
|
const svgRef = useRef();
|
|
24322
|
-
const seriesData =
|
|
24329
|
+
const seriesData = data.ChartData;
|
|
24323
24330
|
const dimensionList = data.DimensionList;
|
|
24324
|
-
const barChart =
|
|
24325
|
-
|
|
24331
|
+
const barChart = false;
|
|
24332
|
+
const isSecondaryAxisDrawn = false;
|
|
24326
24333
|
const isNormalizedChart = false;
|
|
24327
24334
|
let customYaxisMinValue = parseFloat(formatOptions.yAxisLabel.yAxisMinText);
|
|
24328
24335
|
let customYaxisMaxValue = parseFloat(formatOptions.yAxisLabel.yAxisMaxText);
|
|
24329
|
-
let
|
|
24336
|
+
let customXaxisMinValue = parseFloat(formatOptions.xAxisLabel.xAxisMinText);
|
|
24337
|
+
let customXaxisMaxValue = parseFloat(formatOptions.xAxisLabel.xAxisMaxText);
|
|
24338
|
+
parseFloat(
|
|
24330
24339
|
formatOptions.secondaryYAxisLabel.secondaryYAxisMinText
|
|
24331
24340
|
);
|
|
24332
|
-
|
|
24341
|
+
parseFloat(
|
|
24333
24342
|
formatOptions.secondaryYAxisLabel.secondaryYAxisMaxText
|
|
24334
24343
|
);
|
|
24335
24344
|
let margin;
|
|
@@ -24346,21 +24355,21 @@ const HorizontalHistogramChart = ({
|
|
|
24346
24355
|
let maxNumberForSecondaryAxis;
|
|
24347
24356
|
let innerWidth2;
|
|
24348
24357
|
let innerHeight2;
|
|
24358
|
+
let thresholds;
|
|
24359
|
+
let periods = [];
|
|
24360
|
+
let bins = [];
|
|
24349
24361
|
let width;
|
|
24350
24362
|
let height;
|
|
24351
24363
|
let dataTable;
|
|
24352
24364
|
let dataTableHeight;
|
|
24353
24365
|
let svg;
|
|
24354
24366
|
let gTag;
|
|
24355
|
-
let
|
|
24356
|
-
let
|
|
24357
|
-
let
|
|
24358
|
-
let xScaleTop;
|
|
24367
|
+
let yScaleLeft;
|
|
24368
|
+
let xScale;
|
|
24369
|
+
let xScaleForLegends;
|
|
24359
24370
|
let calculatedRange;
|
|
24360
|
-
let
|
|
24361
|
-
let
|
|
24362
|
-
let xAxisTop;
|
|
24363
|
-
let yAxis;
|
|
24371
|
+
let yAxisLeft;
|
|
24372
|
+
let xAxis;
|
|
24364
24373
|
let filteredDimension;
|
|
24365
24374
|
let filteredData = [];
|
|
24366
24375
|
let scrollPosition = 0;
|
|
@@ -24381,12 +24390,12 @@ const HorizontalHistogramChart = ({
|
|
|
24381
24390
|
};
|
|
24382
24391
|
useEffect(() => {
|
|
24383
24392
|
try {
|
|
24384
|
-
|
|
24393
|
+
createColumnChart();
|
|
24385
24394
|
} catch (error) {
|
|
24386
|
-
logError$2("
|
|
24395
|
+
logError$2("Columnchart", "createColumnChart", error);
|
|
24387
24396
|
}
|
|
24388
24397
|
}, [formatOptions]);
|
|
24389
|
-
const
|
|
24398
|
+
const createColumnChart = () => {
|
|
24390
24399
|
({ formatOptions, svg, width, height } = firstFunctionBeforeRender$1(
|
|
24391
24400
|
svgRef,
|
|
24392
24401
|
formatOptions
|
|
@@ -24424,8 +24433,7 @@ const HorizontalHistogramChart = ({
|
|
|
24424
24433
|
chartJSON.yMaxRight,
|
|
24425
24434
|
isSecondaryAxisDrawn,
|
|
24426
24435
|
isNormalizedChart,
|
|
24427
|
-
isDateType
|
|
24428
|
-
barChart
|
|
24436
|
+
isDateType
|
|
24429
24437
|
));
|
|
24430
24438
|
setSVGContainer(margin);
|
|
24431
24439
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
@@ -24452,33 +24460,17 @@ const HorizontalHistogramChart = ({
|
|
|
24452
24460
|
innerHeight2,
|
|
24453
24461
|
chartType
|
|
24454
24462
|
);
|
|
24463
|
+
binsCalculation();
|
|
24455
24464
|
initScale();
|
|
24456
24465
|
initAxis();
|
|
24457
|
-
|
|
24458
|
-
formatOptions,
|
|
24466
|
+
initYaxis$1(
|
|
24459
24467
|
gTag,
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
xScaleBottom,
|
|
24466
|
-
chartJSON.yMaxLeft,
|
|
24467
|
-
filteredDimension,
|
|
24468
|
-
chartType,
|
|
24469
|
-
isDateType,
|
|
24470
|
-
width,
|
|
24471
|
-
dimensionHeightWidthArray,
|
|
24472
|
-
columnWidth
|
|
24468
|
+
formatOptions,
|
|
24469
|
+
dataTableHeight,
|
|
24470
|
+
yLabel,
|
|
24471
|
+
yAxisLeft,
|
|
24472
|
+
innerHeight2
|
|
24473
24473
|
);
|
|
24474
|
-
if (isSecondaryAxisDrawn) {
|
|
24475
|
-
initXaxisTop(
|
|
24476
|
-
formatOptions,
|
|
24477
|
-
gTag,
|
|
24478
|
-
secondaryYLabel,
|
|
24479
|
-
xAxisTop
|
|
24480
|
-
);
|
|
24481
|
-
}
|
|
24482
24474
|
horizontalScrollBar2(seriesData, height, svg, margin, innerWidth2);
|
|
24483
24475
|
if (formatOptions.dataTableProperties && formatOptions.dataTableProperties.dataTable) {
|
|
24484
24476
|
if (formatOptions.xAxisLabel.xAxisPosition != "1")
|
|
@@ -24489,9 +24481,9 @@ const HorizontalHistogramChart = ({
|
|
|
24489
24481
|
gTag,
|
|
24490
24482
|
dataTable,
|
|
24491
24483
|
columnWidth,
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24484
|
+
yScaleLeft,
|
|
24485
|
+
xScale,
|
|
24486
|
+
xScaleForLegends,
|
|
24495
24487
|
void 0,
|
|
24496
24488
|
void 0,
|
|
24497
24489
|
dataTableHeight,
|
|
@@ -24559,117 +24551,109 @@ const HorizontalHistogramChart = ({
|
|
|
24559
24551
|
const preProcessChartData = () => {
|
|
24560
24552
|
const allChartData = [];
|
|
24561
24553
|
const legendList = [];
|
|
24562
|
-
let
|
|
24554
|
+
let cumulativeDataPoints = [];
|
|
24563
24555
|
let yMaxLeft = -Infinity;
|
|
24564
24556
|
let yMinLeft = Infinity;
|
|
24565
|
-
let yMaxRight = -Infinity;
|
|
24566
|
-
let yMinRight = Infinity;
|
|
24567
24557
|
seriesData.forEach((series) => {
|
|
24568
24558
|
legendList.push(series.legend);
|
|
24569
24559
|
series.data.forEach((point2) => {
|
|
24570
24560
|
allChartData.push(point2);
|
|
24571
|
-
|
|
24572
|
-
|
|
24573
|
-
yMaxRight = Math.max(yMaxRight, point2.value);
|
|
24574
|
-
yMinRight = Math.min(yMinRight, point2.value);
|
|
24575
|
-
} else {
|
|
24576
|
-
yMaxLeft = Math.max(yMaxLeft, point2.value);
|
|
24577
|
-
yMinLeft = Math.min(yMinLeft, point2.value);
|
|
24578
|
-
}
|
|
24561
|
+
yMaxLeft = Math.max(yMaxLeft, point2.value);
|
|
24562
|
+
yMinLeft = Math.min(yMinLeft, point2.value);
|
|
24579
24563
|
});
|
|
24580
24564
|
});
|
|
24581
24565
|
chartJSON.chartData = allChartData;
|
|
24582
24566
|
chartJSON.legendList = legendList;
|
|
24583
24567
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
24584
24568
|
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
24585
|
-
chartJSON.yMaxRight = yMaxRight;
|
|
24586
|
-
chartJSON.yMinRight = yMinRight;
|
|
24587
|
-
formatedDimensionList = isDateType ? setDateFormats(
|
|
24588
|
-
formatOptions.xAxisLabel.xAxisNumberFormat,
|
|
24589
|
-
chartJSON.dimensionList
|
|
24590
|
-
).map((d) => d) : chartJSON.dimensionList;
|
|
24591
|
-
chartJSON.dimensionList.forEach((dim, i) => {
|
|
24592
|
-
chartJSON.formattedDimensionListMap.set(dim, formatedDimensionList[i]);
|
|
24593
|
-
});
|
|
24594
24569
|
filteredData = JSON.parse(JSON.stringify(seriesData));
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
if (formatOptions.plotArea.hideZeroValues) {
|
|
24604
|
-
chartJSON.hideZeroValues = true;
|
|
24605
|
-
}
|
|
24570
|
+
filteredData.forEach(
|
|
24571
|
+
(d) => d.data.forEach((j) => cumulativeDataPoints.push(j.value))
|
|
24572
|
+
);
|
|
24573
|
+
let yMin = customYaxisMinValue || customYaxisMinValue == 0 ? customYaxisMinValue : 0;
|
|
24574
|
+
let yMax = customYaxisMaxValue || customYaxisMaxValue == 0 ? customYaxisMaxValue : filteredData[0]?.data?.length;
|
|
24575
|
+
chartJSON.yMaxLeft = parseFloat((yMin + "").length > (yMax + "").length ? yMin + "" : yMax + "");
|
|
24576
|
+
chartJSON.xMax = max$2(cumulativeDataPoints);
|
|
24577
|
+
chartJSON.xMin = min$2(cumulativeDataPoints);
|
|
24606
24578
|
};
|
|
24607
|
-
const
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
chartJSON.yMaxLeft = yAxisLabelArray[yAxisLabelArray.length - 1];
|
|
24618
|
-
chartJSON.yMinLeft = yAxisLabelArray[0];
|
|
24619
|
-
{
|
|
24620
|
-
xScaleBottom = linear$1().domain([
|
|
24621
|
-
chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : 0 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
|
|
24622
|
-
chartJSON.yMaxLeft <= 0 ? 0 : customYaxisMaxValue !== void 0 && !Number.isNaN(customYaxisMaxValue) ? customYaxisMaxValue : chartJSON.yMaxLeft * 1.1
|
|
24623
|
-
]).range([
|
|
24624
|
-
0,
|
|
24625
|
-
dataTableHeight > 0 ? innerWidth2 - dataTableHeight : innerWidth2
|
|
24626
|
-
]);
|
|
24579
|
+
const binsCalculation = () => {
|
|
24580
|
+
switch (formatOptions.bins.binsCalculation) {
|
|
24581
|
+
case "Automatic":
|
|
24582
|
+
thresholds = innerWidth2 / 50;
|
|
24583
|
+
break;
|
|
24584
|
+
case "Number of Bins":
|
|
24585
|
+
calculatingPeriodsWithBins(false);
|
|
24586
|
+
break;
|
|
24587
|
+
case "Bin Width":
|
|
24588
|
+
calculatingPeriodsWithBins(true);
|
|
24627
24589
|
}
|
|
24628
|
-
|
|
24629
|
-
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24590
|
+
};
|
|
24591
|
+
const calculatingPeriodsWithBins = (isWithWidth) => {
|
|
24592
|
+
filteredData.forEach(
|
|
24593
|
+
(d) => d.data.sort(function(a2, b) {
|
|
24594
|
+
return a2.value - b.value;
|
|
24595
|
+
})
|
|
24596
|
+
);
|
|
24597
|
+
let range2 = chartJSON.xMax - chartJSON.xMin;
|
|
24598
|
+
let tempPeriod;
|
|
24599
|
+
if (isWithWidth) {
|
|
24600
|
+
parseFloat(formatOptions.bins.binsCalculationValue) <= 2 && (formatOptions.bins.binsCalculationValue = "3");
|
|
24601
|
+
tempPeriod = range2 / parseFloat(formatOptions.bins.binsCalculationValue);
|
|
24602
|
+
} else {
|
|
24603
|
+
parseFloat(formatOptions.bins.binsCalculationValue) <= 1 && (formatOptions.bins.binsCalculationValue = "1");
|
|
24604
|
+
tempPeriod = range2 / parseFloat(formatOptions.bins.binsCalculationValue);
|
|
24636
24605
|
}
|
|
24637
|
-
|
|
24638
|
-
if (
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
)
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
|
|
24606
|
+
let currentElement = chartJSON.xMin;
|
|
24607
|
+
if (isWithWidth) {
|
|
24608
|
+
periods = [currentElement];
|
|
24609
|
+
while (currentElement < chartJSON.xMax) {
|
|
24610
|
+
currentElement += tempPeriod;
|
|
24611
|
+
periods.push(currentElement);
|
|
24612
|
+
}
|
|
24613
|
+
} else {
|
|
24614
|
+
periods = [currentElement];
|
|
24615
|
+
while (Math.round(currentElement) < Math.round(chartJSON.xMax)) {
|
|
24616
|
+
currentElement += tempPeriod;
|
|
24617
|
+
periods.push(Math.round(currentElement));
|
|
24618
|
+
}
|
|
24650
24619
|
}
|
|
24651
|
-
getYScale();
|
|
24652
24620
|
};
|
|
24653
|
-
const
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24621
|
+
const initScale = () => {
|
|
24622
|
+
xScale = linear$1().domain([chartJSON.xMin, chartJSON.xMax]).range([0, innerWidth2]);
|
|
24623
|
+
const numberOfBins = periods.length > 0 ? periods : xScale.ticks(thresholds);
|
|
24624
|
+
let histogram = bin().value((d) => d).domain(xScale.domain()).thresholds(numberOfBins);
|
|
24625
|
+
filteredData.forEach((d) => {
|
|
24626
|
+
let tempArray = histogram(d.data.map((val) => val.value));
|
|
24627
|
+
bins.push(tempArray);
|
|
24628
|
+
});
|
|
24629
|
+
filteredData.forEach(
|
|
24630
|
+
(d, i) => bins[i].forEach((j) => {
|
|
24631
|
+
j["name"] = d.properties["legend"];
|
|
24632
|
+
j["color"] = d.properties["color"];
|
|
24633
|
+
j["opacity"] = d.properties["opacity"];
|
|
24634
|
+
})
|
|
24657
24635
|
);
|
|
24658
|
-
|
|
24636
|
+
let cumulativeLength = [];
|
|
24637
|
+
bins.forEach((d) => d.forEach((j) => cumulativeLength.push(j.length)));
|
|
24638
|
+
chartJSON.yMaxLeft = max$2(cumulativeLength);
|
|
24639
|
+
chartJSON.yMinLeft = min$2(cumulativeLength);
|
|
24640
|
+
yScaleLeft = linear$1().range([innerHeight2, 0]).domain([customYaxisMinValue || customYaxisMinValue == 0 ? customYaxisMinValue : 0, customYaxisMaxValue || customYaxisMaxValue == 0 ? customYaxisMaxValue : chartJSON.yMaxLeft + 0.2 * chartJSON.yMaxLeft]);
|
|
24659
24641
|
};
|
|
24660
24642
|
const initAxis = () => {
|
|
24661
|
-
|
|
24643
|
+
getXAxis();
|
|
24662
24644
|
{
|
|
24663
24645
|
let responsiveLablesObj = responsiveYaxisLabel$1(
|
|
24664
|
-
|
|
24646
|
+
chartJSON.yMaxLeft,
|
|
24665
24647
|
chartJSON.yMinLeft,
|
|
24666
24648
|
innerHeight2,
|
|
24667
24649
|
formatOptions,
|
|
24668
24650
|
chartJSON,
|
|
24669
24651
|
customYaxisMinValue,
|
|
24670
|
-
customYaxisMaxValue
|
|
24652
|
+
customYaxisMaxValue,
|
|
24653
|
+
false,
|
|
24654
|
+
innerWidth2
|
|
24671
24655
|
);
|
|
24672
|
-
|
|
24656
|
+
yAxisLeft = axisLeft(yScaleLeft).tickFormat(
|
|
24673
24657
|
(d) => getNumberWithFormat(
|
|
24674
24658
|
d,
|
|
24675
24659
|
formatOptions.yAxisLabel.yAxisDisplayUnits,
|
|
@@ -24677,116 +24661,57 @@ const HorizontalHistogramChart = ({
|
|
|
24677
24661
|
formatOptions.yAxisLabel.yAxisLabelDecimalPrecision
|
|
24678
24662
|
)
|
|
24679
24663
|
).tickSize(
|
|
24680
|
-
formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -
|
|
24664
|
+
formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 + 0 : 0 : 0
|
|
24681
24665
|
).tickValues(responsiveLablesObj.autoLabelFlag ? void 0 : responsiveLablesObj.yAxisLabelArray).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
|
|
24682
24666
|
}
|
|
24683
|
-
if (isSecondaryAxisDrawn) {
|
|
24684
|
-
xAxisTop = axisTop(xScaleTop).tickFormat(
|
|
24685
|
-
(d) => getNumberWithFormat(
|
|
24686
|
-
d,
|
|
24687
|
-
formatOptions.secondaryYAxisLabel.secondaryYAxisDisplayUnits,
|
|
24688
|
-
formatOptions.secondaryYAxisLabel.secondaryYAxisNumberFormat,
|
|
24689
|
-
formatOptions.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision
|
|
24690
|
-
)
|
|
24691
|
-
).tickValues(
|
|
24692
|
-
responsiveSecondaryYaxisLabel(
|
|
24693
|
-
secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
|
|
24694
|
-
chartJSON.yMinRight,
|
|
24695
|
-
formatOptions,
|
|
24696
|
-
chartJSON
|
|
24697
|
-
).secondaryYAxisLabelArray
|
|
24698
|
-
).ticks(
|
|
24699
|
-
responsiveSecondaryYaxisLabel(
|
|
24700
|
-
secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
|
|
24701
|
-
chartJSON.yMinRight,
|
|
24702
|
-
formatOptions,
|
|
24703
|
-
chartJSON
|
|
24704
|
-
).secondaryCustomTickValue ?? innerHeight2 / 30
|
|
24705
|
-
).tickSize(
|
|
24706
|
-
formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 : 0 : 0
|
|
24707
|
-
).tickPadding(8).tickSizeOuter(0);
|
|
24708
|
-
}
|
|
24709
24667
|
};
|
|
24710
|
-
const
|
|
24711
|
-
|
|
24668
|
+
const getXAxis = () => {
|
|
24669
|
+
let xaxisLabelPosition = parseInt(formatOptions.xAxisLabel.xAxisPosition);
|
|
24670
|
+
let labelArray = responsiveXaxisLabelForNumericValue(chartJSON.xMax, chartJSON.xMin, innerWidth2, formatOptions, customXaxisMinValue, customXaxisMaxValue, innerHeight2, false).xAxisLabelArray;
|
|
24671
|
+
labelArray.shift();
|
|
24672
|
+
xAxis = (xaxisLabelPosition == 1 ? axisTop(xScale) : axisBottom(xScale)).tickFormat(
|
|
24673
|
+
(d) => getNumberWithFormat(
|
|
24674
|
+
d,
|
|
24675
|
+
formatOptions.xAxisLabel.xAxisDisplayUnits,
|
|
24676
|
+
formatOptions.xAxisLabel.xAxisNumberFormat,
|
|
24677
|
+
formatOptions.xAxisLabel.xAxisLabelDecimalPrecision,
|
|
24678
|
+
false
|
|
24679
|
+
)
|
|
24680
|
+
).tickSize(
|
|
24712
24681
|
formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesVertical ? formatOptions.plotArea.gridLinesVertical ? -(dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2) : parseFloat(formatOptions.plotArea.ticksHeight) * ((dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2) / 100) * (formatOptions.xAxisLabel.xAxisPosition == "1" ? 1 : -1) : 0 : 0
|
|
24713
|
-
).tickSizeOuter(0)
|
|
24682
|
+
).tickSizeOuter(0);
|
|
24683
|
+
formatOptions.bins.binsCalculation === "Automatic" ? xAxis.ticks(thresholds) : xAxis.tickValues(periods).ticks(innerWidth2 / 50);
|
|
24714
24684
|
};
|
|
24715
24685
|
const getChartType = (lineData) => {
|
|
24716
|
-
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
|
|
24721
|
-
|
|
24722
|
-
|
|
24723
|
-
|
|
24724
|
-
|
|
24725
|
-
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24686
|
+
gTag.append("g").attr("class", "parentGroup").selectAll("#scaling-svg" + chartId + " .rect").data(bins).enter().append("g").selectAll("rect").data((d) => d).enter().append("rect").attr("class", "rect").attr("stroke", formatOptions.bins.binsBorderVisibility && formatOptions.bins.binsBorderColor).attr(
|
|
24687
|
+
"stroke-width",
|
|
24688
|
+
formatOptions.bins.binsBorderVisibility && formatOptions.bins.binsBorderThickness
|
|
24689
|
+
).attr(
|
|
24690
|
+
"stroke-opacity",
|
|
24691
|
+
formatOptions.bins.binsBorderVisibility && formatOptions.bins.binsBorderOpacity
|
|
24692
|
+
).attr("x", 1).attr("transform", function(d) {
|
|
24693
|
+
return "translate(" + xScale(d.x0) + "," + (yScaleLeft(d.length) > 0 ? yScaleLeft(d.length) : 0) + ")";
|
|
24694
|
+
}).attr("width", function(d) {
|
|
24695
|
+
return xScale(d.x1) - xScale(d.x0) - parseFloat(formatOptions.bins.binsGapWidth) < 0 ? 0 : xScale(d.x1) - xScale(d.x0) - parseFloat(formatOptions.bins.binsGapWidth);
|
|
24696
|
+
}).attr("height", function(d) {
|
|
24697
|
+
return innerHeight2 - yScaleLeft(d.length);
|
|
24698
|
+
}).style("fill", (d) => d.color !== "#ffffff" ? d.color : "none").style("opacity", formatOptions.bins.binsFillOpacity).style("shape-rendering", "crispEdges").on("mousemove", (event2, d) => {
|
|
24699
|
+
showTooltipOnMouseMove(
|
|
24700
|
+
[
|
|
24701
|
+
{
|
|
24702
|
+
key: formatOptions.xAxisTitle.xAxisTitleText.includes("~$~") ? formatOptions.xAxisTitle.xAxisTitleText.split("~$~")[1] : formatOptions.xAxisTitle.xAxisTitleText,
|
|
24703
|
+
value: `${d["x0"]}-${d["x1"]}`
|
|
24704
|
+
},
|
|
24705
|
+
{
|
|
24706
|
+
key: formatOptions.yAxisTitle.yAxisTitleText,
|
|
24707
|
+
value: getNumberWithFormat(formatOptions.toolTip.toolTipNumberFormat == ",.0%" ? Math.abs(d.length / filteredData[0].data.length) : d.length, formatOptions.toolTip.toolTipDisplayUnits, formatOptions.toolTip.toolTipNumberFormat, formatOptions.toolTip.toolTipDecimalPrecision, false)
|
|
24708
|
+
}
|
|
24709
|
+
],
|
|
24710
|
+
formatOptions,
|
|
24711
|
+
event2
|
|
24740
24712
|
);
|
|
24741
|
-
|
|
24742
|
-
|
|
24743
|
-
return d.value > 0 ? requiredXScale(0) : requiredXScale(d.value);
|
|
24744
|
-
}).attr("width", (d) => {
|
|
24745
|
-
const requiredXScale = data2.properties.axis === "Primary" ? xScaleBottom : xScaleTop;
|
|
24746
|
-
const requiredCustomValue = data2.properties.axis === "Primary" ? customYaxisMaxValue : secondaryCustomYaxisMaxValue;
|
|
24747
|
-
return d.value > 0 ? requiredCustomValue && d.value > requiredCustomValue ? requiredXScale(requiredCustomValue) - requiredXScale(0) : requiredXScale(d.value) - requiredXScale(0) : Math.abs(requiredXScale(0) - requiredXScale(d.value));
|
|
24748
|
-
}).attr("fill", data2.properties.color).attr(
|
|
24749
|
-
"stroke-dasharray",
|
|
24750
|
-
(d) => d.stackBorderStyle === 2 ? "5,3" : "0"
|
|
24751
|
-
).attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
|
|
24752
|
-
"stroke",
|
|
24753
|
-
(d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
|
|
24754
|
-
).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
|
|
24755
|
-
"visibility",
|
|
24756
|
-
(d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
|
|
24757
|
-
).on("mousemove", (event2, d) => {
|
|
24758
|
-
showTooltipOnMouseMove(
|
|
24759
|
-
[
|
|
24760
|
-
{
|
|
24761
|
-
key: formatOptions.xAxisTitle.xAxisTitleText.includes("~$~") ? formatOptions.xAxisTitle.xAxisTitleText.split("~$~")[1] : formatOptions.xAxisTitle.xAxisTitleText,
|
|
24762
|
-
value: chartJSON.formattedDimensionListMap.get(
|
|
24763
|
-
Array.isArray(d.dimension) ? d.dimension[0] : d.dimension
|
|
24764
|
-
)
|
|
24765
|
-
},
|
|
24766
|
-
{
|
|
24767
|
-
key: formatOptions.yAxisTitle.yAxisTitleText || d.value,
|
|
24768
|
-
value: getNumberWithFormat(
|
|
24769
|
-
[
|
|
24770
|
-
actualChartTypes.stackLine100,
|
|
24771
|
-
actualChartTypes.stackArea100,
|
|
24772
|
-
""
|
|
24773
|
-
].includes(chartType) ? d[1] - d[0] : d.value,
|
|
24774
|
-
formatOptions.toolTip.toolTipDisplayUnits,
|
|
24775
|
-
formatOptions.toolTip.toolTipNumberFormat,
|
|
24776
|
-
formatOptions.toolTip.toolTipDecimalPrecision
|
|
24777
|
-
)
|
|
24778
|
-
},
|
|
24779
|
-
{
|
|
24780
|
-
key: "Legend",
|
|
24781
|
-
value: d.legend.includes("~$~") ? d.legend.split("~$~")[1] : d.legend
|
|
24782
|
-
}
|
|
24783
|
-
],
|
|
24784
|
-
formatOptions,
|
|
24785
|
-
event2
|
|
24786
|
-
);
|
|
24787
|
-
}).on("mouseout", hideTooltipOnMouseOut);
|
|
24788
|
-
columnGroups.exit().remove();
|
|
24789
|
-
});
|
|
24713
|
+
}).on("mouseout", hideTooltipOnMouseOut);
|
|
24714
|
+
gTag.selectAll(".parentGroup").raise();
|
|
24790
24715
|
};
|
|
24791
24716
|
const setSVGContainer = (margin2) => {
|
|
24792
24717
|
innerWidth2 = width - margin2.left - margin2.right;
|
|
@@ -24800,14 +24725,12 @@ const HorizontalHistogramChart = ({
|
|
|
24800
24725
|
scrollPosition,
|
|
24801
24726
|
scrollPosition + visibleBars
|
|
24802
24727
|
);
|
|
24803
|
-
getYScale();
|
|
24804
24728
|
filteredData = JSON.parse(JSON.stringify(seriesData2));
|
|
24805
24729
|
filteredData.forEach(
|
|
24806
24730
|
(data2, i) => filteredData[i].data = data2.data.filter(
|
|
24807
24731
|
(d) => filteredDimension.includes(d.dimension)
|
|
24808
24732
|
)
|
|
24809
24733
|
);
|
|
24810
|
-
getYAxis();
|
|
24811
24734
|
svg2.append("rect").attr("x", margin2.left).attr("y", scrollbarY).attr("width", innerWidth22).attr("height", 8).attr("fill", "#ddd").attr("rx", 4);
|
|
24812
24735
|
const handleWidth = innerWidth22 * visibleBars / chartJSON.dimensionList.length;
|
|
24813
24736
|
const handle = svg2.append("rect").attr("x", margin2.left).attr("y", scrollbarY).attr("width", handleWidth).attr("height", 8).attr("fill", "#999").attr("rx", 4).style("cursor", "ew-resize").call(
|
|
@@ -24824,14 +24747,13 @@ const HorizontalHistogramChart = ({
|
|
|
24824
24747
|
scrollPosition,
|
|
24825
24748
|
scrollPosition + visibleBars
|
|
24826
24749
|
);
|
|
24827
|
-
getYScale();
|
|
24828
24750
|
filteredData = JSON.parse(JSON.stringify(seriesData2));
|
|
24829
24751
|
filteredData.forEach(
|
|
24830
24752
|
(data2, i) => filteredData[i].data = data2.data.filter(
|
|
24831
24753
|
(d) => filteredDimension.includes(d.dimension)
|
|
24832
24754
|
)
|
|
24833
24755
|
);
|
|
24834
|
-
|
|
24756
|
+
getXAxis();
|
|
24835
24757
|
drawColumnChart();
|
|
24836
24758
|
})
|
|
24837
24759
|
);
|
|
@@ -24842,57 +24764,36 @@ const HorizontalHistogramChart = ({
|
|
|
24842
24764
|
scrollPosition = Math.max(0, Math.min(scrollPosition, scrollMax));
|
|
24843
24765
|
const x2 = margin2.left + (innerWidth22 - handleWidth) * scrollPosition / scrollMax;
|
|
24844
24766
|
handle.attr("x", x2);
|
|
24845
|
-
getYScale();
|
|
24846
24767
|
filteredData = JSON.parse(JSON.stringify(seriesData2));
|
|
24847
24768
|
filteredData.forEach(
|
|
24848
24769
|
(data2, i) => filteredData[i].data = data2.data.filter(
|
|
24849
24770
|
(d) => filteredDimension.includes(d.dimension)
|
|
24850
24771
|
)
|
|
24851
24772
|
);
|
|
24852
|
-
|
|
24773
|
+
getXAxis();
|
|
24853
24774
|
drawColumnChart();
|
|
24854
24775
|
});
|
|
24855
24776
|
}
|
|
24856
24777
|
drawColumnChart();
|
|
24857
24778
|
};
|
|
24858
24779
|
const drawColumnChart = () => {
|
|
24859
|
-
|
|
24860
|
-
initXaxisBar(
|
|
24861
|
-
formatOptions,
|
|
24780
|
+
initXaxis$1(
|
|
24862
24781
|
gTag,
|
|
24863
|
-
|
|
24864
|
-
|
|
24865
|
-
innerWidth2,
|
|
24866
|
-
xAxisBottom
|
|
24867
|
-
);
|
|
24868
|
-
commonAnnotations(
|
|
24869
|
-
filteredData,
|
|
24870
|
-
yScale,
|
|
24871
|
-
xScaleBottom,
|
|
24872
|
-
xScaleTop,
|
|
24873
|
-
// need to pass secondary axis scale if secondary axis is drawn
|
|
24874
|
-
margin,
|
|
24875
|
-
d3Annotation,
|
|
24876
|
-
[],
|
|
24877
|
-
//this.labelExcludeList,
|
|
24878
|
-
[],
|
|
24879
|
-
//this.individualLabelColor,
|
|
24880
|
-
[],
|
|
24881
|
-
//this.attributes.Id ? formatOptions.plotArea.dataLabelsCoordinates : this.parentReference.objService.tempAnnotationArray
|
|
24782
|
+
chartJSON,
|
|
24783
|
+
xLabel,
|
|
24882
24784
|
formatOptions,
|
|
24883
|
-
|
|
24785
|
+
dataTableHeight,
|
|
24786
|
+
yScaleLeft,
|
|
24787
|
+
xAxis,
|
|
24788
|
+
dimensionHeightWidthArray,
|
|
24884
24789
|
height,
|
|
24885
|
-
|
|
24790
|
+
columnWidth,
|
|
24791
|
+
isDateType,
|
|
24886
24792
|
innerWidth2,
|
|
24887
|
-
filteredDimension,
|
|
24888
24793
|
innerHeight2,
|
|
24889
|
-
|
|
24890
|
-
svg,
|
|
24891
|
-
yScaleLegends,
|
|
24892
|
-
columnWidth,
|
|
24893
|
-
false,
|
|
24894
|
-
barChart
|
|
24794
|
+
filteredDimension
|
|
24895
24795
|
);
|
|
24796
|
+
getChartType();
|
|
24896
24797
|
};
|
|
24897
24798
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
24898
24799
|
"svg",
|
|
@@ -26715,7 +26616,7 @@ const PieChart = ({ data, formatOptions, chartId }) => {
|
|
|
26715
26616
|
};
|
|
26716
26617
|
const defineChartRadius = () => {
|
|
26717
26618
|
try {
|
|
26718
|
-
radius = Math.min(innerHeight2 * 0.
|
|
26619
|
+
radius = Math.min(innerHeight2 * 0.5, innerWidth2 * 0.5);
|
|
26719
26620
|
outsideDataLabelFlag ? radius = radius * 0.9 : null;
|
|
26720
26621
|
} catch (error) {
|
|
26721
26622
|
logError$2(fileName$8, "defineChartRadius", error);
|
|
@@ -26789,16 +26690,20 @@ const PieChart = ({ data, formatOptions, chartId }) => {
|
|
|
26789
26690
|
return "";
|
|
26790
26691
|
}
|
|
26791
26692
|
};
|
|
26792
|
-
const getDataLabelTransformString = (d) => {
|
|
26693
|
+
const getDataLabelTransformString = (d, isSingleDataLabel) => {
|
|
26793
26694
|
try {
|
|
26794
|
-
|
|
26795
|
-
|
|
26796
|
-
|
|
26797
|
-
|
|
26798
|
-
|
|
26799
|
-
|
|
26800
|
-
|
|
26801
|
-
|
|
26695
|
+
if (isSingleDataLabel) {
|
|
26696
|
+
return `translate(0 0)`;
|
|
26697
|
+
} else {
|
|
26698
|
+
const midAngle = (d.startAngle + d.endAngle) / 2;
|
|
26699
|
+
const x2 = Math.cos(midAngle - Math.PI / 2) * (radius * 0.65);
|
|
26700
|
+
const y2 = Math.sin(midAngle - Math.PI / 2) * (radius * 0.65);
|
|
26701
|
+
let rotate = midAngle * 180 / Math.PI % 360;
|
|
26702
|
+
let angle = 0;
|
|
26703
|
+
rotate > 180 && rotate < 360 ? angle = 90 : angle = -90;
|
|
26704
|
+
rotate += angle;
|
|
26705
|
+
return `translate(${x2},${y2}) rotate(${rotate})`;
|
|
26706
|
+
}
|
|
26802
26707
|
} catch (error) {
|
|
26803
26708
|
logError$2(fileName$8, "getDataLabelTransformString", error);
|
|
26804
26709
|
return "";
|
|
@@ -26807,6 +26712,7 @@ const PieChart = ({ data, formatOptions, chartId }) => {
|
|
|
26807
26712
|
const drawPieDataLabels = () => {
|
|
26808
26713
|
try {
|
|
26809
26714
|
if (chartFormatOptions.plotArea.dataLabels) {
|
|
26715
|
+
const isSingleDataLabel = pieChartData && pieChartData.length === 1;
|
|
26810
26716
|
chartAreaTagG.append("g").attr("class", "parentGroup").attr("transform", `${getPiePosition()}`).attr("pointer-events", "none").attr("text-anchor", "middle").selectAll("text").data(
|
|
26811
26717
|
pieChartData.filter(
|
|
26812
26718
|
(d) => d.data.properties.dataLabelPosition == "1"
|
|
@@ -26825,7 +26731,7 @@ const PieChart = ({ data, formatOptions, chartId }) => {
|
|
|
26825
26731
|
).attr(
|
|
26826
26732
|
"font-family",
|
|
26827
26733
|
(d) => d.data.properties?.labelFont ?? "Helvetica"
|
|
26828
|
-
).attr("transform", (d) => getDataLabelTransformString(d)).attr("dy", "-0.35em").attr("text-anchor", "middle").attr("alignment-baseline", "middle").text((d) => {
|
|
26734
|
+
).attr("transform", (d) => getDataLabelTransformString(d, isSingleDataLabel)).attr("visibility", (d) => d.endAngle - d.startAngle < 0.17 ? "hidden" : "visible").attr("dy", "-0.35em").attr("text-anchor", "middle").attr("alignment-baseline", "middle").text((d) => {
|
|
26829
26735
|
const { plotArea } = chartFormatOptions;
|
|
26830
26736
|
if (plotArea.dataLabelName) {
|
|
26831
26737
|
return d.data.legend;
|
|
@@ -26850,7 +26756,7 @@ const PieChart = ({ data, formatOptions, chartId }) => {
|
|
|
26850
26756
|
).attr(
|
|
26851
26757
|
"font-family",
|
|
26852
26758
|
(d) => d.data.properties?.valueFont ?? "Helvetica"
|
|
26853
|
-
).attr("transform", (d) => getDataLabelTransformString(d)).attr("text-anchor", "middle").attr("alignment-baseline", "middle").attr("dy", chartFormatOptions.plotArea.dataLabelName ? "1.00em" : "0").text((d) => {
|
|
26759
|
+
).attr("transform", (d) => getDataLabelTransformString(d, isSingleDataLabel)).attr("visibility", (d) => d.endAngle - d.startAngle < 0.17 ? "hidden" : "visible").attr("text-anchor", "middle").attr("alignment-baseline", "middle").attr("dy", chartFormatOptions.plotArea.dataLabelName ? "1.00em" : "0").text((d) => {
|
|
26854
26760
|
if (chartFormatOptions.plotArea.dataLabelValue) {
|
|
26855
26761
|
const dataValue = d.data.data[0].value;
|
|
26856
26762
|
if (chartFormatOptions.plotArea.dataLabelValue && dataValue !== void 0) {
|
|
@@ -27062,7 +26968,7 @@ const DonutChart = ({
|
|
|
27062
26968
|
};
|
|
27063
26969
|
const defineChartRadius = () => {
|
|
27064
26970
|
try {
|
|
27065
|
-
radius = Math.min(innerHeight2 * 0.
|
|
26971
|
+
radius = Math.min(innerHeight2 * 0.5, innerWidth2 * 0.5);
|
|
27066
26972
|
outsideDataLabelFlag ? radius = radius * 0.9 : null;
|
|
27067
26973
|
innerRadius = Math.min(
|
|
27068
26974
|
convertStringToNumber(chartFormatOptions.plotArea.innerRadius) / 100 * radius,
|
|
@@ -27152,17 +27058,21 @@ const DonutChart = ({
|
|
|
27152
27058
|
return "";
|
|
27153
27059
|
}
|
|
27154
27060
|
};
|
|
27155
|
-
const getDataLabelTransformString = (d) => {
|
|
27061
|
+
const getDataLabelTransformString = (d, isSingleDataLabel) => {
|
|
27156
27062
|
try {
|
|
27157
|
-
|
|
27158
|
-
|
|
27159
|
-
|
|
27160
|
-
|
|
27161
|
-
|
|
27162
|
-
|
|
27163
|
-
|
|
27164
|
-
|
|
27165
|
-
|
|
27063
|
+
if (isSingleDataLabel) {
|
|
27064
|
+
return `translate(0 0)`;
|
|
27065
|
+
} else {
|
|
27066
|
+
const midAngle = (d.startAngle + d.endAngle) / 2;
|
|
27067
|
+
const labelRadius = (innerRadius + radius) / 2;
|
|
27068
|
+
const x2 = Math.cos(midAngle - Math.PI / 2) * labelRadius;
|
|
27069
|
+
const y2 = Math.sin(midAngle - Math.PI / 2) * labelRadius;
|
|
27070
|
+
let rotate = midAngle * 180 / Math.PI % 360;
|
|
27071
|
+
let angle = 0;
|
|
27072
|
+
rotate > 180 && rotate < 360 ? angle = 90 : angle = -90;
|
|
27073
|
+
rotate += angle;
|
|
27074
|
+
return `translate(${x2},${y2}) rotate(${rotate})`;
|
|
27075
|
+
}
|
|
27166
27076
|
} catch (error) {
|
|
27167
27077
|
logError$2(fileName$7, "getDataLabelTransformString", error);
|
|
27168
27078
|
return "";
|
|
@@ -27171,6 +27081,7 @@ const DonutChart = ({
|
|
|
27171
27081
|
const drawDonutDataLabels = () => {
|
|
27172
27082
|
try {
|
|
27173
27083
|
if (chartFormatOptions.plotArea.dataLabels) {
|
|
27084
|
+
const isSingleDataLabel = pieChartData && pieChartData.length === 1;
|
|
27174
27085
|
chartAreaTagG.append("g").attr("class", "parentGroup").attr("transform", `${getPiePosition()}`).attr("pointer-events", "none").attr("text-anchor", "middle").selectAll("text").data(
|
|
27175
27086
|
pieChartData.filter(
|
|
27176
27087
|
(d) => d.data.properties.dataLabelPosition == "1"
|
|
@@ -27189,7 +27100,7 @@ const DonutChart = ({
|
|
|
27189
27100
|
).attr(
|
|
27190
27101
|
"font-family",
|
|
27191
27102
|
(d) => d.data.properties?.labelFont ?? "Helvetica"
|
|
27192
|
-
).attr("transform", (d) => getDataLabelTransformString(d)).attr("dy", "-0.35em").attr("text-anchor", "middle").attr("alignment-baseline", "middle").text((d) => {
|
|
27103
|
+
).attr("transform", (d) => getDataLabelTransformString(d, isSingleDataLabel)).attr("visibility", (d) => d.endAngle - d.startAngle < 0.17 ? "hidden" : "visible").attr("dy", "-0.35em").attr("text-anchor", "middle").attr("alignment-baseline", "middle").text((d) => {
|
|
27193
27104
|
const { plotArea } = chartFormatOptions;
|
|
27194
27105
|
if (plotArea.dataLabelName) {
|
|
27195
27106
|
return d.data.legend;
|
|
@@ -27214,7 +27125,7 @@ const DonutChart = ({
|
|
|
27214
27125
|
).attr(
|
|
27215
27126
|
"font-family",
|
|
27216
27127
|
(d) => d.data.properties?.valueFont ?? "Helvetica"
|
|
27217
|
-
).attr("transform", (d) => getDataLabelTransformString(d)).attr("text-anchor", "middle").attr("alignment-baseline", "middle").attr("dy", chartFormatOptions.plotArea.dataLabelName ? "1.00em" : "0").text((d) => {
|
|
27128
|
+
).attr("transform", (d) => getDataLabelTransformString(d, isSingleDataLabel)).attr("visibility", (d) => d.endAngle - d.startAngle < 0.17 ? "hidden" : "visible").attr("text-anchor", "middle").attr("alignment-baseline", "middle").attr("dy", chartFormatOptions.plotArea.dataLabelName ? "1.00em" : "0").text((d) => {
|
|
27218
27129
|
if (chartFormatOptions.plotArea.dataLabelValue) {
|
|
27219
27130
|
const dataValue = d.data.data[0].value;
|
|
27220
27131
|
if (chartFormatOptions.plotArea.dataLabelValue && dataValue !== void 0) {
|
|
@@ -54406,11 +54317,11 @@ export {
|
|
|
54406
54317
|
AreaChart,
|
|
54407
54318
|
BubbleChart,
|
|
54408
54319
|
ColumnChart,
|
|
54409
|
-
ColumnHistogramChart,
|
|
54320
|
+
ColumnHistogramChart$1 as ColumnHistogramChart,
|
|
54410
54321
|
CustomColumnChart,
|
|
54411
54322
|
DonutChart,
|
|
54412
54323
|
HorizontalBarChart,
|
|
54413
|
-
HorizontalHistogramChart,
|
|
54324
|
+
ColumnHistogramChart as HorizontalHistogramChart,
|
|
54414
54325
|
LayeredColumnChart,
|
|
54415
54326
|
LayeredHorizontalBarChart,
|
|
54416
54327
|
LineChart,
|