pace-chart-lib 1.0.29 → 1.0.30

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.
@@ -566,6 +566,7 @@ export declare const defaultChartFormatOptions: {
566
566
  dataTableDecimalPrecision: string;
567
567
  dataTableDisplayUnits: string;
568
568
  dataTableLabelColor: commonColors;
569
+ dataTableAxisLabel: boolean;
569
570
  };
570
571
  dataTableOuterBorder: {
571
572
  borderButtonVisibility: boolean;
@@ -11443,7 +11443,8 @@ const defaultChartFormatOptions = {
11443
11443
  dataTableNumberFormat: ",",
11444
11444
  dataTableDecimalPrecision: "2",
11445
11445
  dataTableDisplayUnits: "None",
11446
- dataTableLabelColor: commonColors.black
11446
+ dataTableLabelColor: commonColors.black,
11447
+ dataTableAxisLabel: true
11447
11448
  },
11448
11449
  dataTableOuterBorder: {
11449
11450
  borderButtonVisibility: true,
@@ -11784,7 +11785,7 @@ function calculateVerticalMargins(windowWidth, windowHeight, maxNumberForPrimary
11784
11785
  bottom2 = xAxisRelatedMargin + 5 + scrollHeightConstant;
11785
11786
  break;
11786
11787
  case staticLegendPosition.bottom:
11787
- bottom2 = 40 + xAxisRelatedMargin + scrollHeightConstant;
11788
+ bottom2 = 30 + xAxisRelatedMargin + scrollHeightConstant;
11788
11789
  top2 = metrics.chartTitleHeight + 5 + (isNormalizedChart ? 12 : 0);
11789
11790
  break;
11790
11791
  case staticLegendPosition.left:
@@ -13744,7 +13745,7 @@ const dataTablePreCalculation = (formatOptions, yLabel, yTitle, seriesData, dime
13744
13745
  let dataTableHeight = 20;
13745
13746
  if (formatOptions.dataTableProperties && formatOptions.dataTableProperties.dataTable) {
13746
13747
  formatOptions.xAxisLabel.xAxisLabelVisibility = false;
13747
- let exactAvailableWidth = yLabel + yTitle - 36;
13748
+ let exactAvailableWidth = yLabel + yTitle;
13748
13749
  seriesData.forEach((data, i) => {
13749
13750
  let tempObj = {
13750
13751
  "data": data.data.filter((data2) => dimensionList.includes(data2.dimension)),
@@ -13836,14 +13837,14 @@ function addDataTable(isFitChart, svg, currentTag, dataTable, colWidth, yAxis, x
13836
13837
  selectAll("#dataTableG" + chartId).remove();
13837
13838
  let tag = currentTag.append("g").attr("id", "dataTableG" + chartId);
13838
13839
  dataTable.forEach((data, i) => {
13839
- yCordinate = yCordinate + cellHeight;
13840
+ yCordinate = yCordinate + (!formatOptions.dataTableProperties.dataTableAxisLabel && i === 0 ? 0 : cellHeight);
13840
13841
  cellHeight = data.properties.height;
13841
13842
  getLegendsAppended(tag, i, data, cellHeight);
13842
13843
  let parentTag = tag.append("g").attr("class", "dataTableBorder").selectAll("#scaling-svg" + chartId + " .foreignObject").data((d, pos) => data["data"]).enter().filter((d) => xAxis(d.dimension)).append("g").attr("fill", commonColors.transparent).attr(
13843
13844
  "transform",
13844
13845
  (d, index2) => `translate(${index2 === 0 ? 0 : xAxis(d.dimension) - cellWidth / 2},0)`
13845
13846
  );
13846
- if (i == 0) {
13847
+ if (i == 0 && formatOptions.dataTableProperties.dataTableAxisLabel) {
13847
13848
  parentTag.append("foreignObject").attr("class", "dataTableColHeaders").attr("x", 0).attr("y", tableStartY).attr("id", (d, index2) => index2).attr("width", (d, index2) => index2 === 0 ? cellWidth + outerPadding + calWidthForSeriesNames / 2 : index2 === dimensionCount - 1 ? cellWidth + outerPadding - calWidthForSeriesNames / 2 : cellWidth).attr("height", "20px").append("xhtml:div").style("width", (d, index2) => index2 === 0 ? cellWidth + outerPadding + calWidthForSeriesNames / 2 : index2 === dimensionCount - 1 ? cellWidth + outerPadding - calWidthForSeriesNames / 2 : cellWidth).style("height", `${20}px`).style("border-width", (d, index2) => getBorderStyle(formatOptions, index2, void 0, dimensionCount, legendsCount, "width", "colHeaders")).style("border-style", (d, index2) => getBorderStyle(formatOptions, index2, void 0, dimensionCount, legendsCount, "style", "colHeaders")).style("border-color", (d, index2) => getBorderStyle(formatOptions, index2, void 0, dimensionCount, legendsCount, "color", "colHeaders")).style("text-align", "center").style("white-space", "nowrap").style("text-overflow", "ellipsis").style("overflow", "hidden").style("padding-left", "3px").style("font-size", formatOptions.dataTableProperties.dataTableFontSize + "px").style("font-family", formatOptions.dataTableProperties.dataTableFontFamily).style("font-style", fontStyle.includes("Italic") ? "Italic" : "").style(
13848
13849
  "text-decoration",
13849
13850
  fontStyle.includes("Underline") ? "Underline" : ""
@@ -15434,7 +15435,7 @@ function drawLegends(height, svg, maxLegendDimensions, chartTitleHeight, width,
15434
15435
  svg,
15435
15436
  seriesData,
15436
15437
  7,
15437
- height - 25,
15438
+ height - 35,
15438
15439
  width - 10,
15439
15440
  30,
15440
15441
  position,
@@ -16911,10 +16912,10 @@ const ColumnChart = ({
16911
16912
  return yScale(0);
16912
16913
  }).attr("height", 0).attr("fill", data2.properties.color).attr(
16913
16914
  "stroke-dasharray",
16914
- (d) => d.stackBorderStyle === 2 ? "5,3" : "0"
16915
- ).attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
16915
+ (d) => data2.properties.stackBorderStyle == 2 ? "5,3" : "0"
16916
+ ).attr("stroke-width", (d) => `${data2.properties.stackBorderWidth}px`).attr(
16916
16917
  "stroke",
16917
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
16918
+ (d) => data2.properties.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderColor : "none"
16918
16919
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
16919
16920
  "visibility",
16920
16921
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -17622,9 +17623,9 @@ const CustomColumnChart = ({
17622
17623
  }).attr("height", (d) => {
17623
17624
  const yScale = data2.properties.axis === axisTypes.primary ? yScaleLeft : yScaleRight;
17624
17625
  return Math.abs(yScale(d.value) - yScale(0));
17625
- }).attr("fill", data2.properties.color).attr("stroke-dasharray", (d) => d.stackBorderStyle === 2 ? "5,3" : "0").attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
17626
+ }).attr("fill", data2.properties.color).attr("stroke-dasharray", (d) => data2.properties.stackBorderStyle == 2 ? "5,3" : "0").attr("stroke-width", (d) => `${data2.properties.stackBorderWidth}px`).attr(
17626
17627
  "stroke",
17627
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
17628
+ (d) => data2.properties.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderColor : "none"
17628
17629
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
17629
17630
  "visibility",
17630
17631
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -17886,12 +17887,12 @@ const CustomColumnChart = ({
17886
17887
  (sdata) => sdata.legend === d.key
17887
17888
  );
17888
17889
  const props = seriesData[seriesIndex]?.properties;
17889
- return props?.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
17890
+ return props?.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
17890
17891
  }).attr("stroke-dasharray", (d, i, nodes) => {
17891
17892
  const seriesIndex = Array.from(seriesData).findIndex(
17892
17893
  (sdata) => sdata.legend === d.key
17893
17894
  );
17894
- return seriesData[seriesIndex]?.properties.stackBorderStyle === 2 ? "5,3" : "0";
17895
+ return seriesData[seriesIndex]?.properties.stackBorderStyle == 2 ? "5,3" : "0";
17895
17896
  }).attr("stroke-width", (d, i, nodes) => {
17896
17897
  const seriesIndex = Array.from(seriesData).findIndex(
17897
17898
  (sdata) => sdata.legend === d.key
@@ -18495,10 +18496,10 @@ const LayeredColumnChart = ({
18495
18496
  return Math.abs(yScale(d.value) - yScale(0));
18496
18497
  }).attr("fill", data2.properties.color).attr(
18497
18498
  "stroke-dasharray",
18498
- (d) => d.stackBorderStyle === 2 ? "5,3" : "0"
18499
- ).attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
18499
+ (d) => data2.properties.stackBorderStyle == 2 ? "5,3" : "0"
18500
+ ).attr("stroke-width", () => `${data2.properties.stackBorderWidth}px`).attr(
18500
18501
  "stroke",
18501
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
18502
+ () => data2.properties.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderColor : "none"
18502
18503
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr("opacity", 0.7).attr(
18503
18504
  "visibility",
18504
18505
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -18978,16 +18979,16 @@ const StackColumnChart = ({
18978
18979
  return props?.color || "gray";
18979
18980
  }).attr("stroke", (d, i, nodes) => {
18980
18981
  const { props } = getPropsForRect(nodes, i);
18981
- return props?.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
18982
+ return props?.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
18982
18983
  }).attr("stroke-dasharray", (d, i, nodes) => {
18983
18984
  const { props } = getPropsForRect(nodes, i);
18984
- return props?.stackBorderStyle === 2 ? "5,3" : "0";
18985
+ return props?.stackBorderStyle == 2 ? "5,3" : "0";
18985
18986
  }).attr("stroke-width", (d, i, nodes) => {
18986
18987
  const { props } = getPropsForRect(nodes, i);
18987
18988
  return (props?.stackBorderWidth || 0) + "px";
18988
18989
  }).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr("visibility", (d, i, nodes) => {
18989
18990
  const { props } = getPropsForRect(nodes, i);
18990
- return d.data[d.key] === 0 && props?.hideZeroValues ? "hidden" : "visible";
18991
+ return d.data[d.key] == 0 && props?.hideZeroValues ? "hidden" : "visible";
18991
18992
  }).on("mousemove", (event2, d) => {
18992
18993
  showTooltipOnMouseMove(
18993
18994
  [
@@ -11446,7 +11446,8 @@
11446
11446
  dataTableNumberFormat: ",",
11447
11447
  dataTableDecimalPrecision: "2",
11448
11448
  dataTableDisplayUnits: "None",
11449
- dataTableLabelColor: commonColors.black
11449
+ dataTableLabelColor: commonColors.black,
11450
+ dataTableAxisLabel: true
11450
11451
  },
11451
11452
  dataTableOuterBorder: {
11452
11453
  borderButtonVisibility: true,
@@ -11787,7 +11788,7 @@
11787
11788
  bottom2 = xAxisRelatedMargin + 5 + scrollHeightConstant;
11788
11789
  break;
11789
11790
  case staticLegendPosition.bottom:
11790
- bottom2 = 40 + xAxisRelatedMargin + scrollHeightConstant;
11791
+ bottom2 = 30 + xAxisRelatedMargin + scrollHeightConstant;
11791
11792
  top2 = metrics.chartTitleHeight + 5 + (isNormalizedChart ? 12 : 0);
11792
11793
  break;
11793
11794
  case staticLegendPosition.left:
@@ -13747,7 +13748,7 @@
13747
13748
  let dataTableHeight = 20;
13748
13749
  if (formatOptions.dataTableProperties && formatOptions.dataTableProperties.dataTable) {
13749
13750
  formatOptions.xAxisLabel.xAxisLabelVisibility = false;
13750
- let exactAvailableWidth = yLabel + yTitle - 36;
13751
+ let exactAvailableWidth = yLabel + yTitle;
13751
13752
  seriesData.forEach((data, i) => {
13752
13753
  let tempObj = {
13753
13754
  "data": data.data.filter((data2) => dimensionList.includes(data2.dimension)),
@@ -13839,14 +13840,14 @@
13839
13840
  selectAll("#dataTableG" + chartId).remove();
13840
13841
  let tag = currentTag.append("g").attr("id", "dataTableG" + chartId);
13841
13842
  dataTable.forEach((data, i) => {
13842
- yCordinate = yCordinate + cellHeight;
13843
+ yCordinate = yCordinate + (!formatOptions.dataTableProperties.dataTableAxisLabel && i === 0 ? 0 : cellHeight);
13843
13844
  cellHeight = data.properties.height;
13844
13845
  getLegendsAppended(tag, i, data, cellHeight);
13845
13846
  let parentTag = tag.append("g").attr("class", "dataTableBorder").selectAll("#scaling-svg" + chartId + " .foreignObject").data((d, pos) => data["data"]).enter().filter((d) => xAxis(d.dimension)).append("g").attr("fill", commonColors.transparent).attr(
13846
13847
  "transform",
13847
13848
  (d, index2) => `translate(${index2 === 0 ? 0 : xAxis(d.dimension) - cellWidth / 2},0)`
13848
13849
  );
13849
- if (i == 0) {
13850
+ if (i == 0 && formatOptions.dataTableProperties.dataTableAxisLabel) {
13850
13851
  parentTag.append("foreignObject").attr("class", "dataTableColHeaders").attr("x", 0).attr("y", tableStartY).attr("id", (d, index2) => index2).attr("width", (d, index2) => index2 === 0 ? cellWidth + outerPadding + calWidthForSeriesNames / 2 : index2 === dimensionCount - 1 ? cellWidth + outerPadding - calWidthForSeriesNames / 2 : cellWidth).attr("height", "20px").append("xhtml:div").style("width", (d, index2) => index2 === 0 ? cellWidth + outerPadding + calWidthForSeriesNames / 2 : index2 === dimensionCount - 1 ? cellWidth + outerPadding - calWidthForSeriesNames / 2 : cellWidth).style("height", `${20}px`).style("border-width", (d, index2) => getBorderStyle(formatOptions, index2, void 0, dimensionCount, legendsCount, "width", "colHeaders")).style("border-style", (d, index2) => getBorderStyle(formatOptions, index2, void 0, dimensionCount, legendsCount, "style", "colHeaders")).style("border-color", (d, index2) => getBorderStyle(formatOptions, index2, void 0, dimensionCount, legendsCount, "color", "colHeaders")).style("text-align", "center").style("white-space", "nowrap").style("text-overflow", "ellipsis").style("overflow", "hidden").style("padding-left", "3px").style("font-size", formatOptions.dataTableProperties.dataTableFontSize + "px").style("font-family", formatOptions.dataTableProperties.dataTableFontFamily).style("font-style", fontStyle.includes("Italic") ? "Italic" : "").style(
13851
13852
  "text-decoration",
13852
13853
  fontStyle.includes("Underline") ? "Underline" : ""
@@ -15437,7 +15438,7 @@
15437
15438
  svg,
15438
15439
  seriesData,
15439
15440
  7,
15440
- height - 25,
15441
+ height - 35,
15441
15442
  width - 10,
15442
15443
  30,
15443
15444
  position,
@@ -16914,10 +16915,10 @@
16914
16915
  return yScale(0);
16915
16916
  }).attr("height", 0).attr("fill", data2.properties.color).attr(
16916
16917
  "stroke-dasharray",
16917
- (d) => d.stackBorderStyle === 2 ? "5,3" : "0"
16918
- ).attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
16918
+ (d) => data2.properties.stackBorderStyle == 2 ? "5,3" : "0"
16919
+ ).attr("stroke-width", (d) => `${data2.properties.stackBorderWidth}px`).attr(
16919
16920
  "stroke",
16920
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
16921
+ (d) => data2.properties.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderColor : "none"
16921
16922
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
16922
16923
  "visibility",
16923
16924
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -17625,9 +17626,9 @@
17625
17626
  }).attr("height", (d) => {
17626
17627
  const yScale = data2.properties.axis === axisTypes.primary ? yScaleLeft : yScaleRight;
17627
17628
  return Math.abs(yScale(d.value) - yScale(0));
17628
- }).attr("fill", data2.properties.color).attr("stroke-dasharray", (d) => d.stackBorderStyle === 2 ? "5,3" : "0").attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
17629
+ }).attr("fill", data2.properties.color).attr("stroke-dasharray", (d) => data2.properties.stackBorderStyle == 2 ? "5,3" : "0").attr("stroke-width", (d) => `${data2.properties.stackBorderWidth}px`).attr(
17629
17630
  "stroke",
17630
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
17631
+ (d) => data2.properties.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderColor : "none"
17631
17632
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr(
17632
17633
  "visibility",
17633
17634
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -17889,12 +17890,12 @@
17889
17890
  (sdata) => sdata.legend === d.key
17890
17891
  );
17891
17892
  const props = seriesData[seriesIndex]?.properties;
17892
- return props?.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
17893
+ return props?.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
17893
17894
  }).attr("stroke-dasharray", (d, i, nodes) => {
17894
17895
  const seriesIndex = Array.from(seriesData).findIndex(
17895
17896
  (sdata) => sdata.legend === d.key
17896
17897
  );
17897
- return seriesData[seriesIndex]?.properties.stackBorderStyle === 2 ? "5,3" : "0";
17898
+ return seriesData[seriesIndex]?.properties.stackBorderStyle == 2 ? "5,3" : "0";
17898
17899
  }).attr("stroke-width", (d, i, nodes) => {
17899
17900
  const seriesIndex = Array.from(seriesData).findIndex(
17900
17901
  (sdata) => sdata.legend === d.key
@@ -18498,10 +18499,10 @@
18498
18499
  return Math.abs(yScale(d.value) - yScale(0));
18499
18500
  }).attr("fill", data2.properties.color).attr(
18500
18501
  "stroke-dasharray",
18501
- (d) => d.stackBorderStyle === 2 ? "5,3" : "0"
18502
- ).attr("stroke-width", (d) => `${d.stackBorderWidth}px`).attr(
18502
+ (d) => data2.properties.stackBorderStyle == 2 ? "5,3" : "0"
18503
+ ).attr("stroke-width", () => `${data2.properties.stackBorderWidth}px`).attr(
18503
18504
  "stroke",
18504
- (d) => data2.properties.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderStyle : "none"
18505
+ () => data2.properties.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? data2.properties.stackBorderColor : "none"
18505
18506
  ).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr("opacity", 0.7).attr(
18506
18507
  "visibility",
18507
18508
  (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues ? "hidden" : "visible"
@@ -18981,16 +18982,16 @@
18981
18982
  return props?.color || "gray";
18982
18983
  }).attr("stroke", (d, i, nodes) => {
18983
18984
  const { props } = getPropsForRect(nodes, i);
18984
- return props?.stackBorderStyle === 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
18985
+ return props?.stackBorderStyle == 0 ? "none" : formatOptions.column.stackBorderVisibility ? props.stackBorderColor : "none";
18985
18986
  }).attr("stroke-dasharray", (d, i, nodes) => {
18986
18987
  const { props } = getPropsForRect(nodes, i);
18987
- return props?.stackBorderStyle === 2 ? "5,3" : "0";
18988
+ return props?.stackBorderStyle == 2 ? "5,3" : "0";
18988
18989
  }).attr("stroke-width", (d, i, nodes) => {
18989
18990
  const { props } = getPropsForRect(nodes, i);
18990
18991
  return (props?.stackBorderWidth || 0) + "px";
18991
18992
  }).style("clip-path", "inset(0px) fill-box").style("shape-rendering", "crispEdges").attr("visibility", (d, i, nodes) => {
18992
18993
  const { props } = getPropsForRect(nodes, i);
18993
- return d.data[d.key] === 0 && props?.hideZeroValues ? "hidden" : "visible";
18994
+ return d.data[d.key] == 0 && props?.hideZeroValues ? "hidden" : "visible";
18994
18995
  }).on("mousemove", (event2, d) => {
18995
18996
  showTooltipOnMouseMove(
18996
18997
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pace-chart-lib",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
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",