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