pace-chart-lib 1.0.61 → 1.0.62

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.
@@ -53,16 +53,13 @@ export declare const TSankeyDataLabelPostion: {
53
53
  center: string;
54
54
  };
55
55
  export type TOrganizationChartData = {
56
- id?: number;
57
- value: number | null;
58
- absoluteValue: number;
59
- label?: string;
60
- nodeLabel?: string;
61
- children?: TOrganizationChartData[];
62
- styleObject?: TLegendEntry;
56
+ ChartData: any;
57
+ ChartTitleList: any[];
58
+ DimensionList: any[];
59
+ LegendList: any[];
63
60
  };
64
61
  export type TOrganizationChartProps = {
65
- data: TOrganizationChartData[];
62
+ data: TOrganizationChartData;
66
63
  legendEntries: TLegendEntry[];
67
64
  chartId: string;
68
65
  clientWidth: number;
@@ -54179,9 +54179,10 @@ const fileName$1 = "OrganizationChart.tsx";
54179
54179
  const OrganizationChart = ({
54180
54180
  data,
54181
54181
  formatOptions,
54182
- legendEntries,
54182
+ // legendEntries,
54183
54183
  legendSequence
54184
54184
  }) => {
54185
+ let legendEntries = data.LegendList ?? [];
54185
54186
  const chartId = crypto.randomUUID();
54186
54187
  const svgRef = useRef();
54187
54188
  const floatingSvgRef = useRef();
@@ -54221,20 +54222,11 @@ const OrganizationChart = ({
54221
54222
  chartDirection = chartFormatOptions.plotArea.chartDirection || orgChartDirection.left;
54222
54223
  var sum2 = 0;
54223
54224
  var absoluteSum = 0;
54224
- data.forEach((item) => {
54225
- sum2 = sum2 + item.value;
54226
- absoluteSum = absoluteSum + item.absoluteValue;
54227
- });
54228
- var newObj = {
54229
- id: 0,
54230
- children: data,
54231
- value: sum2,
54232
- // Total value of all children
54233
- absoluteValue: absoluteSum,
54234
- nodeLabel: "",
54235
- UID: ""
54225
+ const rootNode = {
54226
+ ...data.ChartData,
54227
+ UID: void 0
54236
54228
  };
54237
- let tempData = getFlattenedData(newObj).filter(
54229
+ let tempData = getFlattenedData(rootNode).filter(
54238
54230
  (data2) => data2.value !== null
54239
54231
  );
54240
54232
  createIdIndexMap(tempData);
@@ -54283,8 +54275,7 @@ const OrganizationChart = ({
54283
54275
  data2.forEach((nodeObject, i) => {
54284
54276
  if (nodeObject.id != 0) {
54285
54277
  let parentUID = data2[idIndexMap.get(nodeObject.parentId)].UID;
54286
- parentUID === "" ? nodeObject.UID = nodeObject.nodeLabel : nodeObject.UID = parentUID + "-" + nodeObject.nodeLabel;
54287
- indexMapForStyleObject.set(nodeObject.UID, i);
54278
+ parentUID === void 0 ? nodeObject.UID = nodeObject.nodeLabel : nodeObject.UID = parentUID + "-" + nodeObject.nodeLabel;
54288
54279
  }
54289
54280
  });
54290
54281
  } catch (error) {
@@ -54293,12 +54284,15 @@ const OrganizationChart = ({
54293
54284
  };
54294
54285
  const addStyleObjectToChartData = (data2) => {
54295
54286
  try {
54296
- data2[0] = { ...data2[0], styleObject: legendEntries[0] };
54297
54287
  legendEntries.forEach((styleObject) => {
54298
- if (styleObject === legendEntries[0]) return;
54299
- let dataIndex = indexMapForStyleObject.get(styleObject.name);
54300
- let obj = data2[dataIndex];
54301
- data2[dataIndex] = { ...obj, styleObject };
54288
+ indexMapForStyleObject.set(styleObject.name, styleObject);
54289
+ });
54290
+ Object.keys(data2).forEach((key) => {
54291
+ const legendObject = indexMapForStyleObject.get(data2[key].UID ?? data2[key].nodeLabel);
54292
+ data2[key] = {
54293
+ ...data2[key],
54294
+ styleObject: legendObject || legendEntries[0]
54295
+ };
54302
54296
  });
54303
54297
  return data2;
54304
54298
  } catch (error) {
@@ -54512,7 +54506,7 @@ const OrganizationChart = ({
54512
54506
  justify-content: center;
54513
54507
  align-items: center;
54514
54508
  text-align: center;
54515
- background-color: ${d.data.styleObject.backgroundColor ? d.data.styleObject.backgroundColor : d.data.styleObject.Color};
54509
+ background-color: ${d.data.styleObject.color ? d.data.styleObject.color : d.data.styleObject.backgroundColor};
54516
54510
  z-index: 99;
54517
54511
  transform: ${transform};
54518
54512
  transition: unset;">
@@ -55147,10 +55141,11 @@ const fileName = "ScatterChart.tsx";
55147
55141
  const ScatterChart = ({
55148
55142
  data,
55149
55143
  formatOptions,
55150
- chartId,
55151
- shapesList,
55152
- colorsList
55144
+ chartId
55153
55145
  }) => {
55146
+ const colorsList = data.ColorElements ?? [];
55147
+ const shapesList = data.ShapeElements ?? [];
55148
+ let modifiedData = [];
55154
55149
  const svgRef = useRef();
55155
55150
  let chartFormatOptions;
55156
55151
  let maxLegendDimensions = [0, 0];
@@ -55162,12 +55157,12 @@ const ScatterChart = ({
55162
55157
  let innerWidth2;
55163
55158
  let chartAreaTagG;
55164
55159
  let svg;
55165
- let measuresList = [];
55166
- let dimensionsList = [];
55167
- let minDimension;
55168
- let maxDimension;
55169
- let minMeasure;
55170
- let maxMeasure;
55160
+ let minDimension = Number.POSITIVE_INFINITY;
55161
+ let maxDimension = Number.NEGATIVE_INFINITY;
55162
+ let minMeasure = Number.POSITIVE_INFINITY;
55163
+ let maxMeasure = Number.NEGATIVE_INFINITY;
55164
+ let sizeValueMin = Number.POSITIVE_INFINITY;
55165
+ let sizeValueMax = Number.NEGATIVE_INFINITY;
55171
55166
  let yLabel;
55172
55167
  let xLabel;
55173
55168
  let yTitle;
@@ -55183,6 +55178,7 @@ const ScatterChart = ({
55183
55178
  let customYaxisMinValue;
55184
55179
  let xScale;
55185
55180
  let yScale;
55181
+ let sizeScale;
55186
55182
  let colorsMap = /* @__PURE__ */ new Map();
55187
55183
  let shapesMap = /* @__PURE__ */ new Map();
55188
55184
  useEffect(() => {
@@ -55284,7 +55280,7 @@ const ScatterChart = ({
55284
55280
  innerHeight2,
55285
55281
  xTitle,
55286
55282
  xLabel,
55287
- data.length
55283
+ modifiedData.length
55288
55284
  );
55289
55285
  };
55290
55286
  const initCircles = () => {
@@ -55294,17 +55290,11 @@ const ScatterChart = ({
55294
55290
  };
55295
55291
  const circles = chartAreaTagG.append("g").attr("class", "circles").attr("class", "parentGroup");
55296
55292
  const shouldAnimate = chartFormatOptions.animation.animationEnabled;
55297
- const scatterPaths = circles.append("g").selectAll(".bubbleScatter").data(data).enter().append("g").attr("fill", (d) => d.selectedColor).attr(
55298
- "colorId",
55299
- (d) => d.legendName.includes("-") ? d.legendName.split("-")[0].replace(/ /g, "-") : d.legendName.replace(/ /g, "-")
55300
- ).attr(
55301
- "shapeId",
55302
- (d) => d.legendName.includes("-") ? d.legendName.split("-")[1].replace(/ /g, "-") : d.legendName.replace(/ /g, "-")
55303
- ).append("path").attr("class", "path").attr("id", function(d, i) {
55293
+ const scatterPaths = circles.append("g").selectAll(".bubbleScatter").data(modifiedData).enter().append("g").attr("fill", (d) => d.color).attr("colorId", (d) => d.colorName.replace(/ /g, "-")).attr("shapeId", (d) => d.shapeName?.replace(/ /g, "-")).append("path").attr("class", "path").attr("id", function(d, i) {
55304
55294
  select$2(this).attr(
55305
55295
  "d",
55306
- Symbol$1().type(getMarkershapes(d.selectedShape)).size(
55307
- (d.sizeValue ? d.sizeValue : 10) * 2 * convertStringToNumber(
55296
+ Symbol$1().type(getMarkershapes(d.shape)).size(
55297
+ (d.sizeValue ? sizeScale(d.sizeValue) : 10) * 2 * convertStringToNumber(
55308
55298
  chartFormatOptions.plotArea.scatterSizeIndex
55309
55299
  )
55310
55300
  )
@@ -55317,24 +55307,26 @@ const ScatterChart = ({
55317
55307
  ).on("mousemove", (event2, d) => {
55318
55308
  showTooltipOnMouseMove(
55319
55309
  [
55320
- {
55321
- key: chartFormatOptions.xAxisTitle.xAxisTitleText,
55322
- value: getNumberWithFormatFunction(
55323
- chartFormatOptions.toolTip.toolTipDisplayUnits,
55324
- chartFormatOptions.toolTip.toolTipNumberFormat,
55325
- chartFormatOptions.toolTip.toolTipDecimalPrecision
55326
- )(d.dimension)
55327
- },
55328
- {
55329
- key: chartFormatOptions.yAxisTitle.yAxisTitleText,
55330
- value: getNumberWithFormatFunction(
55331
- chartFormatOptions.toolTip.toolTipDisplayUnits,
55332
- chartFormatOptions.toolTip.toolTipNumberFormat,
55333
- chartFormatOptions.toolTip.toolTipDecimalPrecision
55334
- )(d.measure)
55335
- },
55336
- { key: "Legend", value: d.legendName }
55337
- // { key: "Calculated Tooltip", value: d.tooltip },
55310
+ ...[
55311
+ {
55312
+ key: chartFormatOptions.xAxisTitle.xAxisTitleText,
55313
+ value: getNumberWithFormatFunction(
55314
+ chartFormatOptions.toolTip.toolTipDisplayUnits,
55315
+ chartFormatOptions.toolTip.toolTipNumberFormat,
55316
+ chartFormatOptions.toolTip.toolTipDecimalPrecision
55317
+ )(d.dimension)
55318
+ },
55319
+ {
55320
+ key: chartFormatOptions.yAxisTitle.yAxisTitleText,
55321
+ value: getNumberWithFormatFunction(
55322
+ chartFormatOptions.toolTip.toolTipDisplayUnits,
55323
+ chartFormatOptions.toolTip.toolTipNumberFormat,
55324
+ chartFormatOptions.toolTip.toolTipDecimalPrecision
55325
+ )(d.measure)
55326
+ },
55327
+ { key: "Color", value: d.colorName }
55328
+ ],
55329
+ ...d.shapeName ? [{ key: "Shape", value: d.shapeName }] : []
55338
55330
  ],
55339
55331
  chartFormatOptions
55340
55332
  );
@@ -55350,33 +55342,41 @@ const ScatterChart = ({
55350
55342
  };
55351
55343
  const iterateOverChartData = () => {
55352
55344
  try {
55345
+ let addDataToModifiedData = function(dataPoint, legend, shape) {
55346
+ minMeasure = Math.min(minMeasure, dataPoint.value);
55347
+ maxMeasure = Math.max(maxMeasure, dataPoint.value);
55348
+ minDimension = Math.min(minDimension, dataPoint.dimension);
55349
+ maxDimension = Math.max(maxDimension, dataPoint.dimension);
55350
+ sizeValueMin = Math.min(sizeValueMin, dataPoint.value2 ?? 10);
55351
+ sizeValueMax = Math.max(sizeValueMax, dataPoint.value2 ?? 10);
55352
+ modifiedData.push({
55353
+ dimension: dataPoint.dimension,
55354
+ measure: dataPoint.value,
55355
+ sizeValue: dataPoint.value2,
55356
+ colorName: legend,
55357
+ shapeName: shape,
55358
+ shape: shapesMap.get(shape) || "Circle",
55359
+ color: colorsMap.get(legend) || "#6ba2b8ff"
55360
+ });
55361
+ };
55353
55362
  colorsList.forEach((colorObject) => {
55354
55363
  colorsMap.set(colorObject.name, colorObject.color);
55355
55364
  });
55356
55365
  shapesList.forEach((shapeObject) => {
55357
55366
  shapesMap.set(shapeObject.name, shapeObject.markerShape);
55358
55367
  });
55359
- data.forEach((d) => {
55360
- let legendNameArr = d.legendName.split("-");
55361
- d["selectedColor"] = colorsMap.get(legendNameArr[0]) || "#6ba2b8ff";
55362
- d["selectedShape"] = shapesMap.get(legendNameArr[1]) || "Circle";
55363
- if (d.measureName) {
55364
- measuresList.push(d.measure);
55365
- if (d.measure < minMeasure || minMeasure === void 0) {
55366
- minMeasure = d.measure;
55367
- }
55368
- if (d.measure > maxMeasure || maxMeasure === void 0) {
55369
- maxMeasure = d.measure;
55370
- }
55368
+ data.ChartData.forEach((d) => {
55369
+ if (d.children && d.children.length > 0) {
55370
+ d.children.forEach((child) => {
55371
+ child.data.forEach((dataPoint) => {
55372
+ addDataToModifiedData(dataPoint, d.legend, child.legend);
55373
+ });
55374
+ });
55371
55375
  }
55372
- if (d.dimensionName) {
55373
- dimensionsList.push(d.dimension);
55374
- if (d.dimension < minDimension || minDimension === void 0) {
55375
- minDimension = d.dimension;
55376
- }
55377
- if (d.dimension > maxDimension || maxDimension === void 0) {
55378
- maxDimension = d.dimension;
55379
- }
55376
+ if (d.data && d.data.length > 0) {
55377
+ d.data.forEach((dataPoint) => {
55378
+ addDataToModifiedData(dataPoint, d.legend);
55379
+ });
55380
55380
  }
55381
55381
  });
55382
55382
  } catch (e) {
@@ -55391,6 +55391,7 @@ const ScatterChart = ({
55391
55391
  let yEndValue = chartFormatOptions.yAxisLabel.yAxisIntervalsVisibility && chartFormatOptions.yAxisLabel.yAxisMaxText !== "" ? parseFloat(chartFormatOptions.yAxisLabel.yAxisMaxText) : maxMeasure * 1.1;
55392
55392
  xScale = linear$1().domain([xStartValue, xEndValue]).range([0, innerWidth2]);
55393
55393
  yScale = linear$1().domain([yStartValue, yEndValue]).range([innerHeight2, 0]);
55394
+ sizeScale = linear$1().domain([sizeValueMin, sizeValueMax]).range([1, 10]);
55394
55395
  } catch (e) {
55395
55396
  logError$2(fileName, "initScale", e);
55396
55397
  }
@@ -55468,10 +55469,10 @@ const ScatterChart = ({
55468
55469
  let xCordinate;
55469
55470
  switch (chartFormatOptions.plotArea.xCoordinate) {
55470
55471
  case referenceLineTypes.Mean:
55471
- xCordinate = mean(data, (d) => d.dimension);
55472
+ xCordinate = mean(modifiedData, (d) => d.dimension);
55472
55473
  break;
55473
55474
  case referenceLineTypes.Median:
55474
- xCordinate = median(data, (d) => d.dimension);
55475
+ xCordinate = median(modifiedData, (d) => d.dimension);
55475
55476
  break;
55476
55477
  case referenceLineTypes.Custom:
55477
55478
  xCordinate = convertStringToNumber(
@@ -55488,10 +55489,13 @@ const ScatterChart = ({
55488
55489
  let yCordinate;
55489
55490
  switch (chartFormatOptions.plotArea.yCoordinate) {
55490
55491
  case referenceLineTypes.Mean:
55491
- yCordinate = mean(data, (d) => d.measure);
55492
+ yCordinate = mean(modifiedData, (d) => d.value);
55492
55493
  break;
55493
55494
  case referenceLineTypes.Median:
55494
- yCordinate = median(data, (d) => d.measure);
55495
+ yCordinate = median(
55496
+ modifiedData,
55497
+ (d) => d.value
55498
+ );
55495
55499
  break;
55496
55500
  case referenceLineTypes.Custom:
55497
55501
  yCordinate = convertStringToNumber(
@@ -54182,9 +54182,10 @@
54182
54182
  const OrganizationChart = ({
54183
54183
  data,
54184
54184
  formatOptions,
54185
- legendEntries,
54185
+ // legendEntries,
54186
54186
  legendSequence
54187
54187
  }) => {
54188
+ let legendEntries = data.LegendList ?? [];
54188
54189
  const chartId = crypto.randomUUID();
54189
54190
  const svgRef = require$$0$1.useRef();
54190
54191
  const floatingSvgRef = require$$0$1.useRef();
@@ -54224,20 +54225,11 @@
54224
54225
  chartDirection = chartFormatOptions.plotArea.chartDirection || orgChartDirection.left;
54225
54226
  var sum2 = 0;
54226
54227
  var absoluteSum = 0;
54227
- data.forEach((item) => {
54228
- sum2 = sum2 + item.value;
54229
- absoluteSum = absoluteSum + item.absoluteValue;
54230
- });
54231
- var newObj = {
54232
- id: 0,
54233
- children: data,
54234
- value: sum2,
54235
- // Total value of all children
54236
- absoluteValue: absoluteSum,
54237
- nodeLabel: "",
54238
- UID: ""
54228
+ const rootNode = {
54229
+ ...data.ChartData,
54230
+ UID: void 0
54239
54231
  };
54240
- let tempData = getFlattenedData(newObj).filter(
54232
+ let tempData = getFlattenedData(rootNode).filter(
54241
54233
  (data2) => data2.value !== null
54242
54234
  );
54243
54235
  createIdIndexMap(tempData);
@@ -54286,8 +54278,7 @@
54286
54278
  data2.forEach((nodeObject, i) => {
54287
54279
  if (nodeObject.id != 0) {
54288
54280
  let parentUID = data2[idIndexMap.get(nodeObject.parentId)].UID;
54289
- parentUID === "" ? nodeObject.UID = nodeObject.nodeLabel : nodeObject.UID = parentUID + "-" + nodeObject.nodeLabel;
54290
- indexMapForStyleObject.set(nodeObject.UID, i);
54281
+ parentUID === void 0 ? nodeObject.UID = nodeObject.nodeLabel : nodeObject.UID = parentUID + "-" + nodeObject.nodeLabel;
54291
54282
  }
54292
54283
  });
54293
54284
  } catch (error) {
@@ -54296,12 +54287,15 @@
54296
54287
  };
54297
54288
  const addStyleObjectToChartData = (data2) => {
54298
54289
  try {
54299
- data2[0] = { ...data2[0], styleObject: legendEntries[0] };
54300
54290
  legendEntries.forEach((styleObject) => {
54301
- if (styleObject === legendEntries[0]) return;
54302
- let dataIndex = indexMapForStyleObject.get(styleObject.name);
54303
- let obj = data2[dataIndex];
54304
- data2[dataIndex] = { ...obj, styleObject };
54291
+ indexMapForStyleObject.set(styleObject.name, styleObject);
54292
+ });
54293
+ Object.keys(data2).forEach((key) => {
54294
+ const legendObject = indexMapForStyleObject.get(data2[key].UID ?? data2[key].nodeLabel);
54295
+ data2[key] = {
54296
+ ...data2[key],
54297
+ styleObject: legendObject || legendEntries[0]
54298
+ };
54305
54299
  });
54306
54300
  return data2;
54307
54301
  } catch (error) {
@@ -54515,7 +54509,7 @@
54515
54509
  justify-content: center;
54516
54510
  align-items: center;
54517
54511
  text-align: center;
54518
- background-color: ${d.data.styleObject.backgroundColor ? d.data.styleObject.backgroundColor : d.data.styleObject.Color};
54512
+ background-color: ${d.data.styleObject.color ? d.data.styleObject.color : d.data.styleObject.backgroundColor};
54519
54513
  z-index: 99;
54520
54514
  transform: ${transform};
54521
54515
  transition: unset;">
@@ -55150,10 +55144,11 @@
55150
55144
  const ScatterChart = ({
55151
55145
  data,
55152
55146
  formatOptions,
55153
- chartId,
55154
- shapesList,
55155
- colorsList
55147
+ chartId
55156
55148
  }) => {
55149
+ const colorsList = data.ColorElements ?? [];
55150
+ const shapesList = data.ShapeElements ?? [];
55151
+ let modifiedData = [];
55157
55152
  const svgRef = require$$0$1.useRef();
55158
55153
  let chartFormatOptions;
55159
55154
  let maxLegendDimensions = [0, 0];
@@ -55165,12 +55160,12 @@
55165
55160
  let innerWidth2;
55166
55161
  let chartAreaTagG;
55167
55162
  let svg;
55168
- let measuresList = [];
55169
- let dimensionsList = [];
55170
- let minDimension;
55171
- let maxDimension;
55172
- let minMeasure;
55173
- let maxMeasure;
55163
+ let minDimension = Number.POSITIVE_INFINITY;
55164
+ let maxDimension = Number.NEGATIVE_INFINITY;
55165
+ let minMeasure = Number.POSITIVE_INFINITY;
55166
+ let maxMeasure = Number.NEGATIVE_INFINITY;
55167
+ let sizeValueMin = Number.POSITIVE_INFINITY;
55168
+ let sizeValueMax = Number.NEGATIVE_INFINITY;
55174
55169
  let yLabel;
55175
55170
  let xLabel;
55176
55171
  let yTitle;
@@ -55186,6 +55181,7 @@
55186
55181
  let customYaxisMinValue;
55187
55182
  let xScale;
55188
55183
  let yScale;
55184
+ let sizeScale;
55189
55185
  let colorsMap = /* @__PURE__ */ new Map();
55190
55186
  let shapesMap = /* @__PURE__ */ new Map();
55191
55187
  require$$0$1.useEffect(() => {
@@ -55287,7 +55283,7 @@
55287
55283
  innerHeight2,
55288
55284
  xTitle,
55289
55285
  xLabel,
55290
- data.length
55286
+ modifiedData.length
55291
55287
  );
55292
55288
  };
55293
55289
  const initCircles = () => {
@@ -55297,17 +55293,11 @@
55297
55293
  };
55298
55294
  const circles = chartAreaTagG.append("g").attr("class", "circles").attr("class", "parentGroup");
55299
55295
  const shouldAnimate = chartFormatOptions.animation.animationEnabled;
55300
- const scatterPaths = circles.append("g").selectAll(".bubbleScatter").data(data).enter().append("g").attr("fill", (d) => d.selectedColor).attr(
55301
- "colorId",
55302
- (d) => d.legendName.includes("-") ? d.legendName.split("-")[0].replace(/ /g, "-") : d.legendName.replace(/ /g, "-")
55303
- ).attr(
55304
- "shapeId",
55305
- (d) => d.legendName.includes("-") ? d.legendName.split("-")[1].replace(/ /g, "-") : d.legendName.replace(/ /g, "-")
55306
- ).append("path").attr("class", "path").attr("id", function(d, i) {
55296
+ const scatterPaths = circles.append("g").selectAll(".bubbleScatter").data(modifiedData).enter().append("g").attr("fill", (d) => d.color).attr("colorId", (d) => d.colorName.replace(/ /g, "-")).attr("shapeId", (d) => d.shapeName?.replace(/ /g, "-")).append("path").attr("class", "path").attr("id", function(d, i) {
55307
55297
  select$2(this).attr(
55308
55298
  "d",
55309
- Symbol$1().type(getMarkershapes(d.selectedShape)).size(
55310
- (d.sizeValue ? d.sizeValue : 10) * 2 * convertStringToNumber(
55299
+ Symbol$1().type(getMarkershapes(d.shape)).size(
55300
+ (d.sizeValue ? sizeScale(d.sizeValue) : 10) * 2 * convertStringToNumber(
55311
55301
  chartFormatOptions.plotArea.scatterSizeIndex
55312
55302
  )
55313
55303
  )
@@ -55320,24 +55310,26 @@
55320
55310
  ).on("mousemove", (event2, d) => {
55321
55311
  showTooltipOnMouseMove(
55322
55312
  [
55323
- {
55324
- key: chartFormatOptions.xAxisTitle.xAxisTitleText,
55325
- value: getNumberWithFormatFunction(
55326
- chartFormatOptions.toolTip.toolTipDisplayUnits,
55327
- chartFormatOptions.toolTip.toolTipNumberFormat,
55328
- chartFormatOptions.toolTip.toolTipDecimalPrecision
55329
- )(d.dimension)
55330
- },
55331
- {
55332
- key: chartFormatOptions.yAxisTitle.yAxisTitleText,
55333
- value: getNumberWithFormatFunction(
55334
- chartFormatOptions.toolTip.toolTipDisplayUnits,
55335
- chartFormatOptions.toolTip.toolTipNumberFormat,
55336
- chartFormatOptions.toolTip.toolTipDecimalPrecision
55337
- )(d.measure)
55338
- },
55339
- { key: "Legend", value: d.legendName }
55340
- // { key: "Calculated Tooltip", value: d.tooltip },
55313
+ ...[
55314
+ {
55315
+ key: chartFormatOptions.xAxisTitle.xAxisTitleText,
55316
+ value: getNumberWithFormatFunction(
55317
+ chartFormatOptions.toolTip.toolTipDisplayUnits,
55318
+ chartFormatOptions.toolTip.toolTipNumberFormat,
55319
+ chartFormatOptions.toolTip.toolTipDecimalPrecision
55320
+ )(d.dimension)
55321
+ },
55322
+ {
55323
+ key: chartFormatOptions.yAxisTitle.yAxisTitleText,
55324
+ value: getNumberWithFormatFunction(
55325
+ chartFormatOptions.toolTip.toolTipDisplayUnits,
55326
+ chartFormatOptions.toolTip.toolTipNumberFormat,
55327
+ chartFormatOptions.toolTip.toolTipDecimalPrecision
55328
+ )(d.measure)
55329
+ },
55330
+ { key: "Color", value: d.colorName }
55331
+ ],
55332
+ ...d.shapeName ? [{ key: "Shape", value: d.shapeName }] : []
55341
55333
  ],
55342
55334
  chartFormatOptions
55343
55335
  );
@@ -55353,33 +55345,41 @@
55353
55345
  };
55354
55346
  const iterateOverChartData = () => {
55355
55347
  try {
55348
+ let addDataToModifiedData = function(dataPoint, legend, shape) {
55349
+ minMeasure = Math.min(minMeasure, dataPoint.value);
55350
+ maxMeasure = Math.max(maxMeasure, dataPoint.value);
55351
+ minDimension = Math.min(minDimension, dataPoint.dimension);
55352
+ maxDimension = Math.max(maxDimension, dataPoint.dimension);
55353
+ sizeValueMin = Math.min(sizeValueMin, dataPoint.value2 ?? 10);
55354
+ sizeValueMax = Math.max(sizeValueMax, dataPoint.value2 ?? 10);
55355
+ modifiedData.push({
55356
+ dimension: dataPoint.dimension,
55357
+ measure: dataPoint.value,
55358
+ sizeValue: dataPoint.value2,
55359
+ colorName: legend,
55360
+ shapeName: shape,
55361
+ shape: shapesMap.get(shape) || "Circle",
55362
+ color: colorsMap.get(legend) || "#6ba2b8ff"
55363
+ });
55364
+ };
55356
55365
  colorsList.forEach((colorObject) => {
55357
55366
  colorsMap.set(colorObject.name, colorObject.color);
55358
55367
  });
55359
55368
  shapesList.forEach((shapeObject) => {
55360
55369
  shapesMap.set(shapeObject.name, shapeObject.markerShape);
55361
55370
  });
55362
- data.forEach((d) => {
55363
- let legendNameArr = d.legendName.split("-");
55364
- d["selectedColor"] = colorsMap.get(legendNameArr[0]) || "#6ba2b8ff";
55365
- d["selectedShape"] = shapesMap.get(legendNameArr[1]) || "Circle";
55366
- if (d.measureName) {
55367
- measuresList.push(d.measure);
55368
- if (d.measure < minMeasure || minMeasure === void 0) {
55369
- minMeasure = d.measure;
55370
- }
55371
- if (d.measure > maxMeasure || maxMeasure === void 0) {
55372
- maxMeasure = d.measure;
55373
- }
55371
+ data.ChartData.forEach((d) => {
55372
+ if (d.children && d.children.length > 0) {
55373
+ d.children.forEach((child) => {
55374
+ child.data.forEach((dataPoint) => {
55375
+ addDataToModifiedData(dataPoint, d.legend, child.legend);
55376
+ });
55377
+ });
55374
55378
  }
55375
- if (d.dimensionName) {
55376
- dimensionsList.push(d.dimension);
55377
- if (d.dimension < minDimension || minDimension === void 0) {
55378
- minDimension = d.dimension;
55379
- }
55380
- if (d.dimension > maxDimension || maxDimension === void 0) {
55381
- maxDimension = d.dimension;
55382
- }
55379
+ if (d.data && d.data.length > 0) {
55380
+ d.data.forEach((dataPoint) => {
55381
+ addDataToModifiedData(dataPoint, d.legend);
55382
+ });
55383
55383
  }
55384
55384
  });
55385
55385
  } catch (e) {
@@ -55394,6 +55394,7 @@
55394
55394
  let yEndValue = chartFormatOptions.yAxisLabel.yAxisIntervalsVisibility && chartFormatOptions.yAxisLabel.yAxisMaxText !== "" ? parseFloat(chartFormatOptions.yAxisLabel.yAxisMaxText) : maxMeasure * 1.1;
55395
55395
  xScale = linear$1().domain([xStartValue, xEndValue]).range([0, innerWidth2]);
55396
55396
  yScale = linear$1().domain([yStartValue, yEndValue]).range([innerHeight2, 0]);
55397
+ sizeScale = linear$1().domain([sizeValueMin, sizeValueMax]).range([1, 10]);
55397
55398
  } catch (e) {
55398
55399
  logError$2(fileName, "initScale", e);
55399
55400
  }
@@ -55471,10 +55472,10 @@
55471
55472
  let xCordinate;
55472
55473
  switch (chartFormatOptions.plotArea.xCoordinate) {
55473
55474
  case referenceLineTypes.Mean:
55474
- xCordinate = mean(data, (d) => d.dimension);
55475
+ xCordinate = mean(modifiedData, (d) => d.dimension);
55475
55476
  break;
55476
55477
  case referenceLineTypes.Median:
55477
- xCordinate = median(data, (d) => d.dimension);
55478
+ xCordinate = median(modifiedData, (d) => d.dimension);
55478
55479
  break;
55479
55480
  case referenceLineTypes.Custom:
55480
55481
  xCordinate = convertStringToNumber(
@@ -55491,10 +55492,13 @@
55491
55492
  let yCordinate;
55492
55493
  switch (chartFormatOptions.plotArea.yCoordinate) {
55493
55494
  case referenceLineTypes.Mean:
55494
- yCordinate = mean(data, (d) => d.measure);
55495
+ yCordinate = mean(modifiedData, (d) => d.value);
55495
55496
  break;
55496
55497
  case referenceLineTypes.Median:
55497
- yCordinate = median(data, (d) => d.measure);
55498
+ yCordinate = median(
55499
+ modifiedData,
55500
+ (d) => d.value
55501
+ );
55498
55502
  break;
55499
55503
  case referenceLineTypes.Custom:
55500
55504
  yCordinate = convertStringToNumber(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pace-chart-lib",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
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",