pace-chart-lib 1.0.35 → 1.0.38

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.
@@ -624,3 +624,4 @@ export declare const clamp: (v: any, a: any, b: any) => number;
624
624
  export declare const horizontalScrollBar: (seriesData: any, height: any, width: any, svg: any, margin: any, innerWidth: any, scrollbarVisible: any, visibleBars: any, chartJSON: any, scrollPosition: any, isStackedChart: any, setAndUpdateChartData: any, isBarChart?: boolean) => void;
625
625
  export declare function addTotalValue(totalValueMap: Map<string, number>, xScale: any, yScale: any, margin: TMargin, d3Annotation: any, oldAnnotationList: any[], formatOptions: TDefaultChartFormatOptionsType, chartType: string, height: number, width: number, svg: any, isReportEditable?: boolean, isBarChart?: boolean): void;
626
626
  export declare function createTotalMeasureValueMap(data: TData, totalValueMap: Map<string, number>, filteredDimension: string[]): void;
627
+ export declare function getVerticalGridLinesTickSize(formatOptions: TDefaultChartFormatOptionsType, innerHeight: number, dataTableHeight: number, shouldAdjustForAxisPosition?: boolean): number;
@@ -12682,7 +12682,7 @@ function initXaxis$1(gTag, chartJSON, xLabel, formatOptions, dataTableHeight, yS
12682
12682
  XaxisG.select(".domain").style("stroke", formatOptions.xAxisLabel.xAxisColor).attr(
12683
12683
  "stroke-width",
12684
12684
  formatOptions.xAxisLabel.xAxisWidth ? formatOptions.xAxisLabel.xAxisWidth : formatOptions.plotArea.plotAreaBorderThickness
12685
- ).style("shape-rendering", "crispEdges");
12685
+ ).style("shape-rendering", "crispEdges").raise();
12686
12686
  return gTag;
12687
12687
  } catch (error) {
12688
12688
  throw error;
@@ -12752,9 +12752,11 @@ const MONTH_NAMES = {
12752
12752
  ]
12753
12753
  };
12754
12754
  const getDateFromDimension = (dimension) => {
12755
- const utc_days = Math.floor(Number(dimension) - 25569);
12756
- const utc_value = utc_days * 86400;
12757
- const date2 = new Date(utc_value * 1e3);
12755
+ const serial = Number(dimension);
12756
+ if (!Number.isFinite(serial)) return null;
12757
+ const utcDays = Math.floor(serial - 25569);
12758
+ const date2 = new Date(utcDays * 86400 * 1e3);
12759
+ if (Number.isNaN(date2.getTime())) return null;
12758
12760
  return {
12759
12761
  day: date2.getUTCDate(),
12760
12762
  month: date2.getUTCMonth(),
@@ -12813,8 +12815,9 @@ const formatDate = (day, month, year, format2) => {
12813
12815
  const setDateFormats = (format2, dimensionmarks) => {
12814
12816
  try {
12815
12817
  return dimensionmarks.map((dim) => {
12816
- const { day, month, year } = getDateFromDimension(dim);
12817
- if (day == null || month == null || year == null) return dim;
12818
+ const date2 = getDateFromDimension(dim);
12819
+ if (!date2) return dim;
12820
+ const { day, month, year } = date2;
12818
12821
  return formatDate(day, month, year, format2);
12819
12822
  });
12820
12823
  } catch (error) {
@@ -13222,7 +13225,9 @@ function commonAnnotations(chartData, xScale, yScaleLeft, yScaleRight, margin, d
13222
13225
  responsiveXaxisLabel(dimensionList, innerWidth2).includes(d.Dimension) && !labelExcludeList.includes(d.Legend) && (d.Axis == axisTypes.primary ? yScaleLeft(d.Measure) <= innerHeight2 && yScaleLeft(d.Measure) >= 0 : yScaleRight(d.Measure) <= innerHeight2 && yScaleRight(d.Measure) >= 0) ? annotationsList.push(singleAnnotation) : null;
13223
13226
  }
13224
13227
  });
13225
- annotationsList = annotationsList.filter((d) => d.data.y.measure != 0);
13228
+ if (formatOptions.annotation.annotationHideZeroValues) {
13229
+ annotationsList = annotationsList.filter((d) => barChart ? d.data.x.measure != 0 : d.data.y.measure != 0);
13230
+ }
13226
13231
  if (oldAnnotationList.length === 0) {
13227
13232
  oldAnnotationList = annotationsList;
13228
13233
  oldMap = new Map(
@@ -13794,7 +13799,7 @@ function commonAnnotationsForCustomChart(chartData, xScale, yScaleLeft, yScaleRi
13794
13799
  }
13795
13800
  }
13796
13801
  }
13797
- finalAnnotationList.push(newAnnotation);
13802
+ newAnnotation.data.labelPosition != 4 && finalAnnotationList.push(newAnnotation);
13798
13803
  });
13799
13804
  makeAnnotations.editMode(formatOptions.annotation.annotationDraggable && isReportEditable).accessors({
13800
13805
  x: function(d) {
@@ -15046,7 +15051,7 @@ function stacklineAnnotations(chartData, xScale, yScaleLeft, yScaleRight, margin
15046
15051
  break;
15047
15052
  case "6":
15048
15053
  chartData.forEach((d) => {
15049
- let annotationVisibility = d[0].properties.annotation.toString();
15054
+ let annotationVisibility = d[0]?.properties?.annotation?.toString();
15050
15055
  switch (annotationVisibility) {
15051
15056
  case "1":
15052
15057
  for (let i = 0; i < chartData[0].length; i++) {
@@ -15260,15 +15265,24 @@ const appendAnnotations = (svg, formatOptions, margin, fontStyle, makeAnnotation
15260
15265
  const transform = select$2(this).attr("transform");
15261
15266
  const translateValues = transform.match(/translate\(([^,]+),([^,]+)\)/);
15262
15267
  if (translateValues) {
15263
- const currentX = parseFloat(translateValues[1]);
15268
+ const currentX = isBarChart ? 0 : parseFloat(translateValues[1]);
15264
15269
  return `translate(${currentX}, 0)`;
15265
15270
  }
15266
15271
  });
15267
15272
  annotations.selectAll("text").style(
15268
15273
  "text-anchor",
15269
15274
  (d) => isBarChart ? d.data.position == "2" ? "middle" : "start" : "start"
15270
- ).append("text").style("fill", formatOptions.annotation.annotationColor !== commonColors.white ? formatOptions.annotation.annotationColor : "none");
15271
- annotations.selectAll("tspan").attr("hoverId", (d) => d.data.hoverId ? d.data.hoverId : d.data.currentLegend.replaceAll(" ", "-")).style("visibility", (d) => (isBarChart ? parseFloat(d.data.x) == 0 : parseFloat(d.data.y) == 0) && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible");
15275
+ ).append("text").style(
15276
+ "fill",
15277
+ formatOptions.annotation.annotationColor !== commonColors.white ? formatOptions.annotation.annotationColor : "none"
15278
+ );
15279
+ annotations.selectAll("tspan").attr(
15280
+ "hoverId",
15281
+ (d) => d.data.hoverId ? d.data.hoverId : d.data.currentLegend.replaceAll(" ", "-")
15282
+ ).style(
15283
+ "visibility",
15284
+ (d) => parseFloat(d.data.y) == 0 && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible"
15285
+ );
15272
15286
  return annotations;
15273
15287
  };
15274
15288
  const initXaxisBar = (formatOptions, gTag, yLabel, innerHeight2, innerWidth2, xAxisBottom) => {
@@ -15743,6 +15757,13 @@ function createTotalMeasureValueMap(data, totalValueMap, filteredDimension) {
15743
15757
  });
15744
15758
  }
15745
15759
  }
15760
+ function getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight, shouldAdjustForAxisPosition = false) {
15761
+ const axisPositionMultiplier = shouldAdjustForAxisPosition ? formatOptions.xAxisLabel.xAxisPosition == "1" ? -1 : 1 : 1;
15762
+ const dataTableHeightIfPreset = dataTableHeight > 0 ? dataTableHeight : 0;
15763
+ const tickHeightPercentage = parseFloat(formatOptions.plotArea.ticksHeight) || 100;
15764
+ const actualTickHeight = (innerHeight2 - dataTableHeightIfPreset) * tickHeightPercentage / 100;
15765
+ return formatOptions.plotArea.gridLinesVisibility ? formatOptions.plotArea.gridLinesVertical ? -actualTickHeight * axisPositionMultiplier : 0 : 0;
15766
+ }
15746
15767
  const chartProperties = {
15747
15768
  color: "defaultColor",
15748
15769
  name: "",
@@ -17354,7 +17375,7 @@ const ColumnChart = ({
17354
17375
  const getXAxis = () => {
17355
17376
  let xaxisLabelPosition = parseInt(formatOptions.xAxisLabel.xAxisPosition);
17356
17377
  xAxis = (xaxisLabelPosition == 1 ? axisTop(xScale) : axisBottom(xScale)).tickSize(
17357
- 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
17378
+ getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight)
17358
17379
  ).tickSizeOuter(0).tickValues(responsiveXaxisLabel(filteredDimension, innerWidth2));
17359
17380
  };
17360
17381
  const getChartType = (lineData) => {
@@ -17835,7 +17856,7 @@ const CustomColumnChart = ({
17835
17856
  ...point2,
17836
17857
  type: series.properties.type,
17837
17858
  axis: series.properties.axis,
17838
- labelPosition: formatOptions?.annotation?.annotationPosition.toString() === "4" ? series.properties.dataLabelPosition.toString() : formatOptions?.annotation?.annotationPosition.toString(),
17859
+ labelPosition: formatOptions?.annotation?.annotationPosition.toString() === "4" ? series.properties.annotationPosition.toString() : formatOptions?.annotation?.annotationPosition.toString(),
17839
17860
  labelColor: series.properties.labelColor,
17840
17861
  legendUniqueId: series.properties.legendUniqueId
17841
17862
  };
@@ -18363,7 +18384,7 @@ const CustomColumnChart = ({
18363
18384
  (d) => `translate(${xScale(d.data.dimension) - columnWidth / 2},0)`
18364
18385
  ).merge(rects).attr(
18365
18386
  "hoverId",
18366
- (d) => d.key.includes("~$~") ? d.key.split("~$~")[1].replace(/ /g, "-") : d.key.replace(/ /g, "-")
18387
+ (d) => d.alias.includes("~$~") ? d.alias.split("~$~")[1].replace(/ /g, "-") : d.alias.replace(/ /g, "-")
18367
18388
  ).attr("x", (d) => xScaleForLegends(chartTypes.StackColumnChart)).attr(
18368
18389
  "y",
18369
18390
  (d) => d.data.axis === axisTypes.primary ? yScaleLeft(d[1]) : yScaleRight(d[1])
@@ -18550,6 +18571,7 @@ const CustomColumnChart = ({
18550
18571
  stackChartData.forEach((stackData, j) => {
18551
18572
  stackData.forEach((d) => {
18552
18573
  d["key"] = stackData.key;
18574
+ d["alias"] = requiredStackChatData.data[j].properties.alias;
18553
18575
  stackData["alias"] = requiredStackChatData.data[j].properties.alias;
18554
18576
  stackData["color"] = JSON.parse(
18555
18577
  JSON.stringify(requiredStackChatData.data[j].properties.color)
@@ -18557,7 +18579,7 @@ const CustomColumnChart = ({
18557
18579
  stackData["individualAnnotationVisibility"] = JSON.parse(
18558
18580
  JSON.stringify(requiredStackChatData.data[j].properties.annotation)
18559
18581
  );
18560
- d.data.labelPosition = formatOptions?.annotation?.annotationPosition.toString() === "4" ? requiredStackChatData.data[j].properties.dataLabelPosition.toString() : formatOptions?.annotation?.annotationPosition.toString();
18582
+ d.data.labelPosition = formatOptions?.annotation?.annotationPosition.toString() === "4" ? requiredStackChatData.data[j].properties.annotationPosition.toString() : formatOptions?.annotation?.annotationPosition.toString();
18561
18583
  d.data["labelColor"] = seriesColor == "2" ? JSON.parse(
18562
18584
  JSON.stringify(requiredStackChatData.data[j].properties.color)
18563
18585
  ) : JSON.parse(
@@ -19444,7 +19466,7 @@ const StackColumnChart = ({
19444
19466
  };
19445
19467
  const getXAxis = () => {
19446
19468
  xAxis = axisBottom(xScale).tickSize(
19447
- 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
19469
+ getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight, true)
19448
19470
  ).tickSizeOuter(0).tickValues(responsiveXaxisLabel(filteredDimension, innerWidth2));
19449
19471
  };
19450
19472
  const getChartType = (lineData) => {
@@ -21656,7 +21678,7 @@ const LineChart = ({
21656
21678
  chartJSON.chartData = allChartData;
21657
21679
  chartJSON.legendList = legendList;
21658
21680
  chartJSON.yMaxLeft = yMaxLeft;
21659
- chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
21681
+ chartJSON.yMinLeft = yMinLeft;
21660
21682
  chartJSON.yMaxRight = yMaxRight;
21661
21683
  chartJSON.yMinRight = yMinRight;
21662
21684
  formatedDimensionList = isDateType ? setDateFormats(
@@ -21690,7 +21712,7 @@ const LineChart = ({
21690
21712
  chartJSON.yMinLeft = yAxisLabelArray[0];
21691
21713
  {
21692
21714
  yScaleLeft = linear$1().domain([
21693
- chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : 0 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
21715
+ chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : chartJSON.yMinLeft * 0.9 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
21694
21716
  chartJSON.yMaxLeft <= 0 ? 0 : customYaxisMaxValue !== void 0 && !Number.isNaN(customYaxisMaxValue) ? customYaxisMaxValue : chartJSON.yMaxLeft * 1.1
21695
21717
  ]).range([
21696
21718
  dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2,
@@ -22500,6 +22522,7 @@ const StackLineChart = ({
22500
22522
  d["hideZero"] = JSON.parse(
22501
22523
  JSON.stringify(seriesData[j].properties.hideZeroValues)
22502
22524
  );
22525
+ d["properties"] = seriesData[j].properties;
22503
22526
  })
22504
22527
  );
22505
22528
  };
@@ -23022,6 +23045,7 @@ const NormalisedStackLineChart = ({
23022
23045
  d["hideZero"] = JSON.parse(
23023
23046
  JSON.stringify(seriesData[j].properties.hideZeroValues)
23024
23047
  );
23048
+ d["properties"] = seriesData[j].properties;
23025
23049
  })
23026
23050
  );
23027
23051
  };
@@ -25039,6 +25063,7 @@ const LayeredHorizontalBarChart = ({
25039
25063
  lData.data.forEach((cData) => {
25040
25064
  cData.hideZero = lData.properties.hideZeroValues;
25041
25065
  cData.axis = lData.properties.axis;
25066
+ cData["properties"] = lData.properties;
25042
25067
  });
25043
25068
  });
25044
25069
  lineData.forEach((data2, index2) => {
@@ -26367,23 +26392,6 @@ const AreaChart = ({
26367
26392
  const drawAreaChart = () => {
26368
26393
  getXScale();
26369
26394
  getXAxis();
26370
- initXaxis$1(
26371
- gTag,
26372
- chartJSON,
26373
- xLabel,
26374
- formatOptions,
26375
- dataTableHeight,
26376
- yScaleLeft,
26377
- xAxis,
26378
- dimensionHeightWidthArray,
26379
- height,
26380
- barWidth,
26381
- isDateType,
26382
- innerWidth2,
26383
- innerHeight2,
26384
- filteredDimension,
26385
- xScale
26386
- );
26387
26395
  commonAnnotations(
26388
26396
  seriesData,
26389
26397
  xScale,
@@ -26420,6 +26428,23 @@ const AreaChart = ({
26420
26428
  isSecondaryAxisDrawn
26421
26429
  ).labelArray;
26422
26430
  getChartType(filteredData);
26431
+ initXaxis$1(
26432
+ gTag,
26433
+ chartJSON,
26434
+ xLabel,
26435
+ formatOptions,
26436
+ dataTableHeight,
26437
+ yScaleLeft,
26438
+ xAxis,
26439
+ dimensionHeightWidthArray,
26440
+ height,
26441
+ barWidth,
26442
+ isDateType,
26443
+ innerWidth2,
26444
+ innerHeight2,
26445
+ filteredDimension,
26446
+ xScale
26447
+ );
26423
26448
  drawSeriesLabels(formatOptions, gTag, newSeriesLabelArray);
26424
26449
  if (formatOptions.dataTableProperties && formatOptions.dataTableProperties.dataTable) {
26425
26450
  if (formatOptions.xAxisLabel.xAxisPosition != "1")
@@ -26918,6 +26943,7 @@ const StackAreaChart = ({
26918
26943
  const drawLineChart = () => {
26919
26944
  getXScale();
26920
26945
  getXAxis();
26946
+ getChartType(filteredData);
26921
26947
  initXaxis$1(
26922
26948
  gTag,
26923
26949
  chartJSON,
@@ -26935,7 +26961,6 @@ const StackAreaChart = ({
26935
26961
  filteredDimension,
26936
26962
  xScale
26937
26963
  );
26938
- getChartType(filteredData);
26939
26964
  stacklineAnnotations(
26940
26965
  stackChartData,
26941
26966
  xScale,
@@ -27587,6 +27612,7 @@ const NormalizedStackAreaChart = ({
27587
27612
  d["hideZero"] = JSON.parse(
27588
27613
  JSON.stringify(seriesData[j].properties.hideZeroValues)
27589
27614
  );
27615
+ d["properties"] = seriesData[j].properties;
27590
27616
  })
27591
27617
  );
27592
27618
  };
@@ -54724,7 +54750,8 @@ const WaterfallChart = ({
54724
54750
  };
54725
54751
  const preProcessChartData = () => {
54726
54752
  if (isAdvancedWaterfall) {
54727
- const tempWaterfallChartData2 = mapAdvancedWaterfallData(data);
54753
+ let tempWaterfallChartData2 = mapAdvancedWaterfallData(data);
54754
+ tempWaterfallChartData2 = tempWaterfallChartData2.filter((d) => d.up + d.down + d.base != 0);
54728
54755
  chartJSON.dimensionList = tempWaterfallChartData2.map((d) => d.xKey);
54729
54756
  chartJSON.legendList = chartJSON.dimensionList;
54730
54757
  waterFallData = stack().keys(["base", "dimensionTotal", "up", "down"])(
@@ -12685,7 +12685,7 @@
12685
12685
  XaxisG.select(".domain").style("stroke", formatOptions.xAxisLabel.xAxisColor).attr(
12686
12686
  "stroke-width",
12687
12687
  formatOptions.xAxisLabel.xAxisWidth ? formatOptions.xAxisLabel.xAxisWidth : formatOptions.plotArea.plotAreaBorderThickness
12688
- ).style("shape-rendering", "crispEdges");
12688
+ ).style("shape-rendering", "crispEdges").raise();
12689
12689
  return gTag;
12690
12690
  } catch (error) {
12691
12691
  throw error;
@@ -12755,9 +12755,11 @@
12755
12755
  ]
12756
12756
  };
12757
12757
  const getDateFromDimension = (dimension) => {
12758
- const utc_days = Math.floor(Number(dimension) - 25569);
12759
- const utc_value = utc_days * 86400;
12760
- const date2 = new Date(utc_value * 1e3);
12758
+ const serial = Number(dimension);
12759
+ if (!Number.isFinite(serial)) return null;
12760
+ const utcDays = Math.floor(serial - 25569);
12761
+ const date2 = new Date(utcDays * 86400 * 1e3);
12762
+ if (Number.isNaN(date2.getTime())) return null;
12761
12763
  return {
12762
12764
  day: date2.getUTCDate(),
12763
12765
  month: date2.getUTCMonth(),
@@ -12816,8 +12818,9 @@
12816
12818
  const setDateFormats = (format2, dimensionmarks) => {
12817
12819
  try {
12818
12820
  return dimensionmarks.map((dim) => {
12819
- const { day, month, year } = getDateFromDimension(dim);
12820
- if (day == null || month == null || year == null) return dim;
12821
+ const date2 = getDateFromDimension(dim);
12822
+ if (!date2) return dim;
12823
+ const { day, month, year } = date2;
12821
12824
  return formatDate(day, month, year, format2);
12822
12825
  });
12823
12826
  } catch (error) {
@@ -13225,7 +13228,9 @@
13225
13228
  responsiveXaxisLabel(dimensionList, innerWidth2).includes(d.Dimension) && !labelExcludeList.includes(d.Legend) && (d.Axis == axisTypes.primary ? yScaleLeft(d.Measure) <= innerHeight2 && yScaleLeft(d.Measure) >= 0 : yScaleRight(d.Measure) <= innerHeight2 && yScaleRight(d.Measure) >= 0) ? annotationsList.push(singleAnnotation) : null;
13226
13229
  }
13227
13230
  });
13228
- annotationsList = annotationsList.filter((d) => d.data.y.measure != 0);
13231
+ if (formatOptions.annotation.annotationHideZeroValues) {
13232
+ annotationsList = annotationsList.filter((d) => barChart ? d.data.x.measure != 0 : d.data.y.measure != 0);
13233
+ }
13229
13234
  if (oldAnnotationList.length === 0) {
13230
13235
  oldAnnotationList = annotationsList;
13231
13236
  oldMap = new Map(
@@ -13797,7 +13802,7 @@
13797
13802
  }
13798
13803
  }
13799
13804
  }
13800
- finalAnnotationList.push(newAnnotation);
13805
+ newAnnotation.data.labelPosition != 4 && finalAnnotationList.push(newAnnotation);
13801
13806
  });
13802
13807
  makeAnnotations.editMode(formatOptions.annotation.annotationDraggable && isReportEditable).accessors({
13803
13808
  x: function(d) {
@@ -15049,7 +15054,7 @@
15049
15054
  break;
15050
15055
  case "6":
15051
15056
  chartData.forEach((d) => {
15052
- let annotationVisibility = d[0].properties.annotation.toString();
15057
+ let annotationVisibility = d[0]?.properties?.annotation?.toString();
15053
15058
  switch (annotationVisibility) {
15054
15059
  case "1":
15055
15060
  for (let i = 0; i < chartData[0].length; i++) {
@@ -15263,15 +15268,24 @@
15263
15268
  const transform = select$2(this).attr("transform");
15264
15269
  const translateValues = transform.match(/translate\(([^,]+),([^,]+)\)/);
15265
15270
  if (translateValues) {
15266
- const currentX = parseFloat(translateValues[1]);
15271
+ const currentX = isBarChart ? 0 : parseFloat(translateValues[1]);
15267
15272
  return `translate(${currentX}, 0)`;
15268
15273
  }
15269
15274
  });
15270
15275
  annotations.selectAll("text").style(
15271
15276
  "text-anchor",
15272
15277
  (d) => isBarChart ? d.data.position == "2" ? "middle" : "start" : "start"
15273
- ).append("text").style("fill", formatOptions.annotation.annotationColor !== commonColors.white ? formatOptions.annotation.annotationColor : "none");
15274
- annotations.selectAll("tspan").attr("hoverId", (d) => d.data.hoverId ? d.data.hoverId : d.data.currentLegend.replaceAll(" ", "-")).style("visibility", (d) => (isBarChart ? parseFloat(d.data.x) == 0 : parseFloat(d.data.y) == 0) && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible");
15278
+ ).append("text").style(
15279
+ "fill",
15280
+ formatOptions.annotation.annotationColor !== commonColors.white ? formatOptions.annotation.annotationColor : "none"
15281
+ );
15282
+ annotations.selectAll("tspan").attr(
15283
+ "hoverId",
15284
+ (d) => d.data.hoverId ? d.data.hoverId : d.data.currentLegend.replaceAll(" ", "-")
15285
+ ).style(
15286
+ "visibility",
15287
+ (d) => parseFloat(d.data.y) == 0 && formatOptions.annotation.annotationHideZeroValues ? "hidden" : "visible"
15288
+ );
15275
15289
  return annotations;
15276
15290
  };
15277
15291
  const initXaxisBar = (formatOptions, gTag, yLabel, innerHeight2, innerWidth2, xAxisBottom) => {
@@ -15746,6 +15760,13 @@
15746
15760
  });
15747
15761
  }
15748
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
+ }
15749
15770
  const chartProperties = {
15750
15771
  color: "defaultColor",
15751
15772
  name: "",
@@ -17357,7 +17378,7 @@
17357
17378
  const getXAxis = () => {
17358
17379
  let xaxisLabelPosition = parseInt(formatOptions.xAxisLabel.xAxisPosition);
17359
17380
  xAxis = (xaxisLabelPosition == 1 ? axisTop(xScale) : axisBottom(xScale)).tickSize(
17360
- 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
17381
+ getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight)
17361
17382
  ).tickSizeOuter(0).tickValues(responsiveXaxisLabel(filteredDimension, innerWidth2));
17362
17383
  };
17363
17384
  const getChartType = (lineData) => {
@@ -17838,7 +17859,7 @@
17838
17859
  ...point2,
17839
17860
  type: series.properties.type,
17840
17861
  axis: series.properties.axis,
17841
- labelPosition: formatOptions?.annotation?.annotationPosition.toString() === "4" ? series.properties.dataLabelPosition.toString() : formatOptions?.annotation?.annotationPosition.toString(),
17862
+ labelPosition: formatOptions?.annotation?.annotationPosition.toString() === "4" ? series.properties.annotationPosition.toString() : formatOptions?.annotation?.annotationPosition.toString(),
17842
17863
  labelColor: series.properties.labelColor,
17843
17864
  legendUniqueId: series.properties.legendUniqueId
17844
17865
  };
@@ -18366,7 +18387,7 @@
18366
18387
  (d) => `translate(${xScale(d.data.dimension) - columnWidth / 2},0)`
18367
18388
  ).merge(rects).attr(
18368
18389
  "hoverId",
18369
- (d) => d.key.includes("~$~") ? d.key.split("~$~")[1].replace(/ /g, "-") : d.key.replace(/ /g, "-")
18390
+ (d) => d.alias.includes("~$~") ? d.alias.split("~$~")[1].replace(/ /g, "-") : d.alias.replace(/ /g, "-")
18370
18391
  ).attr("x", (d) => xScaleForLegends(chartTypes.StackColumnChart)).attr(
18371
18392
  "y",
18372
18393
  (d) => d.data.axis === axisTypes.primary ? yScaleLeft(d[1]) : yScaleRight(d[1])
@@ -18553,6 +18574,7 @@
18553
18574
  stackChartData.forEach((stackData, j) => {
18554
18575
  stackData.forEach((d) => {
18555
18576
  d["key"] = stackData.key;
18577
+ d["alias"] = requiredStackChatData.data[j].properties.alias;
18556
18578
  stackData["alias"] = requiredStackChatData.data[j].properties.alias;
18557
18579
  stackData["color"] = JSON.parse(
18558
18580
  JSON.stringify(requiredStackChatData.data[j].properties.color)
@@ -18560,7 +18582,7 @@
18560
18582
  stackData["individualAnnotationVisibility"] = JSON.parse(
18561
18583
  JSON.stringify(requiredStackChatData.data[j].properties.annotation)
18562
18584
  );
18563
- d.data.labelPosition = formatOptions?.annotation?.annotationPosition.toString() === "4" ? requiredStackChatData.data[j].properties.dataLabelPosition.toString() : formatOptions?.annotation?.annotationPosition.toString();
18585
+ d.data.labelPosition = formatOptions?.annotation?.annotationPosition.toString() === "4" ? requiredStackChatData.data[j].properties.annotationPosition.toString() : formatOptions?.annotation?.annotationPosition.toString();
18564
18586
  d.data["labelColor"] = seriesColor == "2" ? JSON.parse(
18565
18587
  JSON.stringify(requiredStackChatData.data[j].properties.color)
18566
18588
  ) : JSON.parse(
@@ -19447,7 +19469,7 @@
19447
19469
  };
19448
19470
  const getXAxis = () => {
19449
19471
  xAxis = axisBottom(xScale).tickSize(
19450
- 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
19472
+ getVerticalGridLinesTickSize(formatOptions, innerHeight2, dataTableHeight, true)
19451
19473
  ).tickSizeOuter(0).tickValues(responsiveXaxisLabel(filteredDimension, innerWidth2));
19452
19474
  };
19453
19475
  const getChartType = (lineData) => {
@@ -21659,7 +21681,7 @@
21659
21681
  chartJSON.chartData = allChartData;
21660
21682
  chartJSON.legendList = legendList;
21661
21683
  chartJSON.yMaxLeft = yMaxLeft;
21662
- chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
21684
+ chartJSON.yMinLeft = yMinLeft;
21663
21685
  chartJSON.yMaxRight = yMaxRight;
21664
21686
  chartJSON.yMinRight = yMinRight;
21665
21687
  formatedDimensionList = isDateType ? setDateFormats(
@@ -21693,7 +21715,7 @@
21693
21715
  chartJSON.yMinLeft = yAxisLabelArray[0];
21694
21716
  {
21695
21717
  yScaleLeft = linear$1().domain([
21696
- chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : 0 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
21718
+ chartJSON.yMinLeft >= 0 ? customYaxisMinValue !== void 0 && !Number.isNaN(customYaxisMinValue) ? customYaxisMinValue : chartJSON.yMinLeft * 0.9 : chartJSON.yMinLeft < 0 ? chartJSON.yMinLeft * 1.1 : chartJSON.yMinLeft * 0.9,
21697
21719
  chartJSON.yMaxLeft <= 0 ? 0 : customYaxisMaxValue !== void 0 && !Number.isNaN(customYaxisMaxValue) ? customYaxisMaxValue : chartJSON.yMaxLeft * 1.1
21698
21720
  ]).range([
21699
21721
  dataTableHeight > 0 ? innerHeight2 - dataTableHeight : innerHeight2,
@@ -22503,6 +22525,7 @@
22503
22525
  d["hideZero"] = JSON.parse(
22504
22526
  JSON.stringify(seriesData[j].properties.hideZeroValues)
22505
22527
  );
22528
+ d["properties"] = seriesData[j].properties;
22506
22529
  })
22507
22530
  );
22508
22531
  };
@@ -23025,6 +23048,7 @@
23025
23048
  d["hideZero"] = JSON.parse(
23026
23049
  JSON.stringify(seriesData[j].properties.hideZeroValues)
23027
23050
  );
23051
+ d["properties"] = seriesData[j].properties;
23028
23052
  })
23029
23053
  );
23030
23054
  };
@@ -25042,6 +25066,7 @@
25042
25066
  lData.data.forEach((cData) => {
25043
25067
  cData.hideZero = lData.properties.hideZeroValues;
25044
25068
  cData.axis = lData.properties.axis;
25069
+ cData["properties"] = lData.properties;
25045
25070
  });
25046
25071
  });
25047
25072
  lineData.forEach((data2, index2) => {
@@ -26370,23 +26395,6 @@
26370
26395
  const drawAreaChart = () => {
26371
26396
  getXScale();
26372
26397
  getXAxis();
26373
- initXaxis$1(
26374
- gTag,
26375
- chartJSON,
26376
- xLabel,
26377
- formatOptions,
26378
- dataTableHeight,
26379
- yScaleLeft,
26380
- xAxis,
26381
- dimensionHeightWidthArray,
26382
- height,
26383
- barWidth,
26384
- isDateType,
26385
- innerWidth2,
26386
- innerHeight2,
26387
- filteredDimension,
26388
- xScale
26389
- );
26390
26398
  commonAnnotations(
26391
26399
  seriesData,
26392
26400
  xScale,
@@ -26423,6 +26431,23 @@
26423
26431
  isSecondaryAxisDrawn
26424
26432
  ).labelArray;
26425
26433
  getChartType(filteredData);
26434
+ initXaxis$1(
26435
+ gTag,
26436
+ chartJSON,
26437
+ xLabel,
26438
+ formatOptions,
26439
+ dataTableHeight,
26440
+ yScaleLeft,
26441
+ xAxis,
26442
+ dimensionHeightWidthArray,
26443
+ height,
26444
+ barWidth,
26445
+ isDateType,
26446
+ innerWidth2,
26447
+ innerHeight2,
26448
+ filteredDimension,
26449
+ xScale
26450
+ );
26426
26451
  drawSeriesLabels(formatOptions, gTag, newSeriesLabelArray);
26427
26452
  if (formatOptions.dataTableProperties && formatOptions.dataTableProperties.dataTable) {
26428
26453
  if (formatOptions.xAxisLabel.xAxisPosition != "1")
@@ -26921,6 +26946,7 @@
26921
26946
  const drawLineChart = () => {
26922
26947
  getXScale();
26923
26948
  getXAxis();
26949
+ getChartType(filteredData);
26924
26950
  initXaxis$1(
26925
26951
  gTag,
26926
26952
  chartJSON,
@@ -26938,7 +26964,6 @@
26938
26964
  filteredDimension,
26939
26965
  xScale
26940
26966
  );
26941
- getChartType(filteredData);
26942
26967
  stacklineAnnotations(
26943
26968
  stackChartData,
26944
26969
  xScale,
@@ -27590,6 +27615,7 @@
27590
27615
  d["hideZero"] = JSON.parse(
27591
27616
  JSON.stringify(seriesData[j].properties.hideZeroValues)
27592
27617
  );
27618
+ d["properties"] = seriesData[j].properties;
27593
27619
  })
27594
27620
  );
27595
27621
  };
@@ -54727,7 +54753,8 @@
54727
54753
  };
54728
54754
  const preProcessChartData = () => {
54729
54755
  if (isAdvancedWaterfall) {
54730
- const tempWaterfallChartData2 = mapAdvancedWaterfallData(data);
54756
+ let tempWaterfallChartData2 = mapAdvancedWaterfallData(data);
54757
+ tempWaterfallChartData2 = tempWaterfallChartData2.filter((d) => d.up + d.down + d.base != 0);
54731
54758
  chartJSON.dimensionList = tempWaterfallChartData2.map((d) => d.xKey);
54732
54759
  chartJSON.legendList = chartJSON.dimensionList;
54733
54760
  waterFallData = stack().keys(["base", "dimensionTotal", "up", "down"])(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pace-chart-lib",
3
- "version": "1.0.35",
3
+ "version": "1.0.38",
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",