pace-chart-lib 0.0.12 → 1.0.1

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.
Files changed (44) hide show
  1. package/dist/components/Charts/ChartsWithAxis/AreaFamily/AreaChart.js +9 -11
  2. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.js +6 -9
  3. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.js +7 -10
  4. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +4 -4
  5. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +12 -17
  6. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.d.ts +2 -4
  7. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.js +9 -11
  8. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.js +8 -7
  9. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.js +11 -13
  10. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.js +11 -13
  11. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.js +7 -10
  12. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.js +7 -10
  13. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.js +9 -11
  14. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.js +11 -13
  15. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.js +11 -13
  16. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.js +6 -7
  17. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.js +3 -3
  18. package/dist/components/Charts/ChartsWithAxis/LineFamily/LineChart.js +9 -11
  19. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.js +7 -10
  20. package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.js +7 -10
  21. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.js +10 -12
  22. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.js +19 -22
  23. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.js +4 -3
  24. package/dist/components/Charts/Core/Common.types.d.ts +3 -3
  25. package/dist/components/Charts/Core/CommonFunctions.js +3 -1
  26. package/package.json +27 -11
  27. package/dist/Components1/Charts/ChartsWithAxis/BarFamily/BarChart.d.ts +0 -12
  28. package/dist/Components1/Charts/ChartsWithAxis/BarFamily/BarChart.js +0 -9
  29. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +0 -46
  30. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +0 -2285
  31. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.d.ts +0 -169
  32. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.js +0 -47
  33. package/dist/Components1/Charts/ChartsWithAxis/LineFamily/LineChart.d.ts +0 -4
  34. package/dist/Components1/Charts/ChartsWithAxis/LineFamily/LineChart.js +0 -403
  35. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.d.ts +0 -0
  36. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.js +0 -0
  37. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.d.ts +0 -0
  38. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.js +0 -0
  39. package/dist/Components1/Charts/Core/Common.type.d.ts +0 -8
  40. package/dist/Components1/Charts/Core/Common.type.js +0 -9
  41. package/dist/Components1/Charts/Core/CommonFunctions.d.ts +0 -12
  42. package/dist/Components1/Charts/Core/CommonFunctions.js +0 -512
  43. package/dist/Components1/Charts/Core/DefaultProperties.d.ts +0 -586
  44. package/dist/Components1/Charts/Core/DefaultProperties.js +0 -585
@@ -4,20 +4,19 @@ import * as d3 from "d3";
4
4
  import * as d3Annotation from "d3-svg-annotation";
5
5
  import { useEffect, useRef } from "react";
6
6
  import { logError } from "../../../../Services/ErrorLog";
7
+ import { staticLegendShape } from "../../Core/Common.types";
7
8
  import { drawLegends, generalizedChartData, hideTooltipOnMouseOut, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
8
9
  import { addDataTable, customYscaleLabelFormatting, dataTablePreCalculation, drawSeriesLabels, firstFunctionBeforeRender, getNumberWithFormat, getStackedData, initChartArea, initPlotArea, initSvg, initXaxis, initYaxis, marginCalculation, prepareDataForSeriesLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, stacklineAnnotations, yAxistitle, yAxistitleRight, } from "../ChartsWithAxisFunctions";
9
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
10
- import { staticLegendShape } from "../../Core/Common.types";
11
- const StackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const StackColumnChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  let columnWidth = 0; // coz line chart
14
15
  const chartType = actualChartTypes.stackColumn;
15
16
  const svgRef = useRef();
16
17
  const seriesData = generalizedChartData(data.ChartData, data.DimensionList);
17
18
  const dimensionList = data.DimensionList;
18
19
  const barChart = false;
19
- const chartsWithXScrollFlag = true;
20
- const chartsWithYScrollFlag = false;
21
20
  const isSecondaryAxisDrawn = false;
22
21
  let isPrimaryAxisDrawn = true;
23
22
  let customYaxisMinValue = parseFloat(formatOptions.yAxisLabel.yAxisMinText);
@@ -107,7 +106,7 @@ const StackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpti
107
106
  secondaryYLabel,
108
107
  } = marginCalculation(
109
108
  // for all margin related calculations
110
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
109
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType));
111
110
  setSVGContainer(margin); // for innerWidth/height static width/height
112
111
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
113
112
  // calculations for data tables
@@ -177,13 +176,11 @@ const StackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpti
177
176
  }
178
177
  chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
179
178
  chartJSON.yMaxLeft = yMaxLeft;
180
- let xAxisObject = xAxisObj[0];
181
- let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
182
- xAxisObject.dataType === "DATE"
179
+ let formatedDimensionList = isDateType
183
180
  ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
184
181
  : chartJSON.dimensionList;
185
182
  chartJSON.dimensionList.forEach((d, i) => {
186
- chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
183
+ chartJSON.formattedDimensionListMap.set(d, formatedDimensionList[i]);
187
184
  });
188
185
  if (formatOptions.plotArea.hideZeroValues) {
189
186
  chartJSON.hideZeroValues = true;
@@ -494,7 +491,7 @@ const StackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpti
494
491
  const drawLineChart = () => {
495
492
  // filteredData.forEach((data) => getChartType([data]));
496
493
  getChartType(filteredData);
497
- initXaxis(gTag, chartJSON, xLabel, formatOptions, xAxisObj[0], dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, columnWidth, xAxisObj[0].dataType, innerWidth, innerHeight, filteredDimension);
494
+ initXaxis(gTag, chartJSON, xLabel, formatOptions, dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, columnWidth, isDateType, innerWidth, innerHeight, filteredDimension);
498
495
  stacklineAnnotations(stackChartData, xScale, yScaleLeft, yScaleRight, // need to pass secondary axis scale if secondary axis is drawn
499
496
  margin, d3Annotation, [], //this.labelExcludeList,
500
497
  [], //this.individualLabelColor,
@@ -8,8 +8,9 @@ import { drawLegends, generalizedChartData, hideTooltipOnMouseOut, showTooltipOn
8
8
  import { addDataTable, commonAnnotations, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, initChartArea, initPlotArea, initSvg, initXaxisBar, initXaxisTop, initYaxisBar, marginCalculation, prepareDataForSeriesLabel, responsiveSecondaryYaxisLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle, yAxistitleRight, } from "../ChartsWithAxisFunctions";
9
9
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
10
10
  import { staticLegendShape } from "../../Core/Common.types";
11
- const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const HorizontalBarChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  let columnWidth = 0; // coz line chartO
14
15
  const chartType = actualChartTypes.horizontalBar;
15
16
  const svgRef = useRef();
@@ -102,7 +103,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
102
103
  secondaryYLabel,
103
104
  } = marginCalculation(
104
105
  // for all margin related calculations
105
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
106
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType, barChart));
106
107
  setSVGContainer(margin); // for innerWidth/height static width/height
107
108
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
108
109
  // calculations for data tables
@@ -114,7 +115,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
114
115
  initPlotArea(gTag, formatOptions, dataTableHeight, innerWidth, innerHeight, chartType);
115
116
  initScale();
116
117
  initAxis();
117
- initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, xAxisTop, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, xAxisObj[0], width, dimensionHeightWidthArray, columnWidth);
118
+ initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, xAxisTop, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, isDateType, width, dimensionHeightWidthArray, columnWidth);
118
119
  if (isSecondaryAxisDrawn) {
119
120
  initXaxisTop(formatOptions, gTag, secondaryYLabel, xAxisTop);
120
121
  }
@@ -134,7 +135,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
134
135
  const preProcessChartData = () => {
135
136
  const allChartData = [];
136
137
  const legendList = [];
137
- let formatedDimesionList = [];
138
+ let formatedDimensionList = [];
138
139
  let yMaxLeft = -Infinity;
139
140
  let yMinLeft = Infinity;
140
141
  let yMaxRight = -Infinity;
@@ -161,14 +162,11 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
161
162
  chartJSON.yMaxRight = yMaxRight;
162
163
  chartJSON.yMinRight = yMinRight;
163
164
  // Apply formatted dimensions
164
- let xAxisObject = xAxisObj[0];
165
- formatedDimesionList =
166
- (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
167
- xAxisObject.dataType === "DATE"
168
- ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
169
- : chartJSON.dimensionList;
165
+ formatedDimensionList = isDateType
166
+ ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
167
+ : chartJSON.dimensionList;
170
168
  chartJSON.dimensionList.forEach((dim, i) => {
171
- chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
169
+ chartJSON.formattedDimensionListMap.set(dim, formatedDimensionList[i]);
172
170
  });
173
171
  filteredData = JSON.parse(JSON.stringify(seriesData));
174
172
  if (!formatOptions.plotArea.fitChart) {
@@ -4,12 +4,13 @@ import * as d3 from "d3";
4
4
  import * as d3Annotation from "d3-svg-annotation";
5
5
  import { useEffect, useRef } from "react";
6
6
  import { logError } from "../../../../Services/ErrorLog";
7
+ import { staticLegendShape } from "../../Core/Common.types";
7
8
  import { drawLegends, generalizedChartData, hideTooltipOnMouseOut, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
8
- import { addDataTable, commonAnnotations, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, initChartArea, initPlotArea, initSvg, initXaxisBar, initXaxisTop, initYaxisBar, marginCalculation, prepareDataForSeriesLabel, responsiveSecondaryYaxisLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle, yAxistitleRight, } from "../ChartsWithAxisFunctions";
9
+ import { addDataTable, commonAnnotations, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, initChartArea, initPlotArea, initSvg, initXaxisBar, initXaxisTop, initYaxisBar, marginCalculation, prepareDataForSeriesLabel, responsiveSecondaryYaxisLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle, yAxistitleRight } from "../ChartsWithAxisFunctions";
9
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
10
- import { staticLegendShape } from "../../Core/Common.types";
11
- const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const HorizontalHistogramChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  let columnWidth = 0; // coz line chartO
14
15
  const chartType = actualChartTypes.horizontalBar;
15
16
  const svgRef = useRef();
@@ -102,7 +103,7 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
102
103
  secondaryYLabel,
103
104
  } = marginCalculation(
104
105
  // for all margin related calculations
105
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
106
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType, barChart));
106
107
  setSVGContainer(margin); // for innerWidth/height static width/height
107
108
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
108
109
  // calculations for data tables
@@ -114,7 +115,7 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
114
115
  initPlotArea(gTag, formatOptions, dataTableHeight, innerWidth, innerHeight, chartType);
115
116
  initScale();
116
117
  initAxis();
117
- initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, xAxisTop, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, xAxisObj[0], width, dimensionHeightWidthArray, columnWidth);
118
+ initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, xAxisTop, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, isDateType, width, dimensionHeightWidthArray, columnWidth);
118
119
  if (isSecondaryAxisDrawn) {
119
120
  initXaxisTop(formatOptions, gTag, secondaryYLabel, xAxisTop);
120
121
  }
@@ -134,7 +135,7 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
134
135
  const preProcessChartData = () => {
135
136
  const allChartData = [];
136
137
  const legendList = [];
137
- let formatedDimesionList = [];
138
+ let formatedDimensionList = [];
138
139
  let yMaxLeft = -Infinity;
139
140
  let yMinLeft = Infinity;
140
141
  let yMaxRight = -Infinity;
@@ -161,14 +162,11 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
161
162
  chartJSON.yMaxRight = yMaxRight;
162
163
  chartJSON.yMinRight = yMinRight;
163
164
  // Apply formatted dimensions
164
- let xAxisObject = xAxisObj[0];
165
- formatedDimesionList =
166
- (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
167
- xAxisObject.dataType === "DATE"
168
- ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
169
- : chartJSON.dimensionList;
165
+ formatedDimensionList = isDateType
166
+ ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
167
+ : chartJSON.dimensionList;
170
168
  chartJSON.dimensionList.forEach((dim, i) => {
171
- chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
169
+ chartJSON.formattedDimensionListMap.set(dim, formatedDimensionList[i]);
172
170
  });
173
171
  filteredData = JSON.parse(JSON.stringify(seriesData));
174
172
  if (!formatOptions.plotArea.fitChart) {
@@ -4,12 +4,13 @@ import * as d3 from "d3";
4
4
  import * as d3Annotation from "d3-svg-annotation";
5
5
  import { useEffect, useRef } from "react";
6
6
  import { logError } from "../../../../Services/ErrorLog";
7
+ import { staticLegendShape } from "../../Core/Common.types";
7
8
  import { drawLegends, generalizedChartData, hideTooltipOnMouseOut, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
8
- import { addDataTable, commonAnnotations, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, getStackedData, initChartArea, initPlotArea, initSvg, initXaxisBar, initYaxisBar, marginCalculation, prepareDataForSeriesLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle, } from "../ChartsWithAxisFunctions";
9
+ import { addDataTable, commonAnnotations, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, getStackedData, initChartArea, initPlotArea, initSvg, initXaxisBar, initYaxisBar, marginCalculation, prepareDataForSeriesLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle } from "../ChartsWithAxisFunctions";
9
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
10
- import { staticLegendShape } from "../../Core/Common.types";
11
- const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const LayeredHorizontalBarChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  let columnWidth = 0; // coz line chart
14
15
  const chartType = actualChartTypes.layeredBarChart;
15
16
  const svgRef = useRef();
@@ -104,7 +105,7 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
104
105
  secondaryYLabel,
105
106
  } = marginCalculation(
106
107
  // for all margin related calculations
107
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
108
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType, barChart));
108
109
  setSVGContainer(margin); // for innerWidth/height static width/height
109
110
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
110
111
  // calculations for data tables
@@ -117,7 +118,7 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
117
118
  initPlotArea(gTag, formatOptions, dataTableHeight, innerWidth, innerHeight, chartType);
118
119
  initScale();
119
120
  initAxis();
120
- initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, undefined, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, xAxisObj[0], width, dimensionHeightWidthArray, columnWidth);
121
+ initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, undefined, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, isDateType, width, dimensionHeightWidthArray, columnWidth);
121
122
  horizontalScrollBar(seriesData, height, svg, margin, innerWidth);
122
123
  if (formatOptions.dataTableProperties &&
123
124
  formatOptions.dataTableProperties.dataTable) {
@@ -134,7 +135,7 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
134
135
  const preProcessChartData = () => {
135
136
  const allChartData = [];
136
137
  const legendList = [];
137
- let formatedDimesionList = [];
138
+ let formatedDimensionList = [];
138
139
  let yMaxLeft = -Infinity;
139
140
  let yMinLeft = Infinity;
140
141
  let yMaxRight = -Infinity;
@@ -154,14 +155,11 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
154
155
  chartJSON.yMaxRight = yMaxRight;
155
156
  chartJSON.yMinRight = yMinRight;
156
157
  // Apply formatted dimensions
157
- let xAxisObject = xAxisObj[0];
158
- formatedDimesionList =
159
- (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
160
- xAxisObject.dataType === "DATE"
161
- ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
162
- : chartJSON.dimensionList;
158
+ formatedDimensionList = isDateType
159
+ ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
160
+ : chartJSON.dimensionList;
163
161
  chartJSON.dimensionList.forEach((dim, i) => {
164
- chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
162
+ chartJSON.formattedDimensionListMap.set(dim, formatedDimensionList[i]);
165
163
  });
166
164
  filteredData = JSON.parse(JSON.stringify(seriesData));
167
165
  if (!formatOptions.plotArea.fitChart) {
@@ -8,8 +8,9 @@ import { staticLegendShape } from "../../Core/Common.types";
8
8
  import { drawLegends, generalizedChartData, hideTooltipOnMouseOut, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
9
9
  import { addDataTable, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, getStackedData, initChartArea, initPlotArea, initSvg, initXaxisBar, initYaxisBar, marginCalculation, prepareDataForSeriesLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, stacklineAnnotations, yAxistitle } from "../ChartsWithAxisFunctions";
10
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
11
- const NormalizedStackHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const NormalizedStackHorizontalBarChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  let columnWidth = 0; // coz line chart
14
15
  const chartType = actualChartTypes.stackBar100;
15
16
  const svgRef = useRef();
@@ -101,7 +102,7 @@ const NormalizedStackHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, ch
101
102
  secondaryYLabel,
102
103
  } = marginCalculation(
103
104
  // for all margin related calculations
104
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
105
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType, barChart));
105
106
  setSVGContainer(margin); // for innerWidth/height static width/height
106
107
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
107
108
  // calculations for data tables
@@ -114,7 +115,7 @@ const NormalizedStackHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, ch
114
115
  initPlotArea(gTag, formatOptions, dataTableHeight, innerWidth, innerHeight, chartType);
115
116
  initScale();
116
117
  initAxis();
117
- initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, undefined, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, xAxisObj[0], width, dimensionHeightWidthArray, columnWidth);
118
+ initYaxisBar(formatOptions, gTag, xLabel, innerHeight, innerWidth, yAxis, undefined, xScaleBottom, chartJSON.yMaxLeft, filteredDimension, chartType, isDateType, width, dimensionHeightWidthArray, columnWidth);
118
119
  horizontalScrollBar(seriesData, height, svg, margin, innerWidth);
119
120
  if (formatOptions.dataTableProperties &&
120
121
  formatOptions.dataTableProperties.dataTable) {
@@ -168,13 +169,11 @@ const NormalizedStackHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, ch
168
169
  }
169
170
  chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
170
171
  chartJSON.yMaxLeft = 1;
171
- let xAxisObject = xAxisObj[0];
172
- let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
173
- xAxisObject.dataType === "DATE"
172
+ let formatedDimensionList = isDateType
174
173
  ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
175
174
  : chartJSON.dimensionList;
176
175
  chartJSON.dimensionList.forEach((d, i) => {
177
- chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
176
+ chartJSON.formattedDimensionListMap.set(d, formatedDimensionList[i]);
178
177
  });
179
178
  if (formatOptions.plotArea.hideZeroValues) {
180
179
  chartJSON.hideZeroValues = true;
@@ -8,7 +8,7 @@ import { drawLegends, generalizedChartData, hideTooltipOnMouseOut, showTooltipOn
8
8
  import { addDataTable, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, getStackedData, initChartArea, initPlotArea, initSvg, initXaxisBar, initYaxisBar, marginCalculation, prepareDataForSeriesLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, stacklineAnnotations, yAxistitle, } from "../ChartsWithAxisFunctions";
9
9
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
10
10
  import { staticLegendShape } from "../../Core/Common.types";
11
- const StackHorizontalChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const StackHorizontalChart = ({ isDateType, formatOptions, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
12
12
  // adding variables as per requirement
13
13
  let columnWidth = 0; // coz line chart
14
14
  const chartType = actualChartTypes.stackBar;
@@ -171,12 +171,12 @@ const StackHorizontalChart = ({ title, data, yAxisObj, xAxisObj, chartId, format
171
171
  chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
172
172
  chartJSON.yMaxLeft = yMaxLeft;
173
173
  let xAxisObject = xAxisObj[0];
174
- let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
174
+ let formatedDimensionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
175
175
  xAxisObject.dataType === "DATE"
176
176
  ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
177
177
  : chartJSON.dimensionList;
178
178
  chartJSON.dimensionList.forEach((d, i) => {
179
- chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
179
+ chartJSON.formattedDimensionListMap.set(d, formatedDimensionList[i]);
180
180
  });
181
181
  if (formatOptions.plotArea.hideZeroValues) {
182
182
  chartJSON.hideZeroValues = true;
@@ -8,8 +8,9 @@ import { staticLegendShape, staticLineStyle, } from "../../Core/Common.types";
8
8
  import { drawLegends, generalizedChartData, lineMarkers } from "../../Core/CommonFunctions";
9
9
  import { addDataTable, commonAnnotations, customYscaleLabelFormatting, dataTablePreCalculation, drawSeriesLabels, firstFunctionBeforeRender, getCurveType, getNumberWithFormat, initChartArea, initPlotArea, initSvg, initXaxis, initYaxis, initYaxisRight, marginCalculation, prepareDataForSeriesLabel, responsiveSecondaryYaxisLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle, yAxistitleRight, } from "../ChartsWithAxisFunctions";
10
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
11
- const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const LineChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  const barWidth = 0; // coz line chart
14
15
  const chartType = actualChartTypes.line;
15
16
  const svgRef = useRef();
@@ -101,7 +102,7 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
101
102
  secondaryYLabel,
102
103
  } = marginCalculation(
103
104
  // for all margin related calculations
104
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
105
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType));
105
106
  setSVGContainer(margin); // for innerWidth/height static width/height
106
107
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
107
108
  // calculations for data tables
@@ -133,7 +134,7 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
133
134
  const preProcessChartData = () => {
134
135
  const allChartData = [];
135
136
  const legendList = [];
136
- let formatedDimesionList = [];
137
+ let formatedDimensionList = [];
137
138
  let yMaxLeft = -Infinity;
138
139
  let yMinLeft = Infinity;
139
140
  let yMaxRight = -Infinity;
@@ -160,14 +161,11 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
160
161
  chartJSON.yMaxRight = yMaxRight;
161
162
  chartJSON.yMinRight = yMinRight;
162
163
  // Apply formatted dimensions
163
- let xAxisObject = xAxisObj[0];
164
- formatedDimesionList =
165
- (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
166
- xAxisObject.dataType === "DATE"
167
- ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
168
- : chartJSON.dimensionList;
164
+ formatedDimensionList = isDateType
165
+ ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
166
+ : chartJSON.dimensionList;
169
167
  chartJSON.dimensionList.forEach((dim, i) => {
170
- chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
168
+ chartJSON.formattedDimensionListMap.set(dim, formatedDimensionList[i]);
171
169
  });
172
170
  filteredData = JSON.parse(JSON.stringify(seriesData));
173
171
  if (!formatOptions.plotArea.fitChart) {
@@ -438,7 +436,7 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
438
436
  const drawLineChart = () => {
439
437
  // filteredData.forEach((data) => getChartType([data]));
440
438
  getChartType(filteredData);
441
- initXaxis(gTag, chartJSON, xLabel, formatOptions, xAxisObj[0], dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, barWidth, xAxisObj[0].dataType, innerWidth, innerHeight, filteredDimension);
439
+ initXaxis(gTag, chartJSON, xLabel, formatOptions, dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, barWidth, isDateType, innerWidth, innerHeight, filteredDimension);
442
440
  commonAnnotations(seriesData, xScale, yScaleLeft, yScaleRight, // need to pass secondary axis scale if secondary axis is drawn
443
441
  margin, d3Annotation, [], //this.labelExcludeList,
444
442
  [], //this.individualLabelColor,
@@ -4,20 +4,19 @@ import * as d3 from "d3";
4
4
  import * as d3Annotation from "d3-svg-annotation";
5
5
  import { useEffect, useRef } from "react";
6
6
  import { logError } from "../../../../Services/ErrorLog";
7
+ import { staticLegendShape } from "../../Core/Common.types";
7
8
  import { drawLegends, generalizedChartData, lineMarkers } from "../../Core/CommonFunctions";
8
9
  import { addDataTable, dataTablePreCalculation, drawSeriesLabels, firstFunctionBeforeRender, getCurveType, getStackedData, initChartArea, initPlotArea, initSvg, initXaxis, initYaxis, marginCalculation, prepareDataForSeriesLabel, responsiveXaxisLabel, setChartTitle, setDateFormats, setXaxistitle, stacklineAnnotations, yAxistitle, yAxistitleRight, } from "../ChartsWithAxisFunctions";
9
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
10
- import { staticLegendShape } from "../../Core/Common.types";
11
- const NormalisedStackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const NormalisedStackLineChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  const barWidth = 0; // coz line chart
14
15
  const chartType = actualChartTypes.stackLine100;
15
16
  const svgRef = useRef();
16
17
  const seriesData = generalizedChartData(data.ChartData, data.DimensionList);
17
18
  const dimensionList = data.DimensionList;
18
19
  const barChart = false;
19
- const chartsWithXScrollFlag = true;
20
- const chartsWithYScrollFlag = false;
21
20
  const isSecondaryAxisDrawn = false;
22
21
  let isPrimaryAxisDrawn = true;
23
22
  let customYaxisMinValue = parseFloat(formatOptions.yAxisLabel.yAxisMinText);
@@ -113,7 +112,7 @@ const NormalisedStackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
113
112
  secondaryYLabel,
114
113
  } = marginCalculation(
115
114
  // for all margin related calculations
116
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
115
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType));
117
116
  setSVGContainer(margin); // for innerWidth/height static width/height
118
117
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
119
118
  // calculations for data tables
@@ -198,13 +197,11 @@ const NormalisedStackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
198
197
  chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
199
198
  chartJSON.yMaxLeft = 1; // as per your original override
200
199
  // Format dimensions
201
- const xAxisObject = xAxisObj[0];
202
- const formatedDimesionList = (xAxisObject.groupBy === "NA" || xAxisObject.groupBy === undefined) &&
203
- xAxisObject.dataType === "DATE"
200
+ const formatedDimensionList = isDateType
204
201
  ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
205
202
  : chartJSON.dimensionList;
206
203
  // Assign formatted dimension list map (cleanest one-liner)
207
- chartJSON.formattedDimensionListMap = new Map(chartJSON.dimensionList.map((d, i) => [d, formatedDimesionList[i]]));
204
+ chartJSON.formattedDimensionListMap = new Map(chartJSON.dimensionList.map((d, i) => [d, formatedDimensionList[i]]));
208
205
  // let secondaryAxisMinValue = 0;
209
206
  // let secondaryAxisMaxValue = 0;
210
207
  // if (isSecondaryAxisDrawn) {
@@ -474,7 +471,7 @@ const NormalisedStackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
474
471
  const drawLineChart = () => {
475
472
  // filteredData.forEach((data) => getChartType([data]));
476
473
  getChartType(filteredData);
477
- initXaxis(gTag, chartJSON, xLabel, formatOptions, xAxisObj[0], dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, barWidth, xAxisObj[0].dataType, innerWidth, innerHeight, filteredDimension);
474
+ initXaxis(gTag, chartJSON, xLabel, formatOptions, dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, barWidth, isDateType, innerWidth, innerHeight, filteredDimension);
478
475
  stacklineAnnotations(stackChartData, xScale, yScaleLeft, yScaleRight, // need to pass secondary axis scale if secondary axis is drawn
479
476
  margin, d3Annotation, [], //this.labelExcludeList,
480
477
  [], //this.individualLabelColor,
@@ -4,20 +4,19 @@ import * as d3 from "d3";
4
4
  import * as d3Annotation from "d3-svg-annotation";
5
5
  import { useEffect, useRef } from "react";
6
6
  import { logError } from "../../../../Services/ErrorLog";
7
+ import { staticLegendShape } from "../../Core/Common.types";
7
8
  import { drawLegends, generalizedChartData, lineMarkers } from "../../Core/CommonFunctions";
8
9
  import { addDataTable, customYscaleLabelFormatting, dataTablePreCalculation, drawSeriesLabels, firstFunctionBeforeRender, getCurveType, getNumberWithFormat, getStackedData, initChartArea, initPlotArea, initSvg, initXaxis, initYaxis, marginCalculation, prepareDataForSeriesLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, stacklineAnnotations, yAxistitle, yAxistitleRight, } from "../ChartsWithAxisFunctions";
9
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
10
- import { staticLegendShape } from "../../Core/Common.types";
11
- const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const StackLineChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  const barWidth = 0; // coz line chart
14
15
  const chartType = actualChartTypes.stackLine;
15
16
  const svgRef = useRef();
16
17
  const seriesData = generalizedChartData(data.ChartData, data.DimensionList);
17
18
  const dimensionList = data.DimensionList;
18
19
  const barChart = false;
19
- const chartsWithXScrollFlag = true;
20
- const chartsWithYScrollFlag = false;
21
20
  const isSecondaryAxisDrawn = false;
22
21
  let isPrimaryAxisDrawn = true;
23
22
  let customYaxisMinValue = parseFloat(formatOptions.yAxisLabel.yAxisMinText);
@@ -107,7 +106,7 @@ const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
107
106
  secondaryYLabel,
108
107
  } = marginCalculation(
109
108
  // for all margin related calculations
110
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
109
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType));
111
110
  setSVGContainer(margin); // for innerWidth/height static width/height
112
111
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
113
112
  // calculations for data tables
@@ -186,13 +185,11 @@ const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
186
185
  }
187
186
  chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
188
187
  chartJSON.yMaxLeft = yMaxLeft;
189
- let xAxisObject = xAxisObj[0];
190
- let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
191
- xAxisObject.dataType === "DATE"
188
+ let formatedDimensionList = isDateType
192
189
  ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
193
190
  : chartJSON.dimensionList;
194
191
  chartJSON.dimensionList.forEach((d, i) => {
195
- chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
192
+ chartJSON.formattedDimensionListMap.set(d, formatedDimensionList[i]);
196
193
  });
197
194
  if (formatOptions.plotArea.hideZeroValues) {
198
195
  chartJSON.hideZeroValues = true;
@@ -470,7 +467,7 @@ const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
470
467
  const drawLineChart = () => {
471
468
  // filteredData.forEach((data) => getChartType([data]));
472
469
  getChartType(filteredData);
473
- initXaxis(gTag, chartJSON, xLabel, formatOptions, xAxisObj[0], dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, barWidth, xAxisObj[0].dataType, innerWidth, innerHeight, filteredDimension);
470
+ initXaxis(gTag, chartJSON, xLabel, formatOptions, dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, barWidth, isDateType, innerWidth, innerHeight, filteredDimension);
474
471
  stacklineAnnotations(stackChartData, xScale, yScaleLeft, yScaleRight, // need to pass secondary axis scale if secondary axis is drawn
475
472
  margin, d3Annotation, [], //this.labelExcludeList,
476
473
  [], //this.individualLabelColor,
@@ -8,8 +8,9 @@ import { staticLegendShape } from "../../Core/Common.types";
8
8
  import { drawLegends, generalizedChartData, hideTooltipOnMouseOut, showTooltipOnMouseMove } from "../../Core/CommonFunctions";
9
9
  import { addDataTable, commonAnnotations, customYscaleLabelFormatting, dataTablePreCalculation, firstFunctionBeforeRender, getNumberWithFormat, initChartArea, initPlotArea, initSvg, initXaxisBar, initYaxisBar, marginCalculation, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle, yAxistitleRight } from "../ChartsWithAxisFunctions";
10
10
  import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
11
- const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
11
+ const TornadoChart = ({ isDateType, formatOptions, data, }) => {
12
12
  // adding variables as per requirement
13
+ const chartId = crypto.randomUUID();
13
14
  let columnWidth = 0; // coz line chartO
14
15
  const chartType = actualChartTypes.tornadoChart;
15
16
  const svgRef = useRef();
@@ -102,7 +103,7 @@ const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
102
103
  secondaryYLabel,
103
104
  } = marginCalculation(
104
105
  // for all margin related calculations
105
- width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
106
+ width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, isDateType));
106
107
  setSVGContainer(margin); // for innerWidth/height static width/height
107
108
  ({ dataTable, dataTableHeight } = dataTablePreCalculation(
108
109
  // calculations for data tables
@@ -114,7 +115,7 @@ const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
114
115
  initPlotArea(gTag, formatOptions, dataTableHeight, innerWidth, innerHeight, chartType);
115
116
  initScale();
116
117
  initAxis();
117
- initYaxisBar(formatOptions, gTag, yLabel, innerHeight, innerWidth, yAxisLeft, yAxisRight, xScale, chartJSON.yMaxLeft, chartJSON.dimensionList, chartType, xAxisObj[0], width, dimensionHeightWidthArray, columnWidth);
118
+ initYaxisBar(formatOptions, gTag, yLabel, innerHeight, innerWidth, yAxisLeft, yAxisRight, xScale, chartJSON.yMaxLeft, chartJSON.dimensionList, chartType, isDateType, width, dimensionHeightWidthArray, columnWidth);
118
119
  horizontalScrollBar(seriesData, height, svg, margin, innerWidth);
119
120
  if (formatOptions.dataTableProperties &&
120
121
  formatOptions.dataTableProperties.dataTable) {
@@ -131,8 +132,8 @@ const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
131
132
  const preProcessChartData = () => {
132
133
  const allChartData = [];
133
134
  const legendList = [];
134
- let formatedDimesionList = [];
135
- let firstMeasure = yAxisObj[0].name.actualName;
135
+ let formatedDimensionList = [];
136
+ let firstMeasure = "";
136
137
  let yMaxLeft = 0;
137
138
  // let yMinLeft = Infinity;
138
139
  let yMaxRight = -Infinity;
@@ -160,14 +161,11 @@ const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
160
161
  chartJSON.yMaxRight = yMaxRight;
161
162
  // chartJSON.yMinRight = yMinRight;
162
163
  // Apply formatted dimensions
163
- let xAxisObject = xAxisObj[0];
164
- formatedDimesionList =
165
- (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
166
- xAxisObject.dataType === "DATE"
167
- ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
168
- : chartJSON.dimensionList;
164
+ formatedDimensionList = isDateType
165
+ ? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
166
+ : chartJSON.dimensionList;
169
167
  chartJSON.dimensionList.forEach((dim, i) => {
170
- chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
168
+ chartJSON.formattedDimensionListMap.set(dim, formatedDimensionList[i]);
171
169
  });
172
170
  filteredData = JSON.parse(JSON.stringify(seriesData));
173
171
  if (!formatOptions.plotArea.fitChart) {