pace-chart-lib 1.0.4 → 1.0.5

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.
@@ -32,6 +32,7 @@ export type TVennSeries = {
32
32
  "actualValue": number;
33
33
  };
34
34
  export type TSankeyChartProps = {
35
+ data: any;
35
36
  sankeyLinks: TNodePairs[];
36
37
  sankeyNodes: TLegendEntry[];
37
38
  chartId: string;
@@ -15388,7 +15388,7 @@ function showTooltipOnMouseMove(elements, chartFormatOptions, event2, markerProp
15388
15388
  const tooltip = select$2("#chartTooltipDiv").html("").append("div").attr(
15389
15389
  "class",
15390
15390
  chartFormatOptions.toolTip.toolTipTheme === "Light" ? "tooltipParentLight chartTooltip" : "tooltipParentDark chartTooltip"
15391
- ).style("color", "black").style("background", "rgba(255, 255, 255)").style("border", "0px solid #d4d4d4").style("border-radius", "4px").style("padding", "8px 12px").style("box-shadow", "0px 4px 10px #240808ff").style("transition", "transform 0.1s ease, opacity 0.2s ease");
15391
+ ).style("color", "black").style("background", "rgba(255, 255, 255)").style("border", "0px solid #d4d4d4").style("border-radius", "4px").style("padding", "8px 12px").style("position", "absolute").style("box-shadow", "0px 4px 10px #240808ff").style("transition", "transform 0.1s ease, opacity 0.2s ease");
15392
15392
  const e = event2 || window.event;
15393
15393
  const mouseX = e.pageX;
15394
15394
  const mouseY = e.pageY;
@@ -15902,10 +15902,10 @@ const marginCalculationsForChartsWithoutLegends = (chartFormatOptions, height, w
15902
15902
  "Helvetica"
15903
15903
  ).height : 5;
15904
15904
  let margins = {
15905
- top: chartFormatOptions.chartTitle.chartTitleVisibility ? chartTitleHeight : 10,
15906
- bottom: shouldShowColorScale && chartFormatOptions.colorScale.showColor == colorThemeTypes.colorTheme ? 40 : 10,
15907
- left: 10,
15908
- right: 10
15905
+ top: chartFormatOptions.chartTitle.chartTitleVisibility ? chartTitleHeight : 20,
15906
+ bottom: shouldShowColorScale && chartFormatOptions.colorScale.showColor == colorThemeTypes.colorTheme ? 40 : 20,
15907
+ left: 20,
15908
+ right: 20
15909
15909
  };
15910
15910
  innerHeight = height - margins.top - margins.bottom;
15911
15911
  innerWidth = width - margins.left - margins.right;
@@ -18554,10 +18554,7 @@ const StackColumnChart = ({
18554
18554
  selectAll(".parentGroup").classed("highlight", false).classed("unhighlight", false);
18555
18555
  selectAll('[hoverId="' + legend + '"]').classed("highlight", false).classed("unhighlight", false);
18556
18556
  });
18557
- mergedRects.transition().duration(2e3).ease(cubicOut).attr(
18558
- "y",
18559
- (d) => d[1] >= d[0] ? yScaleLeft(d[1]) : yScaleLeft(d[0])
18560
- ).attr("height", (d) => Math.abs(yScaleLeft(d[0]) - yScaleLeft(d[1])));
18557
+ mergedRects.transition().duration(2e3).ease(cubicOut).attr("y", (d) => d[1] >= d[0] ? yScaleLeft(d[1]) : yScaleLeft(d[0])).attr("height", (d) => Math.abs(yScaleLeft(d[0]) - yScaleLeft(d[1])));
18561
18558
  columnGroups.exit().remove();
18562
18559
  gTag.selectAll(".parentGroup").raise();
18563
18560
  };
@@ -19184,7 +19181,7 @@ const NormalizedStackColumnChart = ({
19184
19181
  }
19185
19182
  };
19186
19183
  const getXScale = () => {
19187
- xScale = point$7().domain(filteredDimension).range(calculatedRange).padding(0.3 * parseFloat(formatOptions.plotArea.plotAreaGapWidth) / 100);
19184
+ xScale = point$7().domain(filteredDimension).range(calculatedRange).padding(0.5);
19188
19185
  };
19189
19186
  const initAxis = () => {
19190
19187
  {
@@ -19393,7 +19390,11 @@ const NormalizedStackColumnChart = ({
19393
19390
  (K2, j) => K2.forEach((d) => {
19394
19391
  d["key"] = K2.key;
19395
19392
  K2["color"] = JSON.parse(JSON.stringify(seriesData[j].properties.color));
19396
- K2["individualAnnotationVisibility"] = JSON.parse(JSON.stringify(seriesData[j].properties.individualAnnotationVisibility));
19393
+ K2["individualAnnotationVisibility"] = JSON.parse(
19394
+ JSON.stringify(
19395
+ seriesData[j].properties.individualAnnotationVisibility
19396
+ )
19397
+ );
19397
19398
  d.data.labelPosition = seriesData[j].properties.dataLabelPosition;
19398
19399
  d.data["labelColor"] = seriesColor == "2" ? JSON.parse(JSON.stringify(seriesData[j].properties.color)) : seriesData[j].properties.labelColor;
19399
19400
  d["hideZero"] = JSON.parse(
@@ -27236,11 +27237,15 @@ const DonutChart = ({
27236
27237
  try {
27237
27238
  const arc2 = arc$1().innerRadius(innerRadius).outerRadius(radius);
27238
27239
  const arcOver = arc$1().innerRadius(innerRadius).outerRadius(radius + 10);
27239
- chartAreaTagG.append("g").attr("class", "parentGroup").attr("fill-opacity", chartFormatOptions.plotArea.opacity).attr("transform", `${getPiePosition()}`).selectAll("path").data(pieChartData).enter().append("path").attr("class", (d) => "path " + d.data.legend).attr("hoverId", (d) => d.data.legend.replace(/ /g, "-")).attr(
27240
+ const parentGroup = chartAreaTagG.append("g").attr("class", "parentGroup").attr("fill-opacity", chartFormatOptions.plotArea.opacity).attr("transform", `${getPiePosition()}`);
27241
+ const paths = parentGroup.selectAll("path").data(pieChartData).enter().append("path").attr("class", (d) => "path " + d.data.legend).attr("hoverId", (d) => d.data.legend.replace(/ /g, "-")).attr(
27240
27242
  "fill",
27241
27243
  (d) => d.data.properties.color !== "#ffffff" ? d.data.properties.color : "none"
27242
- ).attr("d", (d) => arc2(d)).on("mouseover.arc", function(d) {
27243
- select$2(this).transition().duration(100).attr("d", arcOver);
27244
+ ).each(function(d) {
27245
+ const thisPath = d;
27246
+ thisPath._current = { startAngle: 0, endAngle: 0 };
27247
+ }).on("mouseover.arc", function() {
27248
+ select$2(this).transition().duration(150).attr("d", arcOver);
27244
27249
  }).on("mousemove.text", (d) => {
27245
27250
  showTooltipOnMouseMove(
27246
27251
  [
@@ -27262,10 +27267,17 @@ const DonutChart = ({
27262
27267
  ],
27263
27268
  chartFormatOptions
27264
27269
  );
27265
- }).on("mouseout.text", () => {
27266
- hideTooltipOnMouseOut();
27267
- }).on("mouseout.arc", function(d) {
27268
- select$2(this).transition().duration(100).attr("d", arc2);
27270
+ }).on("mouseout.text", () => hideTooltipOnMouseOut()).on("mouseout.arc", function() {
27271
+ select$2(this).transition().duration(150).attr("d", arc2);
27272
+ });
27273
+ paths.transition().delay((_, i) => i * 100).duration(2e3).attrTween("d", function(d) {
27274
+ const interpolate2 = interpolate$2(
27275
+ { startAngle: 0, endAngle: 0 },
27276
+ d
27277
+ );
27278
+ return function(t) {
27279
+ return arc2(interpolate2(t));
27280
+ };
27269
27281
  });
27270
27282
  } catch (error) {
27271
27283
  logError$2(fileName$7, "drawDonutChart", error);
@@ -33979,11 +33991,12 @@ function Sankey() {
33979
33991
  return sankey;
33980
33992
  }
33981
33993
  const SankeyChart = ({
33982
- sankeyLinks,
33983
- sankeyNodes,
33984
33994
  formatOptions,
33995
+ data,
33985
33996
  chartId
33986
33997
  }) => {
33998
+ let sankeyLinks = JSON.parse(JSON.stringify(data.sankeyLinks));
33999
+ let sankeyNodes = JSON.parse(JSON.stringify(data.sankeyNodes));
33987
34000
  const svgRef = useRef();
33988
34001
  let chartFormatOptions;
33989
34002
  let width;
@@ -34392,13 +34405,13 @@ const SankeyChart = ({
34392
34405
  "text-align",
34393
34406
  chartFormatOptions.nodes.sankeyChartType === "Left" ? "right" : chartFormatOptions.nodes.sankeyChartType === "Center" ? "center" : "left"
34394
34407
  ).style("line-height", "20px").attr("title", (d2) => {
34395
- if (layerWisePercentage.get(d2.name) > 5) {
34396
- return d2.alias ? d2.alias : d2.name;
34408
+ if (layerWisePercentage.get(d2.name) > 0) {
34409
+ return d2.alias ? d2.alias.includes("~$~") ? d2.alias.split("~$~")[1] : d2.alias : d2.name.includes("~$~") ? d2.name.split("~$~")[1] : d2.name;
34397
34410
  }
34398
34411
  return "";
34399
34412
  }).text((d2) => {
34400
- if (layerWisePercentage.get(d2.name) > 5) {
34401
- return d2.alias ? d2.alias : d2.name;
34413
+ if (layerWisePercentage.get(d2.name) > 0) {
34414
+ return d2.alias ? d2.alias.includes("~$~") ? d2.alias.split("~$~")[1] : d2.alias : d2.name.includes("~$~") ? d2.name.split("~$~")[1] : d2.name;
34402
34415
  }
34403
34416
  return "";
34404
34417
  });
@@ -34443,7 +34456,7 @@ const SankeyChart = ({
34443
34456
  "text-align",
34444
34457
  chartFormatOptions.nodes.sankeyChartType === "Left" ? "right" : chartFormatOptions.nodes.sankeyChartType === "Center" ? "center" : "left"
34445
34458
  ).style("line-height", "20px").attr("title", (d2) => {
34446
- if (layerWisePercentage.get(d2.name) > 5) {
34459
+ if (layerWisePercentage.get(d2.name) > 0) {
34447
34460
  return chartFormatOptions.nodes.nodeLabelNumberFormat === ",.0%" ? layerWisePercentage.get(d2.name).toFixed(
34448
34461
  parseFloat(
34449
34462
  chartFormatOptions.nodes.nodeLabelDecimalPrecision
@@ -34456,7 +34469,7 @@ const SankeyChart = ({
34456
34469
  }
34457
34470
  return "";
34458
34471
  }).text((d2) => {
34459
- if (layerWisePercentage.get(d2.name) > 5) {
34472
+ if (layerWisePercentage.get(d2.name) > 0) {
34460
34473
  return chartFormatOptions.nodes.nodeLabelNumberFormat === ",.0%" ? layerWisePercentage.get(d2.name).toFixed(
34461
34474
  parseFloat(
34462
34475
  chartFormatOptions.nodes.nodeLabelDecimalPrecision
@@ -15391,7 +15391,7 @@
15391
15391
  const tooltip = select$2("#chartTooltipDiv").html("").append("div").attr(
15392
15392
  "class",
15393
15393
  chartFormatOptions.toolTip.toolTipTheme === "Light" ? "tooltipParentLight chartTooltip" : "tooltipParentDark chartTooltip"
15394
- ).style("color", "black").style("background", "rgba(255, 255, 255)").style("border", "0px solid #d4d4d4").style("border-radius", "4px").style("padding", "8px 12px").style("box-shadow", "0px 4px 10px #240808ff").style("transition", "transform 0.1s ease, opacity 0.2s ease");
15394
+ ).style("color", "black").style("background", "rgba(255, 255, 255)").style("border", "0px solid #d4d4d4").style("border-radius", "4px").style("padding", "8px 12px").style("position", "absolute").style("box-shadow", "0px 4px 10px #240808ff").style("transition", "transform 0.1s ease, opacity 0.2s ease");
15395
15395
  const e = event2 || window.event;
15396
15396
  const mouseX = e.pageX;
15397
15397
  const mouseY = e.pageY;
@@ -15905,10 +15905,10 @@
15905
15905
  "Helvetica"
15906
15906
  ).height : 5;
15907
15907
  let margins = {
15908
- top: chartFormatOptions.chartTitle.chartTitleVisibility ? chartTitleHeight : 10,
15909
- bottom: shouldShowColorScale && chartFormatOptions.colorScale.showColor == colorThemeTypes.colorTheme ? 40 : 10,
15910
- left: 10,
15911
- right: 10
15908
+ top: chartFormatOptions.chartTitle.chartTitleVisibility ? chartTitleHeight : 20,
15909
+ bottom: shouldShowColorScale && chartFormatOptions.colorScale.showColor == colorThemeTypes.colorTheme ? 40 : 20,
15910
+ left: 20,
15911
+ right: 20
15912
15912
  };
15913
15913
  innerHeight = height - margins.top - margins.bottom;
15914
15914
  innerWidth = width - margins.left - margins.right;
@@ -18557,10 +18557,7 @@
18557
18557
  selectAll(".parentGroup").classed("highlight", false).classed("unhighlight", false);
18558
18558
  selectAll('[hoverId="' + legend + '"]').classed("highlight", false).classed("unhighlight", false);
18559
18559
  });
18560
- mergedRects.transition().duration(2e3).ease(cubicOut).attr(
18561
- "y",
18562
- (d) => d[1] >= d[0] ? yScaleLeft(d[1]) : yScaleLeft(d[0])
18563
- ).attr("height", (d) => Math.abs(yScaleLeft(d[0]) - yScaleLeft(d[1])));
18560
+ mergedRects.transition().duration(2e3).ease(cubicOut).attr("y", (d) => d[1] >= d[0] ? yScaleLeft(d[1]) : yScaleLeft(d[0])).attr("height", (d) => Math.abs(yScaleLeft(d[0]) - yScaleLeft(d[1])));
18564
18561
  columnGroups.exit().remove();
18565
18562
  gTag.selectAll(".parentGroup").raise();
18566
18563
  };
@@ -19187,7 +19184,7 @@
19187
19184
  }
19188
19185
  };
19189
19186
  const getXScale = () => {
19190
- xScale = point$7().domain(filteredDimension).range(calculatedRange).padding(0.3 * parseFloat(formatOptions.plotArea.plotAreaGapWidth) / 100);
19187
+ xScale = point$7().domain(filteredDimension).range(calculatedRange).padding(0.5);
19191
19188
  };
19192
19189
  const initAxis = () => {
19193
19190
  {
@@ -19396,7 +19393,11 @@
19396
19393
  (K2, j) => K2.forEach((d) => {
19397
19394
  d["key"] = K2.key;
19398
19395
  K2["color"] = JSON.parse(JSON.stringify(seriesData[j].properties.color));
19399
- K2["individualAnnotationVisibility"] = JSON.parse(JSON.stringify(seriesData[j].properties.individualAnnotationVisibility));
19396
+ K2["individualAnnotationVisibility"] = JSON.parse(
19397
+ JSON.stringify(
19398
+ seriesData[j].properties.individualAnnotationVisibility
19399
+ )
19400
+ );
19400
19401
  d.data.labelPosition = seriesData[j].properties.dataLabelPosition;
19401
19402
  d.data["labelColor"] = seriesColor == "2" ? JSON.parse(JSON.stringify(seriesData[j].properties.color)) : seriesData[j].properties.labelColor;
19402
19403
  d["hideZero"] = JSON.parse(
@@ -27239,11 +27240,15 @@
27239
27240
  try {
27240
27241
  const arc2 = arc$1().innerRadius(innerRadius).outerRadius(radius);
27241
27242
  const arcOver = arc$1().innerRadius(innerRadius).outerRadius(radius + 10);
27242
- chartAreaTagG.append("g").attr("class", "parentGroup").attr("fill-opacity", chartFormatOptions.plotArea.opacity).attr("transform", `${getPiePosition()}`).selectAll("path").data(pieChartData).enter().append("path").attr("class", (d) => "path " + d.data.legend).attr("hoverId", (d) => d.data.legend.replace(/ /g, "-")).attr(
27243
+ const parentGroup = chartAreaTagG.append("g").attr("class", "parentGroup").attr("fill-opacity", chartFormatOptions.plotArea.opacity).attr("transform", `${getPiePosition()}`);
27244
+ const paths = parentGroup.selectAll("path").data(pieChartData).enter().append("path").attr("class", (d) => "path " + d.data.legend).attr("hoverId", (d) => d.data.legend.replace(/ /g, "-")).attr(
27243
27245
  "fill",
27244
27246
  (d) => d.data.properties.color !== "#ffffff" ? d.data.properties.color : "none"
27245
- ).attr("d", (d) => arc2(d)).on("mouseover.arc", function(d) {
27246
- select$2(this).transition().duration(100).attr("d", arcOver);
27247
+ ).each(function(d) {
27248
+ const thisPath = d;
27249
+ thisPath._current = { startAngle: 0, endAngle: 0 };
27250
+ }).on("mouseover.arc", function() {
27251
+ select$2(this).transition().duration(150).attr("d", arcOver);
27247
27252
  }).on("mousemove.text", (d) => {
27248
27253
  showTooltipOnMouseMove(
27249
27254
  [
@@ -27265,10 +27270,17 @@
27265
27270
  ],
27266
27271
  chartFormatOptions
27267
27272
  );
27268
- }).on("mouseout.text", () => {
27269
- hideTooltipOnMouseOut();
27270
- }).on("mouseout.arc", function(d) {
27271
- select$2(this).transition().duration(100).attr("d", arc2);
27273
+ }).on("mouseout.text", () => hideTooltipOnMouseOut()).on("mouseout.arc", function() {
27274
+ select$2(this).transition().duration(150).attr("d", arc2);
27275
+ });
27276
+ paths.transition().delay((_, i) => i * 100).duration(2e3).attrTween("d", function(d) {
27277
+ const interpolate2 = interpolate$2(
27278
+ { startAngle: 0, endAngle: 0 },
27279
+ d
27280
+ );
27281
+ return function(t) {
27282
+ return arc2(interpolate2(t));
27283
+ };
27272
27284
  });
27273
27285
  } catch (error) {
27274
27286
  logError$2(fileName$7, "drawDonutChart", error);
@@ -33982,11 +33994,12 @@
33982
33994
  return sankey;
33983
33995
  }
33984
33996
  const SankeyChart = ({
33985
- sankeyLinks,
33986
- sankeyNodes,
33987
33997
  formatOptions,
33998
+ data,
33988
33999
  chartId
33989
34000
  }) => {
34001
+ let sankeyLinks = JSON.parse(JSON.stringify(data.sankeyLinks));
34002
+ let sankeyNodes = JSON.parse(JSON.stringify(data.sankeyNodes));
33990
34003
  const svgRef = require$$0$1.useRef();
33991
34004
  let chartFormatOptions;
33992
34005
  let width;
@@ -34395,13 +34408,13 @@
34395
34408
  "text-align",
34396
34409
  chartFormatOptions.nodes.sankeyChartType === "Left" ? "right" : chartFormatOptions.nodes.sankeyChartType === "Center" ? "center" : "left"
34397
34410
  ).style("line-height", "20px").attr("title", (d2) => {
34398
- if (layerWisePercentage.get(d2.name) > 5) {
34399
- return d2.alias ? d2.alias : d2.name;
34411
+ if (layerWisePercentage.get(d2.name) > 0) {
34412
+ return d2.alias ? d2.alias.includes("~$~") ? d2.alias.split("~$~")[1] : d2.alias : d2.name.includes("~$~") ? d2.name.split("~$~")[1] : d2.name;
34400
34413
  }
34401
34414
  return "";
34402
34415
  }).text((d2) => {
34403
- if (layerWisePercentage.get(d2.name) > 5) {
34404
- return d2.alias ? d2.alias : d2.name;
34416
+ if (layerWisePercentage.get(d2.name) > 0) {
34417
+ return d2.alias ? d2.alias.includes("~$~") ? d2.alias.split("~$~")[1] : d2.alias : d2.name.includes("~$~") ? d2.name.split("~$~")[1] : d2.name;
34405
34418
  }
34406
34419
  return "";
34407
34420
  });
@@ -34446,7 +34459,7 @@
34446
34459
  "text-align",
34447
34460
  chartFormatOptions.nodes.sankeyChartType === "Left" ? "right" : chartFormatOptions.nodes.sankeyChartType === "Center" ? "center" : "left"
34448
34461
  ).style("line-height", "20px").attr("title", (d2) => {
34449
- if (layerWisePercentage.get(d2.name) > 5) {
34462
+ if (layerWisePercentage.get(d2.name) > 0) {
34450
34463
  return chartFormatOptions.nodes.nodeLabelNumberFormat === ",.0%" ? layerWisePercentage.get(d2.name).toFixed(
34451
34464
  parseFloat(
34452
34465
  chartFormatOptions.nodes.nodeLabelDecimalPrecision
@@ -34459,7 +34472,7 @@
34459
34472
  }
34460
34473
  return "";
34461
34474
  }).text((d2) => {
34462
- if (layerWisePercentage.get(d2.name) > 5) {
34475
+ if (layerWisePercentage.get(d2.name) > 0) {
34463
34476
  return chartFormatOptions.nodes.nodeLabelNumberFormat === ",.0%" ? layerWisePercentage.get(d2.name).toFixed(
34464
34477
  parseFloat(
34465
34478
  chartFormatOptions.nodes.nodeLabelDecimalPrecision
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pace-chart-lib",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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",