pace-chart-lib 1.0.38 → 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
  }
@@ -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) => barChart ? d.data.x.measure != 0 : 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
  };
@@ -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
  };
@@ -17349,6 +17349,12 @@
17349
17349
  ).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
17350
17350
  }
17351
17351
  if (isSecondaryAxisDrawn) {
17352
+ let seondaryResponsiveLablesObj = responsiveSecondaryYaxisLabel(
17353
+ secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : yScaleRight.domain()[1],
17354
+ yScaleRight.domain()[0],
17355
+ formatOptions,
17356
+ innerHeight2
17357
+ );
17352
17358
  yAxisRight = axisRight(yScaleRight).tickFormat(
17353
17359
  (d) => getNumberWithFormat(
17354
17360
  d,
@@ -17357,19 +17363,9 @@
17357
17363
  formatOptions.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision
17358
17364
  )
17359
17365
  ).tickValues(
17360
- responsiveSecondaryYaxisLabel(
17361
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
17362
- chartJSON.yMinRight,
17363
- formatOptions,
17364
- chartJSON
17365
- ).secondaryYAxisLabelArray
17366
+ seondaryResponsiveLablesObj.autoLabelFlag ? void 0 : seondaryResponsiveLablesObj.secondaryYAxisLabelArray
17366
17367
  ).ticks(
17367
- responsiveSecondaryYaxisLabel(
17368
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
17369
- chartJSON.yMinRight,
17370
- formatOptions,
17371
- chartJSON
17372
- ).secondaryCustomTickValue ?? innerHeight2 / 30
17368
+ seondaryResponsiveLablesObj.secondaryCustomTickValue ?? innerHeight2 / 30
17373
17369
  ).tickSize(
17374
17370
  formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 : 0 : 0
17375
17371
  ).tickPadding(8).tickSizeOuter(0);
@@ -18012,7 +18008,7 @@
18012
18008
  secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
18013
18009
  secondaryCustomYaxisMinValue ? secondaryCustomYaxisMinValue : chartJSON.yMinRight,
18014
18010
  formatOptions,
18015
- chartJSON
18011
+ innerHeight2
18016
18012
  ).secondaryYAxisLabelArray;
18017
18013
  chartJSON.yMaxRight = secondaryYAxisLabelArray[secondaryYAxisLabelArray.length - 1];
18018
18014
  chartJSON.yMinRight = secondaryYAxisLabelArray[0];
@@ -20894,6 +20890,137 @@
20894
20890
  logError$1(fileName$a, "initXaxis", error);
20895
20891
  }
20896
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
+ };
20897
21024
  const setnumberOfBubbles = (svg, legendPosition, chartFormatOptions, height, width, margins, innnerHeight, xTitleHeight, XLabelHeight, bubbleCount) => {
20898
21025
  try {
20899
21026
  if (chartFormatOptions.plotArea.numberOfBubbles) {
@@ -21612,17 +21739,19 @@
21612
21739
  yTitle,
21613
21740
  yLabel
21614
21741
  );
21615
- yAxistitleRight(
21616
- svg,
21617
- isSecondaryAxisDrawn,
21618
- margin,
21619
- formatOptions,
21620
- dataTableHeight,
21621
- innerHeight2,
21622
- innerWidth2,
21623
- secondaryYLabel,
21624
- secondaryAxisTitleWidth
21625
- );
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
+ }
21626
21755
  setChartTitle(svg, formatOptions, width, chartTitleHeight);
21627
21756
  drawLegends(
21628
21757
  height,
@@ -21781,10 +21910,10 @@
21781
21910
  }
21782
21911
  if (isSecondaryAxisDrawn) {
21783
21912
  let responsiveSecondaryLablesObj = responsiveSecondaryYaxisLabel(
21784
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
21785
- chartJSON.yMinRight,
21913
+ secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : yScaleRight.domain()[1],
21914
+ yScaleRight.domain()[0],
21786
21915
  formatOptions,
21787
- chartJSON
21916
+ innerHeight2
21788
21917
  );
21789
21918
  yAxisRight = axisRight(yScaleRight).tickFormat(
21790
21919
  (d) => getNumberWithFormat(
@@ -23216,7 +23345,7 @@
23216
23345
  xAxisBottom
23217
23346
  );
23218
23347
  if (isSecondaryAxisDrawn) {
23219
- initXaxisTop(formatOptions, gTag, secondaryYLabel, xAxisTop);
23348
+ initXaxisTop(formatOptions, gTag, secondaryYLabel, xAxisTop, innerWidth2);
23220
23349
  }
23221
23350
  setXaxistitle$1(
23222
23351
  formatOptions,
@@ -23242,7 +23371,7 @@
23242
23371
  yLabel,
23243
23372
  innerWidth2
23244
23373
  );
23245
- yAxistitleRight(
23374
+ formatOptions.xAxisLabel.xAxisPosition == "2" && yAxistitleRight(
23246
23375
  svg,
23247
23376
  isSecondaryAxisDrawn,
23248
23377
  margin,
@@ -23391,10 +23520,10 @@
23391
23520
  }
23392
23521
  if (isSecondaryAxisDrawn) {
23393
23522
  let responsiveSecondaryLablesObj = responsiveSecondaryYaxisLabel(
23394
- secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : chartJSON.yMaxRight,
23395
- chartJSON.yMinRight,
23523
+ secondaryCustomYaxisMaxValue ? secondaryCustomYaxisMaxValue : xScaleTop.domain()[1],
23524
+ xScaleTop.domain()[0],
23396
23525
  formatOptions,
23397
- chartJSON
23526
+ innerWidth2
23398
23527
  );
23399
23528
  xAxisTop = axisTop(xScaleTop).tickFormat(
23400
23529
  (d) => getNumberWithFormat(
@@ -23406,7 +23535,7 @@
23406
23535
  ).tickValues(
23407
23536
  responsiveSecondaryLablesObj.autoLabelFlag ? void 0 : responsiveSecondaryLablesObj.secondaryYAxisLabelArray
23408
23537
  ).ticks(responsiveSecondaryLablesObj.secondaryCustomTickValue).tickSize(
23409
- formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerWidth2 : 0 : 0
23538
+ formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesHorizontal ? -innerHeight2 : 0 : 0
23410
23539
  ).tickPadding(8).tickSizeOuter(0);
23411
23540
  }
23412
23541
  };
@@ -23456,10 +23585,10 @@
23456
23585
  return d.value >= 0 ? xScaleUsed(0) : xScaleUsed(0);
23457
23586
  }).attr("width", 0).attr("fill", data2.properties.color).attr(
23458
23587
  "stroke-dasharray",
23459
- (d) => d.stackBorderStyle === 2 ? "5,3" : "0"
23460
- ).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(
23461
23590
  "stroke",
23462
- (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"
23463
23592
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
23464
23593
  "visibility",
23465
23594
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -23550,7 +23679,8 @@
23550
23679
  width,
23551
23680
  dimensionHeightWidthArray,
23552
23681
  columnWidth,
23553
- yScale
23682
+ yScale,
23683
+ secondaryYLabel
23554
23684
  );
23555
23685
  getChartType(filteredData);
23556
23686
  commonAnnotations(
@@ -24460,7 +24590,7 @@
24460
24590
  margin,
24461
24591
  yTitle,
24462
24592
  yLabel,
24463
- void 0
24593
+ innerWidth2
24464
24594
  );
24465
24595
  setChartTitle(svg, formatOptions, width, chartTitleHeight);
24466
24596
  drawLegends(
@@ -25970,7 +26100,7 @@
25970
26100
  );
25971
26101
  const dimensionList = data.DimensionList;
25972
26102
  const barChart = false;
25973
- const isSecondaryAxisDrawn = false;
26103
+ let isSecondaryAxisDrawn = false;
25974
26104
  const isNormalizedChart = false;
25975
26105
  let customYaxisMinValue = formatOptions.yAxisLabel.yAxisIntervalsVisibility ? parseFloat(formatOptions.yAxisLabel.yAxisMinText) : void 0;
25976
26106
  let customYaxisMaxValue = formatOptions.yAxisLabel.yAxisIntervalsVisibility ? parseFloat(formatOptions.yAxisLabel.yAxisMaxText) : void 0;
@@ -26001,11 +26131,13 @@
26001
26131
  let svg;
26002
26132
  let gTag;
26003
26133
  let yScaleLeft;
26134
+ let yScaleRight;
26004
26135
  let xScale;
26005
26136
  let calculatedRange;
26006
26137
  let seriesLabelWidth;
26007
26138
  let yAxisLeft;
26008
26139
  let xAxis;
26140
+ let yAxisRight;
26009
26141
  let filteredDimension;
26010
26142
  let filteredData = [];
26011
26143
  let scrollPosition = 0;
@@ -26113,6 +26245,17 @@
26113
26245
  yAxisLeft,
26114
26246
  innerHeight2
26115
26247
  );
26248
+ if (isSecondaryAxisDrawn) {
26249
+ initYaxisRight(
26250
+ gTag,
26251
+ formatOptions,
26252
+ dataTableHeight,
26253
+ secondaryYLabel,
26254
+ yAxisRight,
26255
+ innerHeight2,
26256
+ innerWidth2
26257
+ );
26258
+ }
26116
26259
  setXaxistitle$1(
26117
26260
  formatOptions,
26118
26261
  barChart,
@@ -26195,7 +26338,11 @@
26195
26338
  );
26196
26339
  series.data.forEach((point2) => {
26197
26340
  allChartData.push(point2);
26198
- {
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 {
26199
26346
  yMaxLeft = Math.max(yMaxLeft, point2.value);
26200
26347
  yMinLeft = Math.min(yMinLeft, point2.value);
26201
26348
  }
@@ -26245,6 +26392,15 @@
26245
26392
  0
26246
26393
  ]);
26247
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
+ }
26248
26404
  calculatedRange = [0, innerWidth2];
26249
26405
  if (formatOptions.seriesLabel.seriesLabelVisibility) {
26250
26406
  let labelObj = prepareDataForSeriesLabel(
@@ -26290,6 +26446,28 @@
26290
26446
  responsiveLablesObj.autoLabelFlag ? void 0 : responsiveLablesObj.yAxisLabelArray
26291
26447
  ).ticks(responsiveLablesObj.customTickValue).tickPadding(8).tickSizeOuter(0);
26292
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
+ }
26293
26471
  };
26294
26472
  const getXAxis = () => {
26295
26473
  xAxis = axisBottom(xScale).tickSize(
@@ -26306,7 +26484,7 @@
26306
26484
  });
26307
26485
  const areaGenerator = area().x(
26308
26486
  (d) => xScale(d.dimension) ? xScale(d.dimension) : null
26309
- ).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));
26310
26488
  const areaGeneratorStart = area().x(
26311
26489
  (d) => xScale(d.dimension) ? xScale(d.dimension) : null
26312
26490
  ).y0(() => yScaleLeft(0)).y1(() => yScaleLeft(0)).defined((d) => d.hideZero ? Boolean(d.value) : true).curve(getCurveType(formatOptions));
@@ -26370,7 +26548,7 @@
26370
26548
  chartType,
26371
26549
  xScale,
26372
26550
  yScaleLeft,
26373
- void 0,
26551
+ yScaleRight,
26374
26552
  null,
26375
26553
  formatOptions,
26376
26554
  chartJSON,
@@ -26399,8 +26577,7 @@
26399
26577
  seriesData,
26400
26578
  xScale,
26401
26579
  yScaleLeft,
26402
- void 0,
26403
- // need to pass secondary axis scale if secondary axis is drawn
26580
+ yScaleRight,
26404
26581
  margin,
26405
26582
  d3Annotation,
26406
26583
  [],
@@ -27791,7 +27968,22 @@
27791
27968
  );
27792
27969
  initPieChartData();
27793
27970
  drawPieChart();
27794
- 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
+ }
27795
27987
  drawTotalValue(
27796
27988
  chartFormatOptions,
27797
27989
  pieTotalValue,
@@ -27945,7 +28137,7 @@
27945
28137
  (d) => getDataLabelTransformString(d, isSingleDataLabel)
27946
28138
  ).attr(
27947
28139
  "visibility",
27948
- (d) => d.endAngle - d.startAngle < 0.17 ? "hidden" : "visible"
28140
+ (d) => d.endAngle - d.startAngle < 0.09 && formatOptions.plotArea.hideInsignificantValue ? "hidden" : "visible"
27949
28141
  ).attr("dy", "-0.35em").attr("text-anchor", "middle").attr("alignment-baseline", "middle").text((d) => {
27950
28142
  const { plotArea } = chartFormatOptions;
27951
28143
  if (plotArea.dataLabelName) {
@@ -28186,7 +28378,22 @@
28186
28378
  );
28187
28379
  initPieChartData();
28188
28380
  drawDonutChart();
28189
- 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
+ }
28190
28397
  drawTotalValue2();
28191
28398
  };
28192
28399
  const loopOverSeriesData = () => {
@@ -30283,7 +30490,7 @@
30283
30490
  "font-family",
30284
30491
  chartFormatOptions.pointerValue.pointerValueFontFamily
30285
30492
  ).text(
30286
- (d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias || d != 0 ? getNumberWithFormatFunction(
30493
+ (d) => `${KPIName}: ${!chartFormatOptions.pointerValue.pointerValueAlias && d != 0 ? getNumberWithFormatFunction(
30287
30494
  "None",
30288
30495
  chartFormatOptions.pointerValue.pointerValueNumberFormat,
30289
30496
  chartFormatOptions.pointerValue.pointerValueDecimalPrecision
@@ -55746,8 +55953,8 @@
55746
55953
  drawColumnChart();
55747
55954
  };
55748
55955
  const drawColumnChart = () => {
55749
- getChartType();
55750
55956
  initXaxisBar(formatOptions, gTag, xLabel, innerHeight2, innerWidth2, xAxis);
55957
+ getChartType();
55751
55958
  commonAnnotations(
55752
55959
  filteredData,
55753
55960
  yScaleLeft,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pace-chart-lib",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "A simple React + Vite + TS UI library with a Button using custom fonts via SCSS.",
5
5
  "license": "MIT",
6
6
  "type": "module",