pace-chart-lib 1.0.8 → 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.
@@ -11407,7 +11407,8 @@
11407
11407
  dataTableFontStyle: [],
11408
11408
  dataTableNumberFormat: ",",
11409
11409
  dataTableDecimalPrecision: "2",
11410
- dataTableDisplayUnits: "None"
11410
+ dataTableDisplayUnits: "None",
11411
+ dataTableLabelColor: "#000000"
11411
11412
  },
11412
11413
  dataTableOuterBorder: {
11413
11414
  borderButtonVisibility: true,
@@ -11733,8 +11734,8 @@
11733
11734
  xAxisObject,
11734
11735
  isBarChart
11735
11736
  );
11736
- const legendPosition = formatOptions.legends.legendPosition;
11737
11737
  const legendVisibility = formatOptions.legends.legendVisibility;
11738
+ const legendPosition = legendVisibility ? formatOptions.legends.legendPosition : staticLegendPosition.none;
11738
11739
  const scrollHeightConstant = isScrollbarVisible ? 12 : 0;
11739
11740
  const xAxisRelatedMargin = isBarChart ? metrics.yTitle + metrics.yLabel : metrics.xTitle + metrics.xLabel;
11740
11741
  let top2 = 0;
@@ -13047,7 +13048,7 @@
13047
13048
  let axis2 = d.x.axis;
13048
13049
  return dataLabelsPositionForBarChartFamily(formatOptions, d.x.measure ? d.x.measure : 0, d.position, requiredXScale, minValue, void 0, chartType, isSensitivityChart, axis2);
13049
13050
  } else if (chartType === actualChartTypes.column) {
13050
- return xScale(d.x) + xScaleForLegends(d.currentLegend) - (columnWidth - xScaleForLegends.bandwidth()) / 2;
13051
+ return xScaleForLegends(d.currentLegend) ? xScale(d.x) + xScaleForLegends(d.currentLegend) - (columnWidth - xScaleForLegends.bandwidth()) / 2 : xScale(d.x);
13051
13052
  } else {
13052
13053
  return xScale(d.x);
13053
13054
  }
@@ -13065,7 +13066,7 @@
13065
13066
  } else {
13066
13067
  if (barChart) {
13067
13068
  let actualColWidth = chartType === actualChartTypes.tornadoChart || chartType === actualChartTypes.layeredBarChart ? xScaleForLegends.bandwidth() : -columnWidth;
13068
- return (xScaleForLegends && xScaleForLegends(d.currentLegend) ? xScaleForLegends(d.currentLegend) : 0) + xScale(d.y) + (actualColWidth - 3) / 2;
13069
+ return (xScaleForLegends && xScaleForLegends(d.currentLegend) ? xScaleForLegends(d.currentLegend) + xScaleForLegends.bandwidth() / 2 : 0) + xScale(d.y) - 5;
13069
13070
  } else
13070
13071
  return dataLabelsPosition(
13071
13072
  d.y.measure,
@@ -13615,7 +13616,7 @@
13615
13616
  parentTag.append("foreignObject").attr("x", (d) => 0).attr("y", tableStartY + yCordinate).attr("width", (d, index2) => index2 === 0 ? cellWidth + outerPadding + calWidthForSeriesNames / 2 : index2 === dimensionCount - 1 ? cellWidth + outerPadding - calWidthForSeriesNames / 2 : cellWidth).attr("height", cellHeight).style("justify-content", "center").append("xhtml:div").attr("class", "middlepart").style("width", (d, index2) => index2 === 0 ? cellWidth + outerPadding + calWidthForSeriesNames / 2 : index2 === dimensionCount - 1 ? cellWidth + outerPadding - calWidthForSeriesNames / 2 : cellWidth).style("height", `${cellHeight}px`).style("line-height", `${cellHeight}px`).style("border-width", (d, pos) => getBorderStyle(formatOptions, i, pos, dimensionCount, legendsCount, "width")).style("border-style", (d, pos) => getBorderStyle(formatOptions, i, pos, dimensionCount, legendsCount, "style")).style("border-color", (d, pos) => getBorderStyle(formatOptions, i, pos, dimensionCount, legendsCount, "color")).style("text-align", "center").style("white-space", "nowrap").style("text-overflow", "ellipsis").style("overflow", "hidden").style("padding-inline", "3px").style("font-size", formatOptions.dataTableProperties.dataTableFontSize + "px").style("font-family", formatOptions.dataTableProperties.dataTableFontFamily).style("font-style", fontStyle.includes("Italic") ? "Italic" : "").style(
13616
13617
  "text-decoration",
13617
13618
  fontStyle.includes("Underline") ? "Underline" : ""
13618
- ).style("color", "black").style("font-weight", fontStyle.includes("Bold") ? "Bold" : "").attr("title", (d) => getNumberWithFormat(
13619
+ ).style("color", formatOptions.dataTableProperties.dataTableLabelColor).style("font-weight", fontStyle.includes("Bold") ? "Bold" : "").attr("title", (d) => getNumberWithFormat(
13619
13620
  chartType.includes("100stack") ? d.TooltipMeasure / d.TotalMeasure : d.TooltipMeasure || d.value,
13620
13621
  formatOptions.dataTableProperties.dataTableDisplayUnits,
13621
13622
  formatOptions.dataTableProperties.dataTableNumberFormat,
@@ -14464,16 +14465,18 @@
14464
14465
  y: d.data.dimension,
14465
14466
  x: d[1] > 0 ? d[1] : d[0],
14466
14467
  prevValue: d[0] >= 0 ? d[0] : d[1],
14467
- position: d.data.labelPosition,
14468
+ position: formatOptions.annotation.annotationPosition == "4" ? d.data.labelPosition : JSON.parse(formatOptions.annotation.annotationPosition),
14468
14469
  currentLegend: d.key.includes("~$~") ? d.key.split("~$~")[1] : d.key,
14469
- isVisible: true
14470
+ isVisible: true,
14471
+ hoverId: d.properties.alias ? getHoverId(d.properties.alias) : getHoverId(d.key)
14470
14472
  } : {
14471
14473
  x: d.data.dimension,
14472
14474
  y: d[1] > 0 ? d[1] : d[0],
14473
14475
  prevValue: d[0] >= 0 ? d[0] : d[1],
14474
- position: d.data.labelPosition,
14476
+ position: formatOptions.annotation.annotationPosition == "4" ? d.data.labelPosition : JSON.parse(formatOptions.annotation.annotationPosition),
14475
14477
  currentLegend: d.key.includes("~$~") ? d.key.split("~$~")[1] : d.key,
14476
- isVisible: true
14478
+ isVisible: true,
14479
+ hoverId: d.properties.alias ? getHoverId(d.properties.alias) : getHoverId(d.key)
14477
14480
  },
14478
14481
  dx: 0,
14479
14482
  dy: 0,
@@ -14595,7 +14598,7 @@
14595
14598
  }
14596
14599
  });
14597
14600
  annotations.selectAll("text").append("text").style("fill", formatOptions.annotation.annotationColor !== "#ffffff" ? formatOptions.annotation.annotationColor : "none");
14598
- annotations.selectAll("tspan").attr("hoverId", (d) => d.data.currentLegend.replaceAll(" ", "-")).style("visibility", (d) => parseFloat(d.data.y) == 0 && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible");
14601
+ annotations.selectAll("tspan").attr("hoverId", (d) => d.data.hoverId ? d.data.hoverId : d.data.currentLegend.replaceAll(" ", "-")).style("visibility", (d) => parseFloat(d.data.y) == 0 && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible");
14599
14602
  return annotations;
14600
14603
  };
14601
14604
  const initXaxisBar = (formatOptions, gTag, yLabel, innerHeight2, innerWidth2, xAxisBottom) => {
@@ -14616,7 +14619,10 @@
14616
14619
  "visibility",
14617
14620
  formatOptions.yAxisLabel.yAxisLabelVisibility ? "visible" : "hidden"
14618
14621
  );
14619
- xAxisG.select(".domain").style("shape-rendering", "crispEdges").style(
14622
+ xAxisG.select(".domain").attr(
14623
+ "visibility",
14624
+ formatOptions.yAxisLabel.yAxisLabelVisibility ? "visible" : "hidden"
14625
+ ).style("shape-rendering", "crispEdges").style(
14620
14626
  "stroke",
14621
14627
  formatOptions.yAxisLabel.yAxisColorInverted
14622
14628
  ).attr("stroke-width", formatOptions.yAxisLabel.yAxisWidth ? formatOptions.yAxisLabel.yAxisWidth : formatOptions.plotArea.plotAreaBorderThickness);
@@ -14628,7 +14634,7 @@
14628
14634
  try {
14629
14635
  let fontStyle = formatOptions.xAxisLabel.xAxisLabelFontStyle;
14630
14636
  let xaxisLabelPosition = parseInt(formatOptions.xAxisLabel.xAxisPosition);
14631
- let responsiveDimList = responsiveXaxisLabel(dimensionList, innerWidth2);
14637
+ let responsiveDimList = responsiveXaxisLabel(dimensionList, innerHeight2);
14632
14638
  let labelWidth = formatOptions.xAxisLabel.labelTextWrap ? dimensionHeightWidthArray[3] + 10 < width * 0.1 ? dimensionHeightWidthArray[3] + 10 : width * 0.1 : formatOptions.xAxisLabel.xAxisLabelRotation == 0 ? columnWidth : dimensionHeightWidthArray[0] + 5;
14633
14639
  let xLabelMargin = formatOptions.xAxisLabel.labelTextWrap ? xLabel : labelWidth;
14634
14640
  let formatedResponsiveDimList = isDateType ? setDateFormats(
@@ -14999,8 +15005,9 @@
14999
15005
  actualChartTypes.speedometerChart,
15000
15006
  actualChartTypes.radialBarChart
15001
15007
  ];
15002
- function drawLegends(height, svg, maxLegendDimensions, chartTitleHeight, width, legendMargin, formatOptions, seriesData, chartId, legendShape) {
15008
+ function drawLegends(height, svg, maxLegendDimensions, chartTitleHeight, width, legendMargin, formatOptions, inputSeries, chartId, legendShape) {
15003
15009
  try {
15010
+ let seriesData = [...inputSeries].reverse();
15004
15011
  let position = formatOptions.legends.legendPosition;
15005
15012
  let horizontalLegendAlignment = formatOptions.legends.legendAlignmentTopBottom;
15006
15013
  let verticalLegendAlignment = formatOptions.legends.legendAlignment;
@@ -15770,6 +15777,7 @@
15770
15777
  const marginCalculationsForChartsWithoutAxis = (chartFormatOptions, width, height, maxLegendDimensions, margins, isVennChart = false) => {
15771
15778
  try {
15772
15779
  let legendPosition = chartFormatOptions.legends.legendPosition;
15780
+ legendPosition = chartFormatOptions.legends.legendVisibility ? chartFormatOptions.legends.legendPosition : staticLegendPosition.none;
15773
15781
  let width15Percent = width * 0.15 * 0.8;
15774
15782
  let legendListWidth = isVennChart ? maxLegendDimensions[0] : width15Percent < maxLegendDimensions[0] + 15 ? width15Percent : maxLegendDimensions[0] + 15;
15775
15783
  let chartTitleHeight = chartFormatOptions.chartTitle.chartTitleVisibility ? chartFormatOptions.chartTitle.dynamicTitleText.length !== 0 ? preCalculateTextDimensions(
@@ -15783,10 +15791,10 @@
15783
15791
  ).height : 5;
15784
15792
  switch (legendPosition) {
15785
15793
  case staticLegendPosition.none:
15786
- margins.top = chartTitleHeight + 20;
15787
- margins.bottom = 50;
15788
- margins.right = 50;
15789
- margins.left = 50;
15794
+ margins.top = chartTitleHeight + 10;
15795
+ margins.bottom = 15;
15796
+ margins.right = 15;
15797
+ margins.left = 15;
15790
15798
  break;
15791
15799
  case staticLegendPosition.top:
15792
15800
  margins.top = chartTitleHeight + 50;
@@ -16089,6 +16097,13 @@
16089
16097
  } catch (e) {
16090
16098
  }
16091
16099
  };
16100
+ const getHoverId = (inputText) => {
16101
+ try {
16102
+ return inputText.includes("~$~") ? inputText.split("~$~")[1].replace(/ /g, "-") : inputText.replace(/ /g, "-");
16103
+ } catch (error) {
16104
+ return inputText;
16105
+ }
16106
+ };
16092
16107
  const ColumnChart = ({
16093
16108
  isDateType,
16094
16109
  formatOptions,
@@ -16667,7 +16682,10 @@
16667
16682
  let stackChartData = [];
16668
16683
  const chartType = actualChartTypes.customColumnChart;
16669
16684
  const svgRef = require$$0$1.useRef();
16670
- const seriesData = generalizedChartData(data.ChartData, data.DimensionList);
16685
+ const seriesData = generalizedChartData(
16686
+ data.ChartData,
16687
+ data.DimensionList
16688
+ );
16671
16689
  const dimensionList = data.DimensionList;
16672
16690
  const barChart = false;
16673
16691
  let isSecondaryAxisDrawn = false;
@@ -17158,7 +17176,9 @@
17158
17176
  )
17159
17177
  ).tickSize(
17160
17178
  formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 + 0 : 0 : 0
17161
- ).tickValues(responsiveLablesObj.autoLabelFlag ? void 0 : responsiveLablesObj.yAxisLabelArray).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
17179
+ ).tickValues(
17180
+ responsiveLablesObj.autoLabelFlag ? void 0 : responsiveLablesObj.yAxisLabelArray
17181
+ ).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
17162
17182
  }
17163
17183
  if (isSecondaryAxisDrawn) {
17164
17184
  yAxisRight = axisRight(yScaleRight).tickFormat(
@@ -18145,7 +18165,7 @@
18145
18165
  const seriesData = generalizedChartData(
18146
18166
  data.ChartData,
18147
18167
  data.DimensionList
18148
- );
18168
+ )?.reverse();
18149
18169
  const dimensionList = data.DimensionList;
18150
18170
  const barChart = false;
18151
18171
  const isSecondaryAxisDrawn = false;
@@ -18466,7 +18486,7 @@
18466
18486
  let columnGroups = columns.selectAll(".column-group").data((d) => d);
18467
18487
  let columnGroupsEnter = columnGroups.enter().append("g").attr("class", (d) => "column-group " + d.key.replace(/ /g, "-")).attr(
18468
18488
  "hoverId",
18469
- (d) => d.key.includes("~$~") ? d.key.split("~$~")[1].replace(/ /g, "-") : d.key.replace(/ /g, "-")
18489
+ (d) => d[0]?.properties.alias ? getHoverId(d[0]?.properties.alias) : getHoverId(d.key)
18470
18490
  );
18471
18491
  columnGroups = columnGroupsEnter.merge(columnGroups);
18472
18492
  let rects = columnGroups.selectAll("rect").data((d) => d);
@@ -18518,14 +18538,14 @@
18518
18538
  );
18519
18539
  const dim = Array.isArray(d.data.dimension) && d.data.dimension.length ? d.data.dimension[0] : d.data.dimension;
18520
18540
  gTag.select(`#dim-background-${dim}`).attr("visibility", "visible");
18521
- let legend = d.key.includes("~$~") ? d.key.split("~$~")[1].replace(/ /g, "-") : d.key.replace(/ /g, "-");
18541
+ let legend = d?.properties.alias ? getHoverId(d?.properties.alias) : getHoverId(d.key);
18522
18542
  selectAll(".parentGroup").classed("highlight", false).classed("unhighlight", true);
18523
18543
  selectAll('[hoverId="' + legend + '"]').classed("highlight", true).classed("unhighlight", false);
18524
18544
  }).on("mouseout", (event2, d) => {
18525
18545
  hideTooltipOnMouseOut();
18526
18546
  const dim = Array.isArray(d.data.dimension) && d.data.dimension.length ? d.data.dimension[0] : d.data.dimension;
18527
18547
  gTag.select(`#dim-background-${dim}`).attr("visibility", "hidden");
18528
- let legend = d.key.includes("~$~") ? d.key.split("~$~")[1].replace(/ /g, "-") : d.key.replace(/ /g, "-");
18548
+ let legend = d?.properties.alias ? getHoverId(d?.properties.alias) : getHoverId(d.key);
18529
18549
  selectAll(".parentGroup").classed("highlight", false).classed("unhighlight", false);
18530
18550
  selectAll('[hoverId="' + legend + '"]').classed("highlight", false).classed("unhighlight", false);
18531
18551
  });
@@ -18865,7 +18885,7 @@
18865
18885
  const seriesData = generalizedChartData(
18866
18886
  data.ChartData,
18867
18887
  data.DimensionList
18868
- );
18888
+ ).reverse();
18869
18889
  const dimensionList = data.DimensionList;
18870
18890
  const barChart = false;
18871
18891
  const isSecondaryAxisDrawn = false;
@@ -19888,7 +19908,7 @@
19888
19908
  function logError$1(fileName2, functionName, error) {
19889
19909
  console.error(`[${fileName2}] [${functionName}]`, error);
19890
19910
  }
19891
- const ColumnHistogramChart = ({
19911
+ const ColumnHistogramChart$1 = ({
19892
19912
  isDateType,
19893
19913
  formatOptions,
19894
19914
  data
@@ -19897,7 +19917,7 @@
19897
19917
  const columnWidth = 0;
19898
19918
  const chartType = actualChartTypes.columnHistogram;
19899
19919
  const svgRef = require$$0$1.useRef();
19900
- const seriesData = generalizedChartData(data.ChartData, data.DimensionList);
19920
+ const seriesData = data.ChartData;
19901
19921
  const dimensionList = data.DimensionList;
19902
19922
  const barChart = false;
19903
19923
  const isSecondaryAxisDrawn = false;
@@ -20191,7 +20211,8 @@
20191
20211
  };
20192
20212
  const initScale = () => {
20193
20213
  xScale = linear$1().domain([chartJSON.xMin, chartJSON.xMax]).range([0, innerWidth2]);
20194
- let histogram = bin().value((d) => d).domain(xScale.domain()).thresholds(periods && periods.length || xScale.ticks(thresholds));
20214
+ const numberOfBins = periods.length > 0 ? periods : xScale.ticks(thresholds);
20215
+ let histogram = bin().value((d) => d).domain(xScale.domain()).thresholds(numberOfBins);
20195
20216
  filteredData.forEach((d) => {
20196
20217
  let tempArray = histogram(d.data.map((val) => val.value));
20197
20218
  bins.push(tempArray);
@@ -20249,7 +20270,7 @@
20249
20270
  )
20250
20271
  ).tickSize(
20251
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
20252
- ).tickValues(labelArray).ticks(innerWidth2 / 30).tickPadding(8).tickSizeOuter(0);
20273
+ ).tickSizeOuter(0);
20253
20274
  formatOptions.bins.binsCalculation === "Automatic" ? xAxis.ticks(thresholds) : xAxis.tickValues(periods).ticks(innerWidth2 / 50);
20254
20275
  };
20255
20276
  const getChartType = (lineData) => {
@@ -20281,6 +20302,7 @@
20281
20302
  event2
20282
20303
  );
20283
20304
  }).on("mouseout", hideTooltipOnMouseOut);
20305
+ gTag.selectAll(".parentGroup").raise();
20284
20306
  };
20285
20307
  const setSVGContainer = (margin2) => {
20286
20308
  innerWidth2 = width - margin2.left - margin2.right;
@@ -20300,7 +20322,6 @@
20300
20322
  (d) => filteredDimension.includes(d.dimension)
20301
20323
  )
20302
20324
  );
20303
- getXAxis();
20304
20325
  svg2.append("rect").attr("x", margin2.left).attr("y", scrollbarY).attr("width", innerWidth22).attr("height", 8).attr("fill", "#ddd").attr("rx", 4);
20305
20326
  const handleWidth = innerWidth22 * visibleBars / chartJSON.dimensionList.length;
20306
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(
@@ -20347,7 +20368,6 @@
20347
20368
  drawColumnChart();
20348
20369
  };
20349
20370
  const drawColumnChart = () => {
20350
- getChartType();
20351
20371
  initXaxis$1(
20352
20372
  gTag,
20353
20373
  chartJSON,
@@ -20364,6 +20384,7 @@
20364
20384
  innerHeight2,
20365
20385
  filteredDimension
20366
20386
  );
20387
+ getChartType();
20367
20388
  };
20368
20389
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20369
20390
  "svg",
@@ -20935,7 +20956,7 @@
20935
20956
  const seriesData = generalizedChartData(
20936
20957
  data.ChartData,
20937
20958
  data.DimensionList
20938
- );
20959
+ )?.reverse() || [];
20939
20960
  const dimensionList = data.DimensionList;
20940
20961
  const barChart = false;
20941
20962
  const isSecondaryAxisDrawn = false;
@@ -21475,7 +21496,7 @@
21475
21496
  const seriesData = generalizedChartData(
21476
21497
  data.ChartData,
21477
21498
  data.DimensionList
21478
- );
21499
+ )?.reverse() || [];
21479
21500
  const dimensionList = data.DimensionList;
21480
21501
  const barChart = false;
21481
21502
  const isSecondaryAxisDrawn = false;
@@ -21777,7 +21798,7 @@
21777
21798
  const lineGenerator = line$1().x(
21778
21799
  (d) => xScale(d.data.dimension) ? xScale(d.data.dimension) : null
21779
21800
  ).y((d) => d[1] > 0 ? yScaleLeft(d[1]) : yScaleLeft(d[0])).curve(getCurveType(formatOptions));
21780
- let lines = gTag.selectAll(".parentGroup").data([stackChartData.reverse()]);
21801
+ let lines = gTag.selectAll(".parentGroup").data([stackChartData]);
21781
21802
  lines = lines.enter().append("g").attr("class", "lines parentGroup").merge(lines);
21782
21803
  let lineGroups = lines.selectAll(".line-group").data((d) => d);
21783
21804
  let lineGroupsEnter = lineGroups.enter().append("g").attr("class", (d) => "line-group " + d.key.replace(/ /g, "-"));
@@ -22475,7 +22496,7 @@
22475
22496
  const seriesData = generalizedChartData(
22476
22497
  data.ChartData,
22477
22498
  data.DimensionList
22478
- );
22499
+ )?.reverse();
22479
22500
  const dimensionList = data.DimensionList;
22480
22501
  const barChart = true;
22481
22502
  const isSecondaryAxisDrawn = false;
@@ -23165,7 +23186,7 @@
23165
23186
  let columnWidth = 0;
23166
23187
  const chartType = actualChartTypes.stackBar100;
23167
23188
  const svgRef = require$$0$1.useRef();
23168
- const seriesData = generalizedChartData(data.ChartData, data.DimensionList);
23189
+ const seriesData = generalizedChartData(data.ChartData, data.DimensionList)?.reverse();
23169
23190
  const dimensionList = data.DimensionList;
23170
23191
  const barChart = true;
23171
23192
  const isSecondaryAxisDrawn = false;
@@ -23319,6 +23340,7 @@
23319
23340
  margin,
23320
23341
  yTitle,
23321
23342
  yLabel,
23343
+ void 0,
23322
23344
  xTitle,
23323
23345
  xLabel
23324
23346
  );
@@ -23458,7 +23480,7 @@
23458
23480
  filteredDimension.forEach((dim) => {
23459
23481
  gTag.append("rect").attr("id", `dim-background-${dim}`).attr("class", "dimension-background").attr("y", yScale(dim) - yScale.bandwidth() / 2).attr("height", yScale.bandwidth()).attr("x", 0).attr("width", innerWidth2).attr("fill", "#E5E5E5").attr("visibility", "hidden").lower();
23460
23482
  });
23461
- let columns = gTag.selectAll(".parentGroup").data([stackChartData.reverse()]);
23483
+ let columns = gTag.selectAll(".parentGroup").data([stackChartData]);
23462
23484
  columns = columns.enter().append("g").attr("class", "columns parentGroup").merge(columns);
23463
23485
  let columnGroups = columns.selectAll(".column-group").data((d) => d);
23464
23486
  let columnGroupsEnter = columnGroups.enter().append("g").attr("class", (d) => "column-group " + d.key.replace(/ /g, "-")).attr(
@@ -24298,26 +24320,28 @@
24298
24320
  }
24299
24321
  ) });
24300
24322
  };
24301
- const HorizontalHistogramChart = ({
24323
+ const ColumnHistogramChart = ({
24302
24324
  isDateType,
24303
24325
  formatOptions,
24304
24326
  data
24305
24327
  }) => {
24306
24328
  const chartId = crypto.randomUUID();
24307
- let columnWidth = 0;
24308
- const chartType = actualChartTypes.horizontalBar;
24329
+ const columnWidth = 0;
24330
+ const chartType = actualChartTypes.columnHistogram;
24309
24331
  const svgRef = require$$0$1.useRef();
24310
- const seriesData = generalizedChartData(data.ChartData, data.DimensionList);
24332
+ const seriesData = data.ChartData;
24311
24333
  const dimensionList = data.DimensionList;
24312
- const barChart = true;
24313
- let isSecondaryAxisDrawn = false;
24334
+ const barChart = false;
24335
+ const isSecondaryAxisDrawn = false;
24314
24336
  const isNormalizedChart = false;
24315
24337
  let customYaxisMinValue = parseFloat(formatOptions.yAxisLabel.yAxisMinText);
24316
24338
  let customYaxisMaxValue = parseFloat(formatOptions.yAxisLabel.yAxisMaxText);
24317
- let secondaryCustomYaxisMinValue = parseFloat(
24339
+ let customXaxisMinValue = parseFloat(formatOptions.xAxisLabel.xAxisMinText);
24340
+ let customXaxisMaxValue = parseFloat(formatOptions.xAxisLabel.xAxisMaxText);
24341
+ parseFloat(
24318
24342
  formatOptions.secondaryYAxisLabel.secondaryYAxisMinText
24319
24343
  );
24320
- let secondaryCustomYaxisMaxValue = parseFloat(
24344
+ parseFloat(
24321
24345
  formatOptions.secondaryYAxisLabel.secondaryYAxisMaxText
24322
24346
  );
24323
24347
  let margin;
@@ -24334,21 +24358,21 @@
24334
24358
  let maxNumberForSecondaryAxis;
24335
24359
  let innerWidth2;
24336
24360
  let innerHeight2;
24361
+ let thresholds;
24362
+ let periods = [];
24363
+ let bins = [];
24337
24364
  let width;
24338
24365
  let height;
24339
24366
  let dataTable;
24340
24367
  let dataTableHeight;
24341
24368
  let svg;
24342
24369
  let gTag;
24343
- let yScale;
24344
- let yScaleLegends;
24345
- let xScaleBottom;
24346
- let xScaleTop;
24370
+ let yScaleLeft;
24371
+ let xScale;
24372
+ let xScaleForLegends;
24347
24373
  let calculatedRange;
24348
- let seriesLabelWidth;
24349
- let xAxisBottom;
24350
- let xAxisTop;
24351
- let yAxis;
24374
+ let yAxisLeft;
24375
+ let xAxis;
24352
24376
  let filteredDimension;
24353
24377
  let filteredData = [];
24354
24378
  let scrollPosition = 0;
@@ -24369,12 +24393,12 @@
24369
24393
  };
24370
24394
  require$$0$1.useEffect(() => {
24371
24395
  try {
24372
- createHorizontalBarChart();
24396
+ createColumnChart();
24373
24397
  } catch (error) {
24374
- logError$2("HorizontalBarchart", "createHorizontalBarChart", error);
24398
+ logError$2("Columnchart", "createColumnChart", error);
24375
24399
  }
24376
24400
  }, [formatOptions]);
24377
- const createHorizontalBarChart = () => {
24401
+ const createColumnChart = () => {
24378
24402
  ({ formatOptions, svg, width, height } = firstFunctionBeforeRender$1(
24379
24403
  svgRef,
24380
24404
  formatOptions
@@ -24412,8 +24436,7 @@
24412
24436
  chartJSON.yMaxRight,
24413
24437
  isSecondaryAxisDrawn,
24414
24438
  isNormalizedChart,
24415
- isDateType,
24416
- barChart
24439
+ isDateType
24417
24440
  ));
24418
24441
  setSVGContainer(margin);
24419
24442
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
@@ -24440,33 +24463,17 @@
24440
24463
  innerHeight2,
24441
24464
  chartType
24442
24465
  );
24466
+ binsCalculation();
24443
24467
  initScale();
24444
24468
  initAxis();
24445
- initYaxisBar(
24446
- formatOptions,
24469
+ initYaxis$1(
24447
24470
  gTag,
24448
- xLabel,
24449
- innerHeight2,
24450
- innerWidth2,
24451
- yAxis,
24452
- xAxisTop,
24453
- xScaleBottom,
24454
- chartJSON.yMaxLeft,
24455
- filteredDimension,
24456
- chartType,
24457
- isDateType,
24458
- width,
24459
- dimensionHeightWidthArray,
24460
- columnWidth
24471
+ formatOptions,
24472
+ dataTableHeight,
24473
+ yLabel,
24474
+ yAxisLeft,
24475
+ innerHeight2
24461
24476
  );
24462
- if (isSecondaryAxisDrawn) {
24463
- initXaxisTop(
24464
- formatOptions,
24465
- gTag,
24466
- secondaryYLabel,
24467
- xAxisTop
24468
- );
24469
- }
24470
24477
  horizontalScrollBar2(seriesData, height, svg, margin, innerWidth2);
24471
24478
  if (formatOptions.dataTableProperties && formatOptions.dataTableProperties.dataTable) {
24472
24479
  if (formatOptions.xAxisLabel.xAxisPosition != "1")
@@ -24477,9 +24484,9 @@
24477
24484
  gTag,
24478
24485
  dataTable,
24479
24486
  columnWidth,
24480
- xAxisBottom,
24481
- yScale,
24482
- yScaleLegends,
24487
+ yScaleLeft,
24488
+ xScale,
24489
+ xScaleForLegends,
24483
24490
  void 0,
24484
24491
  void 0,
24485
24492
  dataTableHeight,
@@ -24547,117 +24554,109 @@
24547
24554
  const preProcessChartData = () => {
24548
24555
  const allChartData = [];
24549
24556
  const legendList = [];
24550
- let formatedDimensionList = [];
24557
+ let cumulativeDataPoints = [];
24551
24558
  let yMaxLeft = -Infinity;
24552
24559
  let yMinLeft = Infinity;
24553
- let yMaxRight = -Infinity;
24554
- let yMinRight = Infinity;
24555
24560
  seriesData.forEach((series) => {
24556
24561
  legendList.push(series.legend);
24557
24562
  series.data.forEach((point2) => {
24558
24563
  allChartData.push(point2);
24559
- if (series.properties.axis === "Secondary") {
24560
- isSecondaryAxisDrawn = true;
24561
- yMaxRight = Math.max(yMaxRight, point2.value);
24562
- yMinRight = Math.min(yMinRight, point2.value);
24563
- } else {
24564
- yMaxLeft = Math.max(yMaxLeft, point2.value);
24565
- yMinLeft = Math.min(yMinLeft, point2.value);
24566
- }
24564
+ yMaxLeft = Math.max(yMaxLeft, point2.value);
24565
+ yMinLeft = Math.min(yMinLeft, point2.value);
24567
24566
  });
24568
24567
  });
24569
24568
  chartJSON.chartData = allChartData;
24570
24569
  chartJSON.legendList = legendList;
24571
24570
  chartJSON.yMaxLeft = yMaxLeft;
24572
24571
  chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
24573
- chartJSON.yMaxRight = yMaxRight;
24574
- chartJSON.yMinRight = yMinRight;
24575
- formatedDimensionList = isDateType ? setDateFormats(
24576
- formatOptions.xAxisLabel.xAxisNumberFormat,
24577
- chartJSON.dimensionList
24578
- ).map((d) => d) : chartJSON.dimensionList;
24579
- chartJSON.dimensionList.forEach((dim, i) => {
24580
- chartJSON.formattedDimensionListMap.set(dim, formatedDimensionList[i]);
24581
- });
24582
24572
  filteredData = JSON.parse(JSON.stringify(seriesData));
24583
- if (!formatOptions.plotArea.fitChart) {
24584
- filteredDimension = chartJSON.dimensionList.slice(
24585
- scrollPosition,
24586
- scrollPosition + visibleBars
24587
- );
24588
- } else {
24589
- filteredDimension = chartJSON.dimensionList;
24590
- }
24591
- if (formatOptions.plotArea.hideZeroValues) {
24592
- chartJSON.hideZeroValues = true;
24593
- }
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);
24594
24581
  };
24595
- const initScale = () => {
24596
- let yAxisLabelArray = responsiveYaxisLabel$1(
24597
- customYaxisMaxValue ? customYaxisMaxValue : chartJSON.yMaxLeft,
24598
- chartJSON.yMinLeft,
24599
- innerHeight2,
24600
- formatOptions,
24601
- chartJSON,
24602
- customYaxisMinValue,
24603
- customYaxisMaxValue
24604
- ).yAxisLabelArray;
24605
- chartJSON.yMaxLeft = yAxisLabelArray[yAxisLabelArray.length - 1];
24606
- chartJSON.yMinLeft = yAxisLabelArray[0];
24607
- {
24608
- xScaleBottom = linear$1().domain([
24609
- chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : 0 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
24610
- chartJSON.yMaxLeft <= 0 ? 0 : customYaxisMaxValue !== void 0 && !Number.isNaN(customYaxisMaxValue) ? customYaxisMaxValue : chartJSON.yMaxLeft * 1.1
24611
- ]).range([
24612
- 0,
24613
- dataTableHeight > 0 ? innerWidth2 - dataTableHeight : innerWidth2
24614
- ]);
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);
24615
24592
  }
24616
- if (isSecondaryAxisDrawn) {
24617
- xScaleTop = linear$1().domain([
24618
- chartJSON.yMinRight >= 0 ? (secondaryCustomYaxisMinValue || secondaryCustomYaxisMinValue == 0) && !Number.isNaN(secondaryCustomYaxisMinValue) ? secondaryCustomYaxisMinValue : 0 : (secondaryCustomYaxisMinValue || secondaryCustomYaxisMinValue == 0) && !Number.isNaN(secondaryCustomYaxisMinValue) ? secondaryCustomYaxisMinValue : chartJSON.yMinRight * 1.1,
24619
- chartJSON.yMaxRight <= 0 ? secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : 0 : secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight * 1.1
24620
- ]).range([
24621
- 0,
24622
- dataTableHeight > 0 ? innerWidth2 - dataTableHeight : innerWidth2
24623
- ]);
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);
24624
24608
  }
24625
- calculatedRange = [innerHeight2, 0];
24626
- if (formatOptions.seriesLabel.seriesLabelVisibility) {
24627
- let labelObj = prepareDataForSeriesLabel(
24628
- innerWidth2,
24629
- xScaleBottom,
24630
- formatOptions,
24631
- filteredData,
24632
- xScaleTop,
24633
- isSecondaryAxisDrawn
24634
- );
24635
- labelObj.labelArray;
24636
- formatOptions.seriesLabel.seriesLabelPosition == "Right" && (seriesLabelWidth = labelObj.heightWidth[0]);
24637
- formatOptions.seriesLabel.seriesLabelPosition == "Right" ? calculatedRange = [0, innerHeight2 - labelObj.heightWidth[0]] : calculatedRange = [labelObj.heightWidth[0], innerHeight2];
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
+ }
24638
24622
  }
24639
- getYScale();
24640
24623
  };
24641
- const getYScale = () => {
24642
- columnWidth = (0.51 + 0.61 * (100 - parseFloat(formatOptions.plotArea.plotAreaGapWidth)) / 100) * (innerHeight2 / filteredDimension.length);
24643
- yScaleLegends = band().domain(chartJSON.legendList).range([0, columnWidth]).paddingInner(
24644
- chartJSON.legendList.length > 1 ? 0.3 * parseFloat(formatOptions.plotArea.plotAreaSeriesWidth) / 100 : 0
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
+ })
24645
24638
  );
24646
- yScale = point$7().domain(filteredDimension).range(calculatedRange).padding(0.5);
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]);
24647
24644
  };
24648
24645
  const initAxis = () => {
24649
- getYAxis();
24646
+ getXAxis();
24650
24647
  {
24651
24648
  let responsiveLablesObj = responsiveYaxisLabel$1(
24652
- customYaxisMaxValue ? customYaxisMaxValue : chartJSON.yMaxLeft,
24649
+ chartJSON.yMaxLeft,
24653
24650
  chartJSON.yMinLeft,
24654
24651
  innerHeight2,
24655
24652
  formatOptions,
24656
24653
  chartJSON,
24657
24654
  customYaxisMinValue,
24658
- customYaxisMaxValue
24655
+ customYaxisMaxValue,
24656
+ false,
24657
+ innerWidth2
24659
24658
  );
24660
- xAxisBottom = axisBottom(xScaleBottom).tickFormat(
24659
+ yAxisLeft = axisLeft(yScaleLeft).tickFormat(
24661
24660
  (d) => getNumberWithFormat(
24662
24661
  d,
24663
24662
  formatOptions.yAxisLabel.yAxisDisplayUnits,
@@ -24665,116 +24664,57 @@
24665
24664
  formatOptions.yAxisLabel.yAxisLabelDecimalPrecision
24666
24665
  )
24667
24666
  ).tickSize(
24668
- formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerHeight2 + (seriesLabelWidth ? seriesLabelWidth : 0) : 0 : 0
24667
+ formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 + 0 : 0 : 0
24669
24668
  ).tickValues(responsiveLablesObj.autoLabelFlag ? void 0 : responsiveLablesObj.yAxisLabelArray).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
24670
24669
  }
24671
- if (isSecondaryAxisDrawn) {
24672
- xAxisTop = axisTop(xScaleTop).tickFormat(
24673
- (d) => getNumberWithFormat(
24674
- d,
24675
- formatOptions.secondaryYAxisLabel.secondaryYAxisDisplayUnits,
24676
- formatOptions.secondaryYAxisLabel.secondaryYAxisNumberFormat,
24677
- formatOptions.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision
24678
- )
24679
- ).tickValues(
24680
- responsiveSecondaryYaxisLabel(
24681
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
24682
- chartJSON.yMinRight,
24683
- formatOptions,
24684
- chartJSON
24685
- ).secondaryYAxisLabelArray
24686
- ).ticks(
24687
- responsiveSecondaryYaxisLabel(
24688
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
24689
- chartJSON.yMinRight,
24690
- formatOptions,
24691
- chartJSON
24692
- ).secondaryCustomTickValue ?? innerHeight2 / 30
24693
- ).tickSize(
24694
- formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 : 0 : 0
24695
- ).tickPadding(8).tickSizeOuter(0);
24696
- }
24697
24670
  };
24698
- const getYAxis = () => {
24699
- yAxis = axisLeft(yScale).tickSize(
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(
24700
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
24701
- ).tickSizeOuter(0).tickValues(responsiveXaxisLabel(filteredDimension, innerHeight2));
24685
+ ).tickSizeOuter(0);
24686
+ formatOptions.bins.binsCalculation === "Automatic" ? xAxis.ticks(thresholds) : xAxis.tickValues(periods).ticks(innerWidth2 / 50);
24702
24687
  };
24703
24688
  const getChartType = (lineData) => {
24704
- lineData.forEach((lData) => {
24705
- lData.data.forEach((cData) => {
24706
- cData.hideZero = lData.properties.hideZeroValues;
24707
- cData.axis = lData.properties.axis;
24708
- });
24709
- });
24710
- lineData.forEach((data2) => {
24711
- let column = gTag.selectAll(".parentGroup").data([data2], (d) => d.legend);
24712
- column = column.enter().append("g").attr("class", `column parentGroup`).merge(column);
24713
- let columnGroups = column.selectAll(".column-group").data(data2.data, (d) => d.legend + d.dimension);
24714
- let columnGroupsEnter = columnGroups.enter().append("g").attr("class", "column-group").attr(
24715
- "hoverId",
24716
- (d) => d.legend.includes("-") ? d.legend.replace("-", "`").split("`")[1].replace(/ /g, "-") : d.legend.replace(/ /g, "-")
24717
- ).attr(
24718
- "transform",
24719
- (d) => `translate(0, ${yScale(d.dimension) - columnWidth / 2})`
24720
- );
24721
- columnGroups.attr(
24722
- "transform",
24723
- (d) => `translate(0, ${yScale(d.dimension) - columnWidth / 2})`
24724
- );
24725
- columnGroupsEnter.merge(columnGroups).attr(
24726
- "transform",
24727
- (d) => `translate(0, ${yScale(d.dimension) - columnWidth / 2})`
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
24728
24715
  );
24729
- columnGroupsEnter.append("rect").attr("y", (d) => yScaleLegends(d.legend)).attr("height", yScaleLegends.bandwidth()).attr("x", (d) => {
24730
- const requiredXScale = data2.properties.axis === "Primary" ? xScaleBottom : xScaleTop;
24731
- return d.value > 0 ? requiredXScale(0) : requiredXScale(d.value);
24732
- }).attr("width", (d) => {
24733
- const requiredXScale = data2.properties.axis === "Primary" ? xScaleBottom : xScaleTop;
24734
- const requiredCustomValue = data2.properties.axis === "Primary" ? customYaxisMaxValue : secondaryCustomYaxisMaxValue;
24735
- return d.value > 0 ? requiredCustomValue && d.value > requiredCustomValue ? requiredXScale(requiredCustomValue) - requiredXScale(0) : requiredXScale(d.value) - requiredXScale(0) : Math.abs(requiredXScale(0) - requiredXScale(d.value));
24736
- }).attr("fill", data2.properties.color).attr(
24737
- "stroke-dasharray",
24738
- (d) => d.stackBorderStyle === 2 ? "5,3" : "0"
24739
- ).attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
24740
- "stroke",
24741
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
24742
- ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
24743
- "visibility",
24744
- (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
24745
- ).on("mousemove", (event2, d) => {
24746
- showTooltipOnMouseMove(
24747
- [
24748
- {
24749
- key: formatOptions.xAxisTitle.xAxisTitleText.includes("~$~") ? formatOptions.xAxisTitle.xAxisTitleText.split("~$~")[1] : formatOptions.xAxisTitle.xAxisTitleText,
24750
- value: chartJSON.formattedDimensionListMap.get(
24751
- Array.isArray(d.dimension) ? d.dimension[0] : d.dimension
24752
- )
24753
- },
24754
- {
24755
- key: formatOptions.yAxisTitle.yAxisTitleText || d.value,
24756
- value: getNumberWithFormat(
24757
- [
24758
- actualChartTypes.stackLine100,
24759
- actualChartTypes.stackArea100,
24760
- ""
24761
- ].includes(chartType) ? d[1] - d[0] : d.value,
24762
- formatOptions.toolTip.toolTipDisplayUnits,
24763
- formatOptions.toolTip.toolTipNumberFormat,
24764
- formatOptions.toolTip.toolTipDecimalPrecision
24765
- )
24766
- },
24767
- {
24768
- key: "Legend",
24769
- value: d.legend.includes("~$~") ? d.legend.split("~$~")[1] : d.legend
24770
- }
24771
- ],
24772
- formatOptions,
24773
- event2
24774
- );
24775
- }).on("mouseout", hideTooltipOnMouseOut);
24776
- columnGroups.exit().remove();
24777
- });
24716
+ }).on("mouseout", hideTooltipOnMouseOut);
24717
+ gTag.selectAll(".parentGroup").raise();
24778
24718
  };
24779
24719
  const setSVGContainer = (margin2) => {
24780
24720
  innerWidth2 = width - margin2.left - margin2.right;
@@ -24788,14 +24728,12 @@
24788
24728
  scrollPosition,
24789
24729
  scrollPosition + visibleBars
24790
24730
  );
24791
- getYScale();
24792
24731
  filteredData = JSON.parse(JSON.stringify(seriesData2));
24793
24732
  filteredData.forEach(
24794
24733
  (data2, i) => filteredData[i].data = data2.data.filter(
24795
24734
  (d) => filteredDimension.includes(d.dimension)
24796
24735
  )
24797
24736
  );
24798
- getYAxis();
24799
24737
  svg2.append("rect").attr("x", margin2.left).attr("y", scrollbarY).attr("width", innerWidth22).attr("height", 8).attr("fill", "#ddd").attr("rx", 4);
24800
24738
  const handleWidth = innerWidth22 * visibleBars / chartJSON.dimensionList.length;
24801
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(
@@ -24812,14 +24750,13 @@
24812
24750
  scrollPosition,
24813
24751
  scrollPosition + visibleBars
24814
24752
  );
24815
- getYScale();
24816
24753
  filteredData = JSON.parse(JSON.stringify(seriesData2));
24817
24754
  filteredData.forEach(
24818
24755
  (data2, i) => filteredData[i].data = data2.data.filter(
24819
24756
  (d) => filteredDimension.includes(d.dimension)
24820
24757
  )
24821
24758
  );
24822
- getYAxis();
24759
+ getXAxis();
24823
24760
  drawColumnChart();
24824
24761
  })
24825
24762
  );
@@ -24830,57 +24767,36 @@
24830
24767
  scrollPosition = Math.max(0, Math.min(scrollPosition, scrollMax));
24831
24768
  const x2 = margin2.left + (innerWidth22 - handleWidth) * scrollPosition / scrollMax;
24832
24769
  handle.attr("x", x2);
24833
- getYScale();
24834
24770
  filteredData = JSON.parse(JSON.stringify(seriesData2));
24835
24771
  filteredData.forEach(
24836
24772
  (data2, i) => filteredData[i].data = data2.data.filter(
24837
24773
  (d) => filteredDimension.includes(d.dimension)
24838
24774
  )
24839
24775
  );
24840
- getYAxis();
24776
+ getXAxis();
24841
24777
  drawColumnChart();
24842
24778
  });
24843
24779
  }
24844
24780
  drawColumnChart();
24845
24781
  };
24846
24782
  const drawColumnChart = () => {
24847
- getChartType(filteredData);
24848
- initXaxisBar(
24849
- formatOptions,
24783
+ initXaxis$1(
24850
24784
  gTag,
24851
- yLabel,
24852
- innerHeight2,
24853
- innerWidth2,
24854
- xAxisBottom
24855
- );
24856
- commonAnnotations(
24857
- filteredData,
24858
- yScale,
24859
- xScaleBottom,
24860
- xScaleTop,
24861
- // need to pass secondary axis scale if secondary axis is drawn
24862
- margin,
24863
- d3Annotation,
24864
- [],
24865
- //this.labelExcludeList,
24866
- [],
24867
- //this.individualLabelColor,
24868
- [],
24869
- //this.attributes.Id ? formatOptions.plotArea.dataLabelsCoordinates : this.parentReference.objService.tempAnnotationArray
24785
+ chartJSON,
24786
+ xLabel,
24870
24787
  formatOptions,
24871
- chartType,
24788
+ dataTableHeight,
24789
+ yScaleLeft,
24790
+ xAxis,
24791
+ dimensionHeightWidthArray,
24872
24792
  height,
24873
- width,
24793
+ columnWidth,
24794
+ isDateType,
24874
24795
  innerWidth2,
24875
- filteredDimension,
24876
24796
  innerHeight2,
24877
- chartId,
24878
- svg,
24879
- yScaleLegends,
24880
- columnWidth,
24881
- false,
24882
- barChart
24797
+ filteredDimension
24883
24798
  );
24799
+ getChartType();
24884
24800
  };
24885
24801
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
24886
24802
  "svg",
@@ -25427,7 +25343,7 @@
25427
25343
  const seriesData = generalizedChartData(
25428
25344
  data.ChartData,
25429
25345
  data.DimensionList
25430
- );
25346
+ )?.reverse() || [];
25431
25347
  const dimensionList = data.DimensionList;
25432
25348
  const barChart = false;
25433
25349
  const isSecondaryAxisDrawn = false;
@@ -25780,7 +25696,7 @@
25780
25696
  ).y0(() => yScaleLeft(0)).y1(() => yScaleLeft(0)).defined(
25781
25697
  (d) => d.data.hideZero ? Boolean(d.data.key) : true
25782
25698
  ).curve(getCurveType(formatOptions));
25783
- let areas = gTag.selectAll(".lineGroup").data([stackChartData.reverse()]);
25699
+ let areas = gTag.selectAll(".lineGroup").data([stackChartData]);
25784
25700
  let focus = gTag.append("g").attr("class", "focusClass");
25785
25701
  areas = areas.enter().append("g").attr("class", "areas lineGroup").merge(areas);
25786
25702
  let areaGroups = areas.selectAll(".area-group").data((d) => d);
@@ -25995,7 +25911,7 @@
25995
25911
  const seriesData = generalizedChartData(
25996
25912
  data.ChartData,
25997
25913
  data.DimensionList
25998
- );
25914
+ )?.reverse() || [];
25999
25915
  const dimensionList = data.DimensionList;
26000
25916
  const barChart = false;
26001
25917
  const isSecondaryAxisDrawn = false;
@@ -26309,13 +26225,13 @@
26309
26225
  });
26310
26226
  const columnGenerator = area().x(
26311
26227
  (d) => xScale(d.data.dimension) ? xScale(d.data.dimension) : null
26312
- ).y0(() => yScaleLeft(0)).y1((d) => yScaleLeft(d[1])).defined((d) => d.data.hideZero ? Boolean(d[0]) : true).curve(curveLinear$1);
26228
+ ).y0((d) => yScaleLeft(d[0])).y1((d) => yScaleLeft(d[1])).defined((d) => d.data.hideZero ? Boolean(d[0]) : true).curve(curveLinear$1);
26313
26229
  const columnGeneratorStart = area().x(
26314
26230
  (d) => xScale(d.data.dimension) ? xScale(d.data.dimension) : null
26315
- ).y0(() => yScaleLeft(0)).y1(() => yScaleLeft(0)).defined(
26231
+ ).y0((d) => yScaleLeft(d[0])).y1((d) => yScaleLeft(d[1])).defined(
26316
26232
  (d) => d.data.hideZero ? Boolean(d.data.key) : true
26317
26233
  ).curve(getCurveType(formatOptions));
26318
- let areas = gTag.selectAll(".lineGroup").data([stackChartData.reverse()]);
26234
+ let areas = gTag.selectAll(".lineGroup").data([stackChartData]);
26319
26235
  let focus = gTag.append("g").attr("class", "focusClass");
26320
26236
  areas = areas.enter().append("g").attr("class", "areas lineGroup").merge(areas);
26321
26237
  let areaGroups = areas.selectAll(".area-group").data((d) => d);
@@ -26703,7 +26619,7 @@
26703
26619
  };
26704
26620
  const defineChartRadius = () => {
26705
26621
  try {
26706
- radius = Math.min(innerHeight2 * 0.4, innerWidth2 * 0.4);
26622
+ radius = Math.min(innerHeight2 * 0.5, innerWidth2 * 0.5);
26707
26623
  outsideDataLabelFlag ? radius = radius * 0.9 : null;
26708
26624
  } catch (error) {
26709
26625
  logError$2(fileName$8, "defineChartRadius", error);
@@ -26777,16 +26693,20 @@
26777
26693
  return "";
26778
26694
  }
26779
26695
  };
26780
- const getDataLabelTransformString = (d) => {
26696
+ const getDataLabelTransformString = (d, isSingleDataLabel) => {
26781
26697
  try {
26782
- const midAngle = (d.startAngle + d.endAngle) / 2;
26783
- const x2 = Math.cos(midAngle - Math.PI / 2) * (radius * 0.65);
26784
- const y2 = Math.sin(midAngle - Math.PI / 2) * (radius * 0.65);
26785
- let rotate = midAngle * 180 / Math.PI % 360;
26786
- let angle = 0;
26787
- rotate > 180 && rotate < 360 ? angle = 90 : angle = -90;
26788
- rotate += angle;
26789
- return `translate(${x2},${y2}) rotate(${rotate})`;
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
+ }
26790
26710
  } catch (error) {
26791
26711
  logError$2(fileName$8, "getDataLabelTransformString", error);
26792
26712
  return "";
@@ -26795,6 +26715,7 @@
26795
26715
  const drawPieDataLabels = () => {
26796
26716
  try {
26797
26717
  if (chartFormatOptions.plotArea.dataLabels) {
26718
+ const isSingleDataLabel = pieChartData && pieChartData.length === 1;
26798
26719
  chartAreaTagG.append("g").attr("class", "parentGroup").attr("transform", `${getPiePosition()}`).attr("pointer-events", "none").attr("text-anchor", "middle").selectAll("text").data(
26799
26720
  pieChartData.filter(
26800
26721
  (d) => d.data.properties.dataLabelPosition == "1"
@@ -26813,7 +26734,7 @@
26813
26734
  ).attr(
26814
26735
  "font-family",
26815
26736
  (d) => d.data.properties?.labelFont ?? "Helvetica"
26816
- ).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) => {
26817
26738
  const { plotArea } = chartFormatOptions;
26818
26739
  if (plotArea.dataLabelName) {
26819
26740
  return d.data.legend;
@@ -26838,10 +26759,10 @@
26838
26759
  ).attr(
26839
26760
  "font-family",
26840
26761
  (d) => d.data.properties?.valueFont ?? "Helvetica"
26841
- ).attr("transform", (d) => getDataLabelTransformString(d)).attr("text-anchor", "middle").attr("alignment-baseline", "middle").attr("dy", "1.00em").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) => {
26842
26763
  if (chartFormatOptions.plotArea.dataLabelValue) {
26843
26764
  const dataValue = d.data.data[0].value;
26844
- if (chartFormatOptions.plotArea.dataLabelName && chartFormatOptions.plotArea.dataLabelValue && dataValue !== void 0) {
26765
+ if (chartFormatOptions.plotArea.dataLabelValue && dataValue !== void 0) {
26845
26766
  if (chartFormatOptions.plotArea.dataLabelNumberFormat === ",.0%") {
26846
26767
  return (Math.abs(dataValue / pieTotalValue) * 100).toFixed(
26847
26768
  convertStringToNumber(
@@ -27050,7 +26971,7 @@
27050
26971
  };
27051
26972
  const defineChartRadius = () => {
27052
26973
  try {
27053
- radius = Math.min(innerHeight2 * 0.4, innerWidth2 * 0.4);
26974
+ radius = Math.min(innerHeight2 * 0.5, innerWidth2 * 0.5);
27054
26975
  outsideDataLabelFlag ? radius = radius * 0.9 : null;
27055
26976
  innerRadius = Math.min(
27056
26977
  convertStringToNumber(chartFormatOptions.plotArea.innerRadius) / 100 * radius,
@@ -27140,17 +27061,21 @@
27140
27061
  return "";
27141
27062
  }
27142
27063
  };
27143
- const getDataLabelTransformString = (d) => {
27064
+ const getDataLabelTransformString = (d, isSingleDataLabel) => {
27144
27065
  try {
27145
- const midAngle = (d.startAngle + d.endAngle) / 2;
27146
- const labelRadius = (innerRadius + radius) / 2;
27147
- const x2 = Math.cos(midAngle - Math.PI / 2) * labelRadius;
27148
- const y2 = Math.sin(midAngle - Math.PI / 2) * labelRadius;
27149
- let rotate = midAngle * 180 / Math.PI % 360;
27150
- let angle = 0;
27151
- rotate > 180 && rotate < 360 ? angle = 90 : angle = -90;
27152
- rotate += angle;
27153
- return `translate(${x2},${y2}) rotate(${rotate})`;
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
+ }
27154
27079
  } catch (error) {
27155
27080
  logError$2(fileName$7, "getDataLabelTransformString", error);
27156
27081
  return "";
@@ -27159,6 +27084,7 @@
27159
27084
  const drawDonutDataLabels = () => {
27160
27085
  try {
27161
27086
  if (chartFormatOptions.plotArea.dataLabels) {
27087
+ const isSingleDataLabel = pieChartData && pieChartData.length === 1;
27162
27088
  chartAreaTagG.append("g").attr("class", "parentGroup").attr("transform", `${getPiePosition()}`).attr("pointer-events", "none").attr("text-anchor", "middle").selectAll("text").data(
27163
27089
  pieChartData.filter(
27164
27090
  (d) => d.data.properties.dataLabelPosition == "1"
@@ -27177,7 +27103,7 @@
27177
27103
  ).attr(
27178
27104
  "font-family",
27179
27105
  (d) => d.data.properties?.labelFont ?? "Helvetica"
27180
- ).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) => {
27181
27107
  const { plotArea } = chartFormatOptions;
27182
27108
  if (plotArea.dataLabelName) {
27183
27109
  return d.data.legend;
@@ -27202,10 +27128,10 @@
27202
27128
  ).attr(
27203
27129
  "font-family",
27204
27130
  (d) => d.data.properties?.valueFont ?? "Helvetica"
27205
- ).attr("transform", (d) => getDataLabelTransformString(d)).attr("text-anchor", "middle").attr("alignment-baseline", "middle").attr("dy", "1.00em").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) => {
27206
27132
  if (chartFormatOptions.plotArea.dataLabelValue) {
27207
27133
  const dataValue = d.data.data[0].value;
27208
- if (chartFormatOptions.plotArea.dataLabelName && chartFormatOptions.plotArea.dataLabelValue && dataValue !== void 0) {
27134
+ if (chartFormatOptions.plotArea.dataLabelValue && dataValue !== void 0) {
27209
27135
  if (chartFormatOptions.plotArea.dataLabelNumberFormat === ",.0%") {
27210
27136
  return (Math.abs(dataValue / pieTotalValue) * 100).toFixed(
27211
27137
  convertStringToNumber(
@@ -54393,11 +54319,11 @@
54393
54319
  exports2.AreaChart = AreaChart;
54394
54320
  exports2.BubbleChart = BubbleChart;
54395
54321
  exports2.ColumnChart = ColumnChart;
54396
- exports2.ColumnHistogramChart = ColumnHistogramChart;
54322
+ exports2.ColumnHistogramChart = ColumnHistogramChart$1;
54397
54323
  exports2.CustomColumnChart = CustomColumnChart;
54398
54324
  exports2.DonutChart = DonutChart;
54399
54325
  exports2.HorizontalBarChart = HorizontalBarChart;
54400
- exports2.HorizontalHistogramChart = HorizontalHistogramChart;
54326
+ exports2.HorizontalHistogramChart = ColumnHistogramChart;
54401
54327
  exports2.LayeredColumnChart = LayeredColumnChart;
54402
54328
  exports2.LayeredHorizontalBarChart = LayeredHorizontalBarChart;
54403
54329
  exports2.LineChart = LineChart;