pace-chart-lib 1.0.36 → 1.0.39

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.
@@ -12238,9 +12238,9 @@
12238
12238
  throw error;
12239
12239
  }
12240
12240
  }
12241
- function responsiveSecondaryYaxisLabel(secondaryYmax, secondaryYmin, formatOptions, chartJSON) {
12241
+ function responsiveSecondaryYaxisLabel(secondaryYmax, secondaryYmin, formatOptions, innerHeight2) {
12242
12242
  try {
12243
- let autoLabelFlag = false;
12243
+ let autoLabelFlag = true;
12244
12244
  let secondaryCustomYaxisIntervalValue = parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisIntervalText);
12245
12245
  let secondaryCustomYaxisMinValue = parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisMinText);
12246
12246
  let secondaryCustomYaxisMaxValue = parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisMaxText);
@@ -12257,6 +12257,7 @@
12257
12257
  let minRequiredTicks = 18;
12258
12258
  let tickvalue = secondaryCustomYaxisMinValue == 0 || secondaryCustomYaxisMinValue ? secondaryCustomYaxisMinValue : secondaryYmin < 0 ? Math.round(secondaryYmin) : 0;
12259
12259
  secondaryYAxisLabelArray.push(tickvalue);
12260
+ autoLabelFlag = false;
12260
12261
  if (secondaryCustomTickValue > 100) {
12261
12262
  let message = "Tick count cannot exceed more than 100.";
12262
12263
  if (minValue < 0) {
@@ -12282,17 +12283,16 @@
12282
12283
  }
12283
12284
  }
12284
12285
  } else {
12285
- let autoLabelFlag2 = true;
12286
12286
  let labelWidthPx = calculateWidthHeightDynamically(
12287
- (parseFloat(formatOptions.yAxisLabel.yAxisMaxText) || chartJSON.yMaxRight).toString(),
12288
- formatOptions.yAxisLabel.yAxisLabelFontSize,
12289
- formatOptions.yAxisLabel.yAxisLabelFontFamily,
12287
+ (parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisMaxText) || secondaryYmax).toString(),
12288
+ formatOptions.secondaryYAxisLabel.secondaryYAxisLabelFontSize,
12289
+ formatOptions.secondaryYAxisLabel.secondaryYAxisLabelFontFamily,
12290
12290
  0
12291
12291
  );
12292
12292
  secondaryYAxisLabelArray = getLabelsFromAlgo(
12293
- parseFloat(formatOptions.yAxisLabel.yAxisMinText) || chartJSON.yMinRight,
12294
- parseFloat(formatOptions.yAxisLabel.yAxisMaxText) || chartJSON.yMaxRight,
12295
- innerHeight,
12293
+ parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisMinText) || secondaryYmin,
12294
+ parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisMaxText) || secondaryYmax,
12295
+ innerHeight2,
12296
12296
  labelWidthPx[0]
12297
12297
  );
12298
12298
  }
@@ -12347,7 +12347,7 @@
12347
12347
  if (isTornadoChart) {
12348
12348
  const maxAbs = Math.max(Math.abs(Ymin), Math.abs(Ymax));
12349
12349
  const finalMax = customYaxisMaxValue || maxAbs;
12350
- const finalMin = customYaxisMinValue || -finalMax;
12350
+ const finalMin = customYaxisMinValue || Ymin;
12351
12351
  if (customYaxisIntervalValue && customYaxisIntervalValue > 0) {
12352
12352
  for (let v = finalMin; v <= finalMax + 1e-6; v += customYaxisIntervalValue) {
12353
12353
  yAxisLabelArray.push(parseFloat(v.toFixed(6)));
@@ -12356,10 +12356,11 @@
12356
12356
  } else {
12357
12357
  autoLabelFlag = true;
12358
12358
  const tickCount = 6;
12359
- for (let i = -tickCount; i <= tickCount; i++) {
12360
- yAxisLabelArray.push(
12361
- parseFloat((i * finalMax / tickCount).toFixed(6))
12362
- );
12359
+ const range2 = finalMax - finalMin;
12360
+ const step2 = range2 / tickCount;
12361
+ for (let i = 0; i <= tickCount; i++) {
12362
+ const v = finalMin + i * step2;
12363
+ yAxisLabelArray.push(parseFloat(v.toFixed(6)));
12363
12364
  }
12364
12365
  customTickValue = barChart ? innerWidth2 / 80 : innerHeight2 / 80;
12365
12366
  }
@@ -12685,7 +12686,7 @@
12685
12686
  XaxisG.select(".domain").style("stroke", formatOptions.xAxisLabel.xAxisColor).attr(
12686
12687
  "stroke-width",
12687
12688
  formatOptions.xAxisLabel.xAxisWidth ? formatOptions.xAxisLabel.xAxisWidth : formatOptions.plotArea.plotAreaBorderThickness
12688
- ).style("shape-rendering", "crispEdges");
12689
+ ).style("shape-rendering", "crispEdges").raise();
12689
12690
  return gTag;
12690
12691
  } catch (error) {
12691
12692
  throw error;
@@ -12846,9 +12847,6 @@
12846
12847
  }
12847
12848
  function setXaxistitle$1(formatOptions, barChart, svg, margin, xLabel, height, xTitle, chartType, yLabel, innerWidth2, innerHeight2) {
12848
12849
  try {
12849
- let xAxisLabelPosition = formatOptions.xAxisLabel.xAxisPosition;
12850
- let chartsWithXScrollFlag = true;
12851
- let chartsWithYScrollFlag = false;
12852
12850
  let object2 = svg.append("foreignObject").attr(
12853
12851
  "visibility",
12854
12852
  formatOptions.xAxisTitle.xAxisTitleVisibility ? "visible" : "hidden"
@@ -13217,7 +13215,7 @@
13217
13215
  width: 15
13218
13216
  },
13219
13217
  color: d.Labelcolor,
13220
- type: annotationTypeforCharts(d3Annotation2, parseFloat(annotationType)),
13218
+ type: annotationTypeforCharts$1(d3Annotation2, parseFloat(annotationType)),
13221
13219
  height,
13222
13220
  width
13223
13221
  };
@@ -13229,7 +13227,9 @@
13229
13227
  }
13230
13228
  });
13231
13229
  if (formatOptions.annotation.annotationHideZeroValues) {
13232
- annotationsList = annotationsList.filter((d) => d.data.y.measure != 0);
13230
+ annotationsList = annotationsList.filter(
13231
+ (d) => barChart ? d.data.x.measure !== 0 : d.data.y.measure !== 0
13232
+ );
13233
13233
  }
13234
13234
  if (oldAnnotationList.length === 0) {
13235
13235
  oldAnnotationList = annotationsList;
@@ -13745,7 +13745,7 @@
13745
13745
  width: 15
13746
13746
  },
13747
13747
  color: d.labelColor || d.data.labelColor,
13748
- type: annotationTypeforCharts(d3Annotation2, parseFloat(annotationType)),
13748
+ type: annotationTypeforCharts$1(d3Annotation2, parseFloat(annotationType)),
13749
13749
  height,
13750
13750
  width
13751
13751
  };
@@ -13802,7 +13802,7 @@
13802
13802
  }
13803
13803
  }
13804
13804
  }
13805
- finalAnnotationList.push(newAnnotation);
13805
+ newAnnotation.data.labelPosition != 4 && finalAnnotationList.push(newAnnotation);
13806
13806
  });
13807
13807
  makeAnnotations.editMode(formatOptions.annotation.annotationDraggable && isReportEditable).accessors({
13808
13808
  x: function(d) {
@@ -13901,7 +13901,7 @@
13901
13901
  throw error;
13902
13902
  }
13903
13903
  };
13904
- const annotationTypeforCharts = (d3Annotation2, type) => {
13904
+ const annotationTypeforCharts$1 = (d3Annotation2, type) => {
13905
13905
  try {
13906
13906
  let annotationTypeMap = {
13907
13907
  1: d3Annotation2.annotationLabel,
@@ -15127,7 +15127,7 @@
15127
15127
  width: 15
15128
15128
  },
15129
15129
  color: d.properties && d.properties[dataLabelColor] ? d.properties[dataLabelColor] : d.data.labelColor,
15130
- type: annotationTypeforCharts(d3Annotation2, parseFloat(annotationType)),
15130
+ type: annotationTypeforCharts$1(d3Annotation2, parseFloat(annotationType)),
15131
15131
  height,
15132
15132
  width
15133
15133
  };
@@ -15321,7 +15321,7 @@
15321
15321
  translate(${-(xScaleBottom(yMaxLeft * 0.01) + xLabelMargin)} ,${-dimHeight / 2})` : `rotate(${90 - formatOptions.xAxisLabel.xAxisLabelRotation})
15322
15322
  translate(${formatOptions.xAxisLabel.xAxisLabelRotation != 0 ? `${xaxisLabelPosition === 1 ? 10 : -xLabelMargin},${-dimHeight / 2}` : -labelWidth / 2 + " ,2"})`;
15323
15323
  }
15324
- const initYaxisBar = (formatOptions, gTag, xLabel, innerHeight2, innerWidth2, yAxis, xAxisTop, xScaleBottom, yMaxLeft, dimensionList, chartType, isDateType, width, dimensionHeightWidthArray, columnWidth, xScale) => {
15324
+ const initYaxisBar = (formatOptions, gTag, xLabel, innerHeight2, innerWidth2, yAxis, xAxisTop, xScaleBottom, yMaxLeft, dimensionList, chartType, isDateType, width, dimensionHeightWidthArray, columnWidth, xScale, xLabelSecondaryAxis) => {
15325
15325
  try {
15326
15326
  const isTornadoChart = chartType === chartTypes.TornadoChart;
15327
15327
  let fontStyle = formatOptions.xAxisLabel.xAxisLabelFontStyle;
@@ -15359,7 +15359,7 @@
15359
15359
  );
15360
15360
  const YaxisG = gTag.append("g").attr("id", "yAxisG").attr(
15361
15361
  "transform",
15362
- isTornadoChart ? `translate(${xScaleBottom(0)},0)` : `translate(${xaxisLabelPosition === 0 ? 0 : xaxisLabelPosition === 1 ? innerWidth2 : xScaleBottom(0)},0)`
15362
+ isTornadoChart ? `translate(${xScaleBottom(0)},0)` : `translate(${xaxisLabelPosition === 0 ? 0 : xaxisLabelPosition === 1 ? innerWidth2 : xScaleBottom(0)},${xAxisTop ? xLabelSecondaryAxis : 0})`
15363
15363
  ).call(yAxis);
15364
15364
  let foreignObject = YaxisG.selectAll("g").append("foreignObject").attr("class", "testingoverflowing").style("align-content", "center").attr("width", xLabelMargin).attr("height", dimHeight + "px").attr(
15365
15365
  "transform",
@@ -15476,14 +15476,14 @@
15476
15476
  throw e;
15477
15477
  }
15478
15478
  };
15479
- const initXaxisTop = (formatOptions, gTag, xLabelSecondary, xAxisTop) => {
15479
+ const initXaxisTop = (formatOptions, gTag, xLabelSecondary, xAxisTop, innerWidth2) => {
15480
15480
  try {
15481
15481
  let fontStyle = formatOptions.secondaryYAxisLabel.secondaryYAxisLabelFontStyle;
15482
- gTag.append("rect").attr("transform", `translate(0,-${xLabelSecondary})`).attr("height", xLabelSecondary).attr("width", innerWidth).attr(
15482
+ gTag.append("rect").attr("transform", `translate(0,0)`).attr("height", xLabelSecondary).attr("width", innerWidth2).attr(
15483
15483
  "fill",
15484
15484
  formatOptions.secondaryYAxisLabel.secondaryYAxisLabelVisibility ? formatOptions.secondaryYAxisLabel.secondaryYAxisBackgroundColor ? formatOptions.secondaryYAxisLabel.secondaryYAxisBackgroundColor !== commonColors.white ? formatOptions.secondaryYAxisLabel.secondaryYAxisBackgroundColor : "none" : formatOptions.secondaryYAxisLabel.secondaryYAxisBackgroundColor : formatOptions.chartArea.chartAreaColor
15485
15485
  );
15486
- const XaxisG = gTag.append("g").call(xAxisTop).attr("transform", `translate(0,0)`);
15486
+ const XaxisG = gTag.append("g").call(xAxisTop).attr("transform", `translate(0,${xLabelSecondary})`);
15487
15487
  XaxisG.selectAll("line").style("shape-rendering", "crispEdges").attr("stroke", formatOptions.plotArea.gridLinesColor).attr("stroke-width", "0.05em").attr("stroke-opacity", formatOptions.plotArea.fitChart ? "1" : "0");
15488
15488
  XaxisG.selectAll("text").attr("transform", "rotate(270) translate(5,5)").style("text-anchor", "start").style("fill", formatOptions.secondaryYAxisLabel.secondaryYAxisLabelColor !== commonColors.white ? formatOptions.secondaryYAxisLabel.secondaryYAxisLabelColor : "none").style("font-size", formatOptions.secondaryYAxisLabel.secondaryYAxisLabelFontSize).style("font-family", formatOptions.secondaryYAxisLabel.secondaryYAxisLabelFontFamily).style("font-style", fontStyle.includes("Italic") ? "Italic" : "").style(
15489
15489
  "text-decoration",
@@ -15681,7 +15681,7 @@
15681
15681
  width: 15
15682
15682
  },
15683
15683
  color: formatOptions.total.totalColor,
15684
- type: annotationTypeforCharts(d3Annotation2, parseFloat(annotationType)),
15684
+ type: annotationTypeforCharts$1(d3Annotation2, parseFloat(annotationType)),
15685
15685
  height,
15686
15686
  width
15687
15687
  };
@@ -15760,6 +15760,13 @@
15760
15760
  });
15761
15761
  }
15762
15762
  }
15763
+ function getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight, shouldAdjustForAxisPosition = false) {
15764
+ const axisPositionMultiplier = shouldAdjustForAxisPosition ? formatOptions.xAxisLabel.xAxisPosition == "1" ? -1 : 1 : 1;
15765
+ const dataTableHeightIfPreset = dataTableHeight > 0 ? dataTableHeight : 0;
15766
+ const tickHeightPercentage = parseFloat(formatOptions.plotArea.ticksHeight) || 100;
15767
+ const actualTickHeight = (innerHeight2 - dataTableHeightIfPreset) * tickHeightPercentage / 100;
15768
+ return formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesVertical ? -actualTickHeight * axisPositionMultiplier : 0 : 0;
15769
+ }
15763
15770
  const chartProperties = {
15764
15771
  color: "defaultColor",
15765
15772
  name: "",
@@ -17342,6 +17349,12 @@
17342
17349
  ).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
17343
17350
  }
17344
17351
  if (isSecondaryAxisDrawn) {
17352
+ let seondaryResponsiveLablesObj = responsiveSecondaryYaxisLabel(
17353
+ secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : yScaleRight.domain()[1],
17354
+ yScaleRight.domain()[0],
17355
+ formatOptions,
17356
+ innerHeight2
17357
+ );
17345
17358
  yAxisRight = axisRight(yScaleRight).tickFormat(
17346
17359
  (d) => getNumberWithFormat(
17347
17360
  d,
@@ -17350,19 +17363,9 @@
17350
17363
  formatOptions.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision
17351
17364
  )
17352
17365
  ).tickValues(
17353
- responsiveSecondaryYaxisLabel(
17354
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
17355
- chartJSON.yMinRight,
17356
- formatOptions,
17357
- chartJSON
17358
- ).secondaryYAxisLabelArray
17366
+ seondaryResponsiveLablesObj.autoLabelFlag ? void 0 : seondaryResponsiveLablesObj.secondaryYAxisLabelArray
17359
17367
  ).ticks(
17360
- responsiveSecondaryYaxisLabel(
17361
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
17362
- chartJSON.yMinRight,
17363
- formatOptions,
17364
- chartJSON
17365
- ).secondaryCustomTickValue ?? innerHeight2 / 30
17368
+ seondaryResponsiveLablesObj.secondaryCustomTickValue ?? innerHeight2 / 30
17366
17369
  ).tickSize(
17367
17370
  formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 : 0 : 0
17368
17371
  ).tickPadding(8).tickSizeOuter(0);
@@ -17371,7 +17374,7 @@
17371
17374
  const getXAxis = () => {
17372
17375
  let xaxisLabelPosition = parseInt(formatOptions.xAxisLabel.xAxisPosition);
17373
17376
  xAxis = (xaxisLabelPosition == 1 ? axisTop(xScale) : axisBottom(xScale)).tickSize(
17374
- formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesVertical ? formatOptions.plotArea.gridLinesVertical ? -(dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2) : -formatOptions.plotArea.ticksHeight * ((dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2) / 100) : 0 : 0
17377
+ getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight)
17375
17378
  ).tickSizeOuter(0).tickValues(responsiveXaxisLabel(filteredDimension, innerWidth2));
17376
17379
  };
17377
17380
  const getChartType = (lineData) => {
@@ -17852,7 +17855,7 @@
17852
17855
  ...point2,
17853
17856
  type: series.properties.type,
17854
17857
  axis: series.properties.axis,
17855
- labelPosition: formatOptions?.annotation?.annotationPosition.toString() === "4" ? series.properties.dataLabelPosition.toString() : formatOptions?.annotation?.annotationPosition.toString(),
17858
+ labelPosition: formatOptions?.annotation?.annotationPosition.toString() === "4" ? series.properties.annotationPosition.toString() : formatOptions?.annotation?.annotationPosition.toString(),
17856
17859
  labelColor: series.properties.labelColor,
17857
17860
  legendUniqueId: series.properties.legendUniqueId
17858
17861
  };
@@ -18005,7 +18008,7 @@
18005
18008
  secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
18006
18009
  secondaryCustomYaxisMinValue ? secondaryCustomYaxisMinValue : chartJSON.yMinRight,
18007
18010
  formatOptions,
18008
- chartJSON
18011
+ innerHeight2
18009
18012
  ).secondaryYAxisLabelArray;
18010
18013
  chartJSON.yMaxRight = secondaryYAxisLabelArray[secondaryYAxisLabelArray.length - 1];
18011
18014
  chartJSON.yMinRight = secondaryYAxisLabelArray[0];
@@ -18575,7 +18578,7 @@
18575
18578
  stackData["individualAnnotationVisibility"] = JSON.parse(
18576
18579
  JSON.stringify(requiredStackChatData.data[j].properties.annotation)
18577
18580
  );
18578
- d.data.labelPosition = formatOptions?.annotation?.annotationPosition.toString() === "4" ? requiredStackChatData.data[j].properties.dataLabelPosition.toString() : formatOptions?.annotation?.annotationPosition.toString();
18581
+ d.data.labelPosition = formatOptions?.annotation?.annotationPosition.toString() === "4" ? requiredStackChatData.data[j].properties.annotationPosition.toString() : formatOptions?.annotation?.annotationPosition.toString();
18579
18582
  d.data["labelColor"] = seriesColor == "2" ? JSON.parse(
18580
18583
  JSON.stringify(requiredStackChatData.data[j].properties.color)
18581
18584
  ) : JSON.parse(
@@ -19462,7 +19465,7 @@
19462
19465
  };
19463
19466
  const getXAxis = () => {
19464
19467
  xAxis = axisBottom(xScale).tickSize(
19465
- 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
19468
+ getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight, true)
19466
19469
  ).tickSizeOuter(0).tickValues(responsiveXaxisLabel(filteredDimension, innerWidth2));
19467
19470
  };
19468
19471
  const getChartType = (lineData) => {
@@ -20887,6 +20890,137 @@
20887
20890
  logError$1(fileName$a, "initXaxis", error);
20888
20891
  }
20889
20892
  }
20893
+ function pieFamilyAnnotation(d3Annotation2, chartData, formatOptions, getPiePosition, chartType, width, height, svg, radius) {
20894
+ try {
20895
+ if (!formatOptions.annotation.annotationVisibility) return;
20896
+ const AnnotationType = formatOptions.plotArea.annotationType ?? "1";
20897
+ const Disable = [AnnotationType === "1" ? "connector" : ""];
20898
+ const ConnectorType = formatOptions.plotArea.connectorType?.toLowerCase() ?? "none";
20899
+ const rotationAngle = formatOptions.plotArea.rotation ?? 0;
20900
+ const multiplicationFactor = chartType === chartTypes.PieChart ? 1.06 : 1.1;
20901
+ const connecterCurve2 = {
20902
+ "1": "",
20903
+ "2": curveLinear$1,
20904
+ "3": step
20905
+ };
20906
+ const connectedStyle2 = {
20907
+ solid: "unset",
20908
+ Dotted: 2,
20909
+ Dashed: 7
20910
+ };
20911
+ let makeAnnotations = d3Annotation2.annotation();
20912
+ let oldAnnotationList = JSON.parse(
20913
+ JSON.stringify(formatOptions.plotArea.dataLabelsCoordinates || [])
20914
+ );
20915
+ oldAnnotationList.forEach((d) => {
20916
+ d.dx = d.dx * width / d.width;
20917
+ d.dy = d.dy * height / d.height;
20918
+ d.width = width;
20919
+ d.height = height;
20920
+ });
20921
+ const sum2 = chartData.reduce(
20922
+ (a2, b) => a2 + (b?.data?.data?.[0]?.value ?? 0),
20923
+ 0
20924
+ );
20925
+ const safeSum = sum2 === 0 ? 1 : sum2;
20926
+ const createAnnotation = (data, index2) => {
20927
+ const value2 = data.data.data[0].value;
20928
+ const midAngle = (data.x0 + data.x1) / 2;
20929
+ const angleSize = data.x1 - data.x0;
20930
+ return {
20931
+ note: {
20932
+ title: formatOptions.plotArea.dataLabelName ? data.data.legend : "",
20933
+ label: formatOptions.plotArea.dataLabelValue && value2 !== 0 ? formatOptions.plotArea.dataLabelNumberFormat === ",.0%" ? (Math.abs(value2 / safeSum) * 100).toFixed(
20934
+ convertStringToNumber(
20935
+ formatOptions.plotArea.dataLabelDecimalPrecision
20936
+ )
20937
+ ) + "%" : getNumberWithFormatFunction(
20938
+ formatOptions.plotArea.plotAreaDisplayUnits,
20939
+ formatOptions.plotArea.dataLabelNumberFormat,
20940
+ formatOptions.plotArea.dataLabelDecimalPrecision
20941
+ )(value2) : "",
20942
+ align: "middle",
20943
+ wrap: 1e3
20944
+ },
20945
+ data: {
20946
+ x: { legend: data.data.legend },
20947
+ y: { value: value2 },
20948
+ x0: data.x0,
20949
+ x1: data.x1,
20950
+ y0: data.y0,
20951
+ y1: data.y1,
20952
+ midAngle,
20953
+ isVisible: true,
20954
+ Data: data.data.properties
20955
+ },
20956
+ connector: {
20957
+ end: ConnectorType,
20958
+ curve: connecterCurve2[formatOptions.plotArea.connectorCurve]
20959
+ },
20960
+ disable: Disable,
20961
+ subject: { radius: 3 },
20962
+ type: annotationTypeforCharts(d3Annotation2, AnnotationType),
20963
+ color: formatOptions.plotArea.dataLabelNameColor ?? "#000",
20964
+ width,
20965
+ height,
20966
+ index: index2
20967
+ };
20968
+ };
20969
+ let AnnotationsList = chartData.filter((d) => d.x1 - d.x0 > 1e-4).map(createAnnotation);
20970
+ const visibleFilter = (d) => (d.data.y0 + d.data.y1) / 2 * (d.data.x1 - d.data.x0) > 0.17;
20971
+ AnnotationsList = AnnotationsList.filter(visibleFilter);
20972
+ oldAnnotationList = oldAnnotationList.filter(visibleFilter);
20973
+ oldAnnotationList.forEach((oldA) => {
20974
+ const match = AnnotationsList.find(
20975
+ (a2) => a2.data.x.legend === oldA.data.x.legend
20976
+ );
20977
+ if (match) {
20978
+ match.dx = oldA.dx;
20979
+ match.dy = oldA.dy;
20980
+ match.data.isVisible = oldA.data.isVisible ?? true;
20981
+ match.connector.points = oldA.connector?.points;
20982
+ }
20983
+ });
20984
+ makeAnnotations.editMode(formatOptions.plotArea.annotationDraggable).accessors({
20985
+ x(d) {
20986
+ const r = radius;
20987
+ const a2 = d.midAngle + rotationAngle * Math.PI / 180;
20988
+ return Math.cos(d.midAngle - Math.PI / 2) * (radius * 0.65);
20989
+ },
20990
+ y(d) {
20991
+ const r = radius;
20992
+ const a2 = d.midAngle + rotationAngle * Math.PI / 180;
20993
+ return Math.sin(d.midAngle - Math.PI / 2) * (radius * 0.65);
20994
+ }
20995
+ }).annotations(AnnotationsList);
20996
+ const annotations = svg.append("g").attr("class", "annotation-group parentGroup").attr("transform", getPiePosition).call(makeAnnotations);
20997
+ annotations.selectAll("rect,.annotation-subject,.handle").remove();
20998
+ annotations.selectAll(".connector").style("stroke", formatOptions.plotArea.connectorColor ?? "#ccc").attr(
20999
+ "stroke-dasharray",
21000
+ connectedStyle2[formatOptions.plotArea.connectorStyle]
21001
+ );
21002
+ annotations.selectAll(".annotation-note-label").filter((d) => !d.data.isVisible).style("display", "none");
21003
+ annotations.selectAll(".annotation-note-label").filter((d) => formatOptions.plotArea.hideInsignificantValue && d.data.x1 - d.data.x0 < 0.09).style("visibility", "hidden");
21004
+ formatOptions.plotArea.dataLabelsCoordinates = AnnotationsList;
21005
+ } catch (error) {
21006
+ throw error;
21007
+ }
21008
+ }
21009
+ const annotationTypeforCharts = (d3Annotation2, type) => {
21010
+ try {
21011
+ let annotationTypeMap = {
21012
+ 1: d3Annotation2.annotationLabel,
21013
+ 2: d3Annotation2.annotationLabel,
21014
+ 3: d3Annotation2.annotationCallout,
21015
+ 4: d3Annotation2.annotationCalloutElbow,
21016
+ 5: d3Annotation2.annotationCalloutCurve
21017
+ };
21018
+ let annotationType = annotationTypeMap[type];
21019
+ return annotationType;
21020
+ } catch (error) {
21021
+ throw error;
21022
+ }
21023
+ };
20890
21024
  const setnumberOfBubbles = (svg, legendPosition, chartFormatOptions, height, width, margins, innnerHeight, xTitleHeight, XLabelHeight, bubbleCount) => {
20891
21025
  try {
20892
21026
  if (chartFormatOptions.plotArea.numberOfBubbles) {
@@ -21605,17 +21739,19 @@
21605
21739
  yTitle,
21606
21740
  yLabel
21607
21741
  );
21608
- yAxistitleRight(
21609
- svg,
21610
- isSecondaryAxisDrawn,
21611
- margin,
21612
- formatOptions,
21613
- dataTableHeight,
21614
- innerHeight2,
21615
- innerWidth2,
21616
- secondaryYLabel,
21617
- secondaryAxisTitleWidth
21618
- );
21742
+ if (isSecondaryAxisDrawn) {
21743
+ yAxistitleRight(
21744
+ svg,
21745
+ isSecondaryAxisDrawn,
21746
+ margin,
21747
+ formatOptions,
21748
+ dataTableHeight,
21749
+ innerHeight2,
21750
+ innerWidth2,
21751
+ secondaryYLabel,
21752
+ secondaryAxisTitleWidth
21753
+ );
21754
+ }
21619
21755
  setChartTitle(svg, formatOptions, width, chartTitleHeight);
21620
21756
  drawLegends(
21621
21757
  height,
@@ -21774,10 +21910,10 @@
21774
21910
  }
21775
21911
  if (isSecondaryAxisDrawn) {
21776
21912
  let responsiveSecondaryLablesObj = responsiveSecondaryYaxisLabel(
21777
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
21778
- chartJSON.yMinRight,
21913
+ secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : yScaleRight.domain()[1],
21914
+ yScaleRight.domain()[0],
21779
21915
  formatOptions,
21780
- chartJSON
21916
+ innerHeight2
21781
21917
  );
21782
21918
  yAxisRight = axisRight(yScaleRight).tickFormat(
21783
21919
  (d) => getNumberWithFormat(
@@ -23209,7 +23345,7 @@
23209
23345
  xAxisBottom
23210
23346
  );
23211
23347
  if (isSecondaryAxisDrawn) {
23212
- initXaxisTop(formatOptions, gTag, secondaryYLabel, xAxisTop);
23348
+ initXaxisTop(formatOptions, gTag, secondaryYLabel, xAxisTop, innerWidth2);
23213
23349
  }
23214
23350
  setXaxistitle$1(
23215
23351
  formatOptions,
@@ -23235,7 +23371,7 @@
23235
23371
  yLabel,
23236
23372
  innerWidth2
23237
23373
  );
23238
- yAxistitleRight(
23374
+ formatOptions.xAxisLabel.xAxisPosition == "2" && yAxistitleRight(
23239
23375
  svg,
23240
23376
  isSecondaryAxisDrawn,
23241
23377
  margin,
@@ -23384,10 +23520,10 @@
23384
23520
  }
23385
23521
  if (isSecondaryAxisDrawn) {
23386
23522
  let responsiveSecondaryLablesObj = responsiveSecondaryYaxisLabel(
23387
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
23388
- chartJSON.yMinRight,
23523
+ secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : xScaleTop.domain()[1],
23524
+ xScaleTop.domain()[0],
23389
23525
  formatOptions,
23390
- chartJSON
23526
+ innerWidth2
23391
23527
  );
23392
23528
  xAxisTop = axisTop(xScaleTop).tickFormat(
23393
23529
  (d) => getNumberWithFormat(
@@ -23399,7 +23535,7 @@
23399
23535
  ).tickValues(
23400
23536
  responsiveSecondaryLablesObj.autoLabelFlag ? void 0 : responsiveSecondaryLablesObj.secondaryYAxisLabelArray
23401
23537
  ).ticks(responsiveSecondaryLablesObj.secondaryCustomTickValue).tickSize(
23402
- formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 : 0 : 0
23538
+ formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerHeight2 : 0 : 0
23403
23539
  ).tickPadding(8).tickSizeOuter(0);
23404
23540
  }
23405
23541
  };
@@ -23449,10 +23585,10 @@
23449
23585
  return d.value >= 0 ? xScaleUsed(0) : xScaleUsed(0);
23450
23586
  }).attr("width", 0).attr("fill", data2.properties.color).attr(
23451
23587
  "stroke-dasharray",
23452
- (d) => d.stackBorderStyle === 2 ? "5,3" : "0"
23453
- ).attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
23588
+ (d) => d.properties.stackBorderStyle == 2 ? "5,3" : "0"
23589
+ ).attr("stroke-width", (d) => `${d.properties.stackBorderWidth}px`).attr(
23454
23590
  "stroke",
23455
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
23591
+ (d) => data2.properties.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderColor : "none"
23456
23592
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
23457
23593
  "visibility",
23458
23594
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -23543,7 +23679,8 @@
23543
23679
  width,
23544
23680
  dimensionHeightWidthArray,
23545
23681
  columnWidth,
23546
- yScale
23682
+ yScale,
23683
+ secondaryYLabel
23547
23684
  );
23548
23685
  getChartType(filteredData);
23549
23686
  commonAnnotations(
@@ -24453,7 +24590,7 @@
24453
24590
  margin,
24454
24591
  yTitle,
24455
24592
  yLabel,
24456
- void 0
24593
+ innerWidth2
24457
24594
  );
24458
24595
  setChartTitle(svg, formatOptions, width, chartTitleHeight);
24459
24596
  drawLegends(
@@ -25059,6 +25196,7 @@
25059
25196
  lData.data.forEach((cData) => {
25060
25197
  cData.hideZero = lData.properties.hideZeroValues;
25061
25198
  cData.axis = lData.properties.axis;
25199
+ cData["properties"] = lData.properties;
25062
25200
  });
25063
25201
  });
25064
25202
  lineData.forEach((data2, index2) => {
@@ -25962,7 +26100,7 @@
25962
26100
  );
25963
26101
  const dimensionList = data.DimensionList;
25964
26102
  const barChart = false;
25965
- const isSecondaryAxisDrawn = false;
26103
+ let isSecondaryAxisDrawn = false;
25966
26104
  const isNormalizedChart = false;
25967
26105
  let customYaxisMinValue = formatOptions.yAxisLabel.yAxisIntervalsVisibility ? parseFloat(formatOptions.yAxisLabel.yAxisMinText) : void 0;
25968
26106
  let customYaxisMaxValue = formatOptions.yAxisLabel.yAxisIntervalsVisibility ? parseFloat(formatOptions.yAxisLabel.yAxisMaxText) : void 0;
@@ -25993,11 +26131,13 @@
25993
26131
  let svg;
25994
26132
  let gTag;
25995
26133
  let yScaleLeft;
26134
+ let yScaleRight;
25996
26135
  let xScale;
25997
26136
  let calculatedRange;
25998
26137
  let seriesLabelWidth;
25999
26138
  let yAxisLeft;
26000
26139
  let xAxis;
26140
+ let yAxisRight;
26001
26141
  let filteredDimension;
26002
26142
  let filteredData = [];
26003
26143
  let scrollPosition = 0;
@@ -26105,6 +26245,17 @@
26105
26245
  yAxisLeft,
26106
26246
  innerHeight2
26107
26247
  );
26248
+ if (isSecondaryAxisDrawn) {
26249
+ initYaxisRight(
26250
+ gTag,
26251
+ formatOptions,
26252
+ dataTableHeight,
26253
+ secondaryYLabel,
26254
+ yAxisRight,
26255
+ innerHeight2,
26256
+ innerWidth2
26257
+ );
26258
+ }
26108
26259
  setXaxistitle$1(
26109
26260
  formatOptions,
26110
26261
  barChart,
@@ -26187,7 +26338,11 @@
26187
26338
  );
26188
26339
  series.data.forEach((point2) => {
26189
26340
  allChartData.push(point2);
26190
- {
26341
+ if (series.properties.axis === "Secondary") {
26342
+ isSecondaryAxisDrawn = true;
26343
+ yMaxRight = Math.max(yMaxRight, point2.value);
26344
+ yMinRight = Math.min(yMinRight, point2.value);
26345
+ } else {
26191
26346
  yMaxLeft = Math.max(yMaxLeft, point2.value);
26192
26347
  yMinLeft = Math.min(yMinLeft, point2.value);
26193
26348
  }
@@ -26237,6 +26392,15 @@
26237
26392
  0
26238
26393
  ]);
26239
26394
  }
26395
+ if (isSecondaryAxisDrawn) {
26396
+ yScaleRight = linear$1().domain([
26397
+ chartJSON.yMinRight >= 0 ? (secondaryCustomYaxisMinValue || secondaryCustomYaxisMinValue == 0) && !Number.isNaN(secondaryCustomYaxisMinValue) ? secondaryCustomYaxisMinValue : 0 : (secondaryCustomYaxisMinValue || secondaryCustomYaxisMinValue == 0) && !Number.isNaN(secondaryCustomYaxisMinValue) ? secondaryCustomYaxisMinValue : chartJSON.yMinRight * 1.1,
26398
+ chartJSON.yMaxRight <= 0 ? secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : 0 : secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight * 1.1
26399
+ ]).range([
26400
+ dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2,
26401
+ 0
26402
+ ]);
26403
+ }
26240
26404
  calculatedRange = [0, innerWidth2];
26241
26405
  if (formatOptions.seriesLabel.seriesLabelVisibility) {
26242
26406
  let labelObj = prepareDataForSeriesLabel(
@@ -26282,6 +26446,28 @@
26282
26446
  responsiveLablesObj.autoLabelFlag ? void 0 : responsiveLablesObj.yAxisLabelArray
26283
26447
  ).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
26284
26448
  }
26449
+ if (isSecondaryAxisDrawn) {
26450
+ let responsiveSecondaryLablesObj = responsiveSecondaryYaxisLabel(
26451
+ secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : yScaleRight.domain()[1],
26452
+ yScaleRight.domain()[0],
26453
+ formatOptions,
26454
+ innerHeight2
26455
+ );
26456
+ yAxisRight = axisRight(yScaleRight).tickFormat(
26457
+ (d) => getNumberWithFormat(
26458
+ d,
26459
+ formatOptions.secondaryYAxisLabel.secondaryYAxisDisplayUnits,
26460
+ formatOptions.secondaryYAxisLabel.secondaryYAxisNumberFormat,
26461
+ formatOptions.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision
26462
+ )
26463
+ ).tickValues(
26464
+ responsiveSecondaryLablesObj.autoLabelFlag ? void 0 : responsiveSecondaryLablesObj.secondaryYAxisLabelArray
26465
+ ).ticks(
26466
+ responsiveSecondaryLablesObj.secondaryCustomTickValue ?? innerHeight2 / 30
26467
+ ).tickSize(
26468
+ formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 : 0 : 0
26469
+ ).tickSizeOuter(0);
26470
+ }
26285
26471
  };
26286
26472
  const getXAxis = () => {
26287
26473
  xAxis = axisBottom(xScale).tickSize(
@@ -26298,7 +26484,7 @@
26298
26484
  });
26299
26485
  const areaGenerator = area().x(
26300
26486
  (d) => xScale(d.dimension) ? xScale(d.dimension) : null
26301
- ).y0(() => yScaleLeft(0)).y1((d) => yScaleLeft(d.value)).defined((d) => d.hideZero ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
26487
+ ).y0((d) => d.axis === axisTypes.primary ? yScaleLeft(0) : yScaleRight(0)).y1((d) => d.axis === axisTypes.primary ? yScaleLeft(d.value) : yScaleRight(d.value)).defined((d) => d.hideZero ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
26302
26488
  const areaGeneratorStart = area().x(
26303
26489
  (d) => xScale(d.dimension) ? xScale(d.dimension) : null
26304
26490
  ).y0(() => yScaleLeft(0)).y1(() => yScaleLeft(0)).defined((d) => d.hideZero ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
@@ -26362,7 +26548,7 @@
26362
26548
  chartType,
26363
26549
  xScale,
26364
26550
  yScaleLeft,
26365
- void 0,
26551
+ yScaleRight,
26366
26552
  null,
26367
26553
  formatOptions,
26368
26554
  chartJSON,
@@ -26387,29 +26573,11 @@
26387
26573
  const drawAreaChart = () => {
26388
26574
  getXScale();
26389
26575
  getXAxis();
26390
- initXaxis$1(
26391
- gTag,
26392
- chartJSON,
26393
- xLabel,
26394
- formatOptions,
26395
- dataTableHeight,
26396
- yScaleLeft,
26397
- xAxis,
26398
- dimensionHeightWidthArray,
26399
- height,
26400
- barWidth,
26401
- isDateType,
26402
- innerWidth2,
26403
- innerHeight2,
26404
- filteredDimension,
26405
- xScale
26406
- );
26407
26576
  commonAnnotations(
26408
26577
  seriesData,
26409
26578
  xScale,
26410
26579
  yScaleLeft,
26411
- void 0,
26412
- // need to pass secondary axis scale if secondary axis is drawn
26580
+ yScaleRight,
26413
26581
  margin,
26414
26582
  d3Annotation,
26415
26583
  [],
@@ -26440,6 +26608,23 @@
26440
26608
  isSecondaryAxisDrawn
26441
26609
  ).labelArray;
26442
26610
  getChartType(filteredData);
26611
+ initXaxis$1(
26612
+ gTag,
26613
+ chartJSON,
26614
+ xLabel,
26615
+ formatOptions,
26616
+ dataTableHeight,
26617
+ yScaleLeft,
26618
+ xAxis,
26619
+ dimensionHeightWidthArray,
26620
+ height,
26621
+ barWidth,
26622
+ isDateType,
26623
+ innerWidth2,
26624
+ innerHeight2,
26625
+ filteredDimension,
26626
+ xScale
26627
+ );
26443
26628
  drawSeriesLabels(formatOptions, gTag, newSeriesLabelArray);
26444
26629
  if (formatOptions.dataTableProperties && formatOptions.dataTableProperties.dataTable) {
26445
26630
  if (formatOptions.xAxisLabel.xAxisPosition != "1")
@@ -26938,6 +27123,7 @@
26938
27123
  const drawLineChart = () => {
26939
27124
  getXScale();
26940
27125
  getXAxis();
27126
+ getChartType(filteredData);
26941
27127
  initXaxis$1(
26942
27128
  gTag,
26943
27129
  chartJSON,
@@ -26955,7 +27141,6 @@
26955
27141
  filteredDimension,
26956
27142
  xScale
26957
27143
  );
26958
- getChartType(filteredData);
26959
27144
  stacklineAnnotations(
26960
27145
  stackChartData,
26961
27146
  xScale,
@@ -27783,7 +27968,22 @@
27783
27968
  );
27784
27969
  initPieChartData();
27785
27970
  drawPieChart();
27786
- drawPieDataLabels();
27971
+ if (chartFormatOptions.plotArea.annotationDraggable && chartFormatOptions.plotArea.dataLabels) {
27972
+ pieFamilyAnnotation.call(
27973
+ void 0,
27974
+ d3Annotation,
27975
+ pieChartData,
27976
+ chartFormatOptions,
27977
+ getPiePosition(),
27978
+ chartTypes.PieChart,
27979
+ width,
27980
+ height,
27981
+ chartAreaTagG,
27982
+ Math.min(innerHeight2 * 0.5, innerWidth2 * 0.5)
27983
+ );
27984
+ } else {
27985
+ drawPieDataLabels();
27986
+ }
27787
27987
  drawTotalValue(
27788
27988
  chartFormatOptions,
27789
27989
  pieTotalValue,
@@ -27937,7 +28137,7 @@
27937
28137
  (d) => getDataLabelTransformString(d, isSingleDataLabel)
27938
28138
  ).attr(
27939
28139
  "visibility",
27940
- (d) => d.endAngle - d.startAngle < 0.17 ? "hidden" : "visible"
28140
+ (d) => d.endAngle - d.startAngle < 0.09 && formatOptions.plotArea.hideInsignificantValue ? "hidden" : "visible"
27941
28141
  ).attr("dy", "-0.35em").attr("text-anchor", "middle").attr("alignment-baseline", "middle").text((d) => {
27942
28142
  const { plotArea } = chartFormatOptions;
27943
28143
  if (plotArea.dataLabelName) {
@@ -28178,7 +28378,22 @@
28178
28378
  );
28179
28379
  initPieChartData();
28180
28380
  drawDonutChart();
28181
- drawDonutDataLabels();
28381
+ if (chartFormatOptions.plotArea.annotationDraggable && chartFormatOptions.plotArea.dataLabels) {
28382
+ pieFamilyAnnotation.call(
28383
+ void 0,
28384
+ d3Annotation,
28385
+ pieChartData,
28386
+ chartFormatOptions,
28387
+ getPiePosition(),
28388
+ chartTypes.DonutChart,
28389
+ width,
28390
+ height,
28391
+ chartAreaTagG,
28392
+ Math.min(innerHeight2 * 0.5, innerWidth2 * 0.5)
28393
+ );
28394
+ } else {
28395
+ drawDonutDataLabels();
28396
+ }
28182
28397
  drawTotalValue2();
28183
28398
  };
28184
28399
  const loopOverSeriesData = () => {
@@ -30275,7 +30490,7 @@
30275
30490
  "font-family",
30276
30491
  chartFormatOptions.pointerValue.pointerValueFontFamily
30277
30492
  ).text(
30278
- (d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias || d != 0 ? getNumberWithFormatFunction(
30493
+ (d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ? getNumberWithFormatFunction(
30279
30494
  "None",
30280
30495
  chartFormatOptions.pointerValue.pointerValueNumberFormat,
30281
30496
  chartFormatOptions.pointerValue.pointerValueDecimalPrecision
@@ -54745,7 +54960,8 @@
54745
54960
  };
54746
54961
  const preProcessChartData = () => {
54747
54962
  if (isAdvancedWaterfall) {
54748
- const tempWaterfallChartData2 = mapAdvancedWaterfallData(data);
54963
+ let tempWaterfallChartData2 = mapAdvancedWaterfallData(data);
54964
+ tempWaterfallChartData2 = tempWaterfallChartData2.filter((d) => d.up + d.down + d.base != 0);
54749
54965
  chartJSON.dimensionList = tempWaterfallChartData2.map((d) => d.xKey);
54750
54966
  chartJSON.legendList = chartJSON.dimensionList;
54751
54967
  waterFallData = stack().keys(["base", "dimensionTotal", "up", "down"])(
@@ -55737,8 +55953,8 @@
55737
55953
  drawColumnChart();
55738
55954
  };
55739
55955
  const drawColumnChart = () => {
55740
- getChartType();
55741
55956
  initXaxisBar(formatOptions, gTag, xLabel, innerHeight2, innerWidth2, xAxis);
55957
+ getChartType();
55742
55958
  commonAnnotations(
55743
55959
  filteredData,
55744
55960
  yScaleLeft,