pace-chart-lib 0.0.10 → 0.0.11
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.
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/AreaChart.js +7 -6
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.js +3 -3
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.js +7 -6
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +5 -2
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +47 -30
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.js +7 -6
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.js +2 -2
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.js +7 -6
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.js +7 -6
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.js +5 -4
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.js +7 -6
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.js +10 -9
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.js +8 -7
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.js +8 -7
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.js +4 -4
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.js +9 -8
- package/dist/components/Charts/ChartsWithAxis/LineFamily/LineChart.js +7 -6
- package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.js +3 -3
- package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.js +8 -6
- package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.js +3 -3
- package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.js +7 -6
- package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.d.ts +2 -2
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.js +2 -2
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.js +6 -6
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.js +7 -7
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.js +5 -5
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/DonutChart.js +3 -3
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieChart.js +3 -3
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.js +1 -1
- package/package.json +1 -1
|
@@ -102,7 +102,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
102
102
|
secondaryYLabel,
|
|
103
103
|
} = marginCalculation(
|
|
104
104
|
// for all margin related calculations
|
|
105
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
105
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
|
|
106
106
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
107
107
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
108
108
|
// calculations for data tables
|
|
@@ -126,7 +126,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
126
126
|
addDataTable(formatOptions.plotArea.fitChart, svg, gTag, dataTable, columnWidth, xAxisBottom, yScale, yScaleLegends, undefined, undefined, dataTableHeight, chartType, formatOptions, yLabel, yTitle, chartJSON.dimensionList, innerWidth, calculatedRange, chartJSON.formattedDimensionListMap, chartId, margin, innerHeight);
|
|
127
127
|
}
|
|
128
128
|
setXaxistitle(formatOptions, barChart, svg, margin, xLabel, height, xTitle, chartJSON.chartType, yLabel, innerWidth, innerHeight);
|
|
129
|
-
yAxistitle(innerHeight, formatOptions, dataTableHeight, barChart, svg, margin, yTitle, yLabel);
|
|
129
|
+
yAxistitle(innerHeight, formatOptions, dataTableHeight, barChart, svg, margin, yTitle, yLabel, width);
|
|
130
130
|
yAxistitleRight(svg, isSecondaryAxisDrawn, margin, formatOptions, dataTableHeight, innerHeight, innerWidth, secondaryYLabel, secondaryAxisTitleWidth); // to be added later
|
|
131
131
|
setChartTitle(svg, formatOptions, width, chartTitleHeight);
|
|
132
132
|
drawLegends(height, svg, dimensionHeightWidthArray, chartTitleHeight, width, legendMargin, formatOptions, seriesData, chartId, staticLegendShape.rectangle);
|
|
@@ -157,7 +157,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
157
157
|
chartJSON.chartData = allChartData;
|
|
158
158
|
chartJSON.legendList = legendList;
|
|
159
159
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
160
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
160
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
161
161
|
chartJSON.yMaxRight = yMaxRight;
|
|
162
162
|
chartJSON.yMinRight = yMinRight;
|
|
163
163
|
// Apply formatted dimensions
|
|
@@ -165,7 +165,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
165
165
|
formatedDimesionList =
|
|
166
166
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
167
167
|
xAxisObject.dataType === "DATE"
|
|
168
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
168
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
169
169
|
: chartJSON.dimensionList;
|
|
170
170
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
171
171
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -183,16 +183,17 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
183
183
|
};
|
|
184
184
|
const initScale = () => {
|
|
185
185
|
// rounding the ymin & ymax
|
|
186
|
-
let yAxisLabelArray = responsiveYaxisLabel(
|
|
186
|
+
let yAxisLabelArray = responsiveYaxisLabel(chartJSON.yMaxLeft, chartJSON.yMinLeft, innerHeight, formatOptions, chartJSON, customYaxisMinValue, customYaxisMaxValue).yAxisLabelArray;
|
|
187
187
|
chartJSON.yMaxLeft = yAxisLabelArray[yAxisLabelArray.length - 1];
|
|
188
188
|
chartJSON.yMinLeft = yAxisLabelArray[0];
|
|
189
189
|
if (isPrimaryAxisDrawn) {
|
|
190
190
|
xScaleBottom = d3
|
|
191
191
|
.scaleLinear()
|
|
192
192
|
.domain([
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
chartJSON.yMinLeft >= 0 ?
|
|
194
|
+
customYaxisMinValue !== undefined &&
|
|
195
|
+
!Number.isNaN(customYaxisMinValue)
|
|
196
|
+
? customYaxisMinValue : 0
|
|
196
197
|
: chartJSON.yMinLeft < 0
|
|
197
198
|
? chartJSON.yMinLeft * 1.1
|
|
198
199
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -321,7 +322,7 @@ const HorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
321
322
|
: 0
|
|
322
323
|
: 0)
|
|
323
324
|
.tickSizeOuter(0)
|
|
324
|
-
.tickValues(responsiveXaxisLabel(filteredDimension,
|
|
325
|
+
.tickValues(responsiveXaxisLabel(filteredDimension, innerHeight));
|
|
325
326
|
};
|
|
326
327
|
const getChartType = (lineData) => {
|
|
327
328
|
lineData.forEach((lData) => {
|
package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.js
CHANGED
|
@@ -102,7 +102,7 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
|
|
|
102
102
|
secondaryYLabel,
|
|
103
103
|
} = marginCalculation(
|
|
104
104
|
// for all margin related calculations
|
|
105
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
105
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
|
|
106
106
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
107
107
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
108
108
|
// calculations for data tables
|
|
@@ -157,7 +157,7 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
|
|
|
157
157
|
chartJSON.chartData = allChartData;
|
|
158
158
|
chartJSON.legendList = legendList;
|
|
159
159
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
160
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
160
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
161
161
|
chartJSON.yMaxRight = yMaxRight;
|
|
162
162
|
chartJSON.yMinRight = yMinRight;
|
|
163
163
|
// Apply formatted dimensions
|
|
@@ -165,7 +165,7 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
|
|
|
165
165
|
formatedDimesionList =
|
|
166
166
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
167
167
|
xAxisObject.dataType === "DATE"
|
|
168
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
168
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
169
169
|
: chartJSON.dimensionList;
|
|
170
170
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
171
171
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -190,9 +190,10 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
|
|
|
190
190
|
xScaleBottom = d3
|
|
191
191
|
.scaleLinear()
|
|
192
192
|
.domain([
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
chartJSON.yMinLeft >= 0 ?
|
|
194
|
+
customYaxisMinValue !== undefined &&
|
|
195
|
+
!Number.isNaN(customYaxisMinValue)
|
|
196
|
+
? customYaxisMinValue : 0
|
|
196
197
|
: chartJSON.yMinLeft < 0
|
|
197
198
|
? chartJSON.yMinLeft * 1.1
|
|
198
199
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -321,7 +322,7 @@ const HorizontalHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
|
|
|
321
322
|
: 0
|
|
322
323
|
: 0)
|
|
323
324
|
.tickSizeOuter(0)
|
|
324
|
-
.tickValues(responsiveXaxisLabel(filteredDimension,
|
|
325
|
+
.tickValues(responsiveXaxisLabel(filteredDimension, innerHeight));
|
|
325
326
|
};
|
|
326
327
|
const getChartType = (lineData) => {
|
|
327
328
|
lineData.forEach((lData) => {
|
package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.js
CHANGED
|
@@ -104,7 +104,7 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
|
|
|
104
104
|
secondaryYLabel,
|
|
105
105
|
} = marginCalculation(
|
|
106
106
|
// for all margin related calculations
|
|
107
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
107
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
|
|
108
108
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
109
109
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
110
110
|
// calculations for data tables
|
|
@@ -150,7 +150,7 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
|
|
|
150
150
|
chartJSON.chartData = allChartData;
|
|
151
151
|
chartJSON.legendList = legendList;
|
|
152
152
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
153
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
153
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
154
154
|
chartJSON.yMaxRight = yMaxRight;
|
|
155
155
|
chartJSON.yMinRight = yMinRight;
|
|
156
156
|
// Apply formatted dimensions
|
|
@@ -158,7 +158,7 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
|
|
|
158
158
|
formatedDimesionList =
|
|
159
159
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
160
160
|
xAxisObject.dataType === "DATE"
|
|
161
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
161
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
162
162
|
: chartJSON.dimensionList;
|
|
163
163
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
164
164
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -183,9 +183,10 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
|
|
|
183
183
|
xScaleBottom = d3
|
|
184
184
|
.scaleLinear()
|
|
185
185
|
.domain([
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
chartJSON.yMinLeft >= 0 ?
|
|
187
|
+
customYaxisMinValue !== undefined &&
|
|
188
|
+
!Number.isNaN(customYaxisMinValue)
|
|
189
|
+
? customYaxisMinValue : 0
|
|
189
190
|
: chartJSON.yMinLeft < 0
|
|
190
191
|
? chartJSON.yMinLeft * 1.1
|
|
191
192
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -269,7 +270,7 @@ const LayeredHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, chartId, f
|
|
|
269
270
|
: 0
|
|
270
271
|
: 0)
|
|
271
272
|
.tickSizeOuter(0)
|
|
272
|
-
.tickValues(responsiveXaxisLabel(filteredDimension,
|
|
273
|
+
.tickValues(responsiveXaxisLabel(filteredDimension, innerHeight));
|
|
273
274
|
};
|
|
274
275
|
const getChartType = (lineData) => {
|
|
275
276
|
lineData.forEach((lData) => {
|
|
@@ -101,7 +101,7 @@ const NormalizedStackHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, ch
|
|
|
101
101
|
secondaryYLabel,
|
|
102
102
|
} = marginCalculation(
|
|
103
103
|
// for all margin related calculations
|
|
104
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
104
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
|
|
105
105
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
106
106
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
107
107
|
// calculations for data tables
|
|
@@ -166,12 +166,12 @@ const NormalizedStackHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, ch
|
|
|
166
166
|
yMinLeft = Math.min(yMinLeft, start);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
169
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
170
170
|
chartJSON.yMaxLeft = 1;
|
|
171
171
|
let xAxisObject = xAxisObj[0];
|
|
172
172
|
let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
173
173
|
xAxisObject.dataType === "DATE"
|
|
174
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
174
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
175
175
|
: chartJSON.dimensionList;
|
|
176
176
|
chartJSON.dimensionList.forEach((d, i) => {
|
|
177
177
|
chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
|
|
@@ -272,7 +272,7 @@ const NormalizedStackHorizontalBarChart = ({ title, data, yAxisObj, xAxisObj, ch
|
|
|
272
272
|
: 0
|
|
273
273
|
: 0)
|
|
274
274
|
.tickSizeOuter(0)
|
|
275
|
-
.tickValues(responsiveXaxisLabel(filteredDimension,
|
|
275
|
+
.tickValues(responsiveXaxisLabel(filteredDimension, innerHeight));
|
|
276
276
|
};
|
|
277
277
|
const getChartType = (lineData) => {
|
|
278
278
|
// to convert data value to percentage
|
package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.js
CHANGED
|
@@ -101,7 +101,7 @@ const StackHorizontalChart = ({ title, data, yAxisObj, xAxisObj, chartId, format
|
|
|
101
101
|
secondaryYLabel,
|
|
102
102
|
} = marginCalculation(
|
|
103
103
|
// for all margin related calculations
|
|
104
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
104
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0], barChart));
|
|
105
105
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
106
106
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
107
107
|
// calculations for data tables
|
|
@@ -168,12 +168,12 @@ const StackHorizontalChart = ({ title, data, yAxisObj, xAxisObj, chartId, format
|
|
|
168
168
|
yMaxLeft = Math.max(yMaxLeft, end);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
171
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
172
172
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
173
173
|
let xAxisObject = xAxisObj[0];
|
|
174
174
|
let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
175
175
|
xAxisObject.dataType === "DATE"
|
|
176
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
176
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
177
177
|
: chartJSON.dimensionList;
|
|
178
178
|
chartJSON.dimensionList.forEach((d, i) => {
|
|
179
179
|
chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
|
|
@@ -184,16 +184,17 @@ const StackHorizontalChart = ({ title, data, yAxisObj, xAxisObj, chartId, format
|
|
|
184
184
|
};
|
|
185
185
|
const initScale = () => {
|
|
186
186
|
// rounding the ymin & ymax
|
|
187
|
-
let yAxisLabelArray = responsiveYaxisLabel(
|
|
187
|
+
let yAxisLabelArray = responsiveYaxisLabel(chartJSON.yMaxLeft, chartJSON.yMinLeft, innerHeight, formatOptions, chartJSON, customYaxisMinValue, customYaxisMaxValue, barChart, innerWidth).yAxisLabelArray;
|
|
188
188
|
chartJSON.yMaxLeft = yAxisLabelArray[yAxisLabelArray.length - 1];
|
|
189
189
|
chartJSON.yMinLeft = yAxisLabelArray[0];
|
|
190
190
|
if (isPrimaryAxisDrawn) {
|
|
191
191
|
xScaleBottom = d3
|
|
192
192
|
.scaleLinear()
|
|
193
193
|
.domain([
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
chartJSON.yMinLeft >= 0 ?
|
|
195
|
+
customYaxisMinValue !== undefined &&
|
|
196
|
+
!Number.isNaN(customYaxisMinValue)
|
|
197
|
+
? customYaxisMinValue : 0
|
|
197
198
|
: chartJSON.yMinLeft < 0
|
|
198
199
|
? chartJSON.yMinLeft * 1.1
|
|
199
200
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -269,7 +270,7 @@ const StackHorizontalChart = ({ title, data, yAxisObj, xAxisObj, chartId, format
|
|
|
269
270
|
: 0
|
|
270
271
|
: 0)
|
|
271
272
|
.tickSizeOuter(0)
|
|
272
|
-
.tickValues(responsiveXaxisLabel(filteredDimension,
|
|
273
|
+
.tickValues(responsiveXaxisLabel(filteredDimension, innerHeight));
|
|
273
274
|
};
|
|
274
275
|
const getChartType = (lineData) => {
|
|
275
276
|
lineData.forEach((lData) => {
|
|
@@ -101,7 +101,7 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
101
101
|
secondaryYLabel,
|
|
102
102
|
} = marginCalculation(
|
|
103
103
|
// for all margin related calculations
|
|
104
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
104
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
|
|
105
105
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
106
106
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
107
107
|
// calculations for data tables
|
|
@@ -156,7 +156,7 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
156
156
|
chartJSON.chartData = allChartData;
|
|
157
157
|
chartJSON.legendList = legendList;
|
|
158
158
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
159
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
159
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
160
160
|
chartJSON.yMaxRight = yMaxRight;
|
|
161
161
|
chartJSON.yMinRight = yMinRight;
|
|
162
162
|
// Apply formatted dimensions
|
|
@@ -164,7 +164,7 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
164
164
|
formatedDimesionList =
|
|
165
165
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
166
166
|
xAxisObject.dataType === "DATE"
|
|
167
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
167
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
168
168
|
: chartJSON.dimensionList;
|
|
169
169
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
170
170
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -189,9 +189,10 @@ const LineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
189
189
|
yScaleLeft = d3
|
|
190
190
|
.scaleLinear()
|
|
191
191
|
.domain([
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
chartJSON.yMinLeft >= 0 ?
|
|
193
|
+
customYaxisMinValue !== undefined &&
|
|
194
|
+
!Number.isNaN(customYaxisMinValue)
|
|
195
|
+
? customYaxisMinValue : 0
|
|
195
196
|
: chartJSON.yMinLeft < 0
|
|
196
197
|
? chartJSON.yMinLeft * 1.1
|
|
197
198
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -113,7 +113,7 @@ const NormalisedStackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
|
|
|
113
113
|
secondaryYLabel,
|
|
114
114
|
} = marginCalculation(
|
|
115
115
|
// for all margin related calculations
|
|
116
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
116
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
|
|
117
117
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
118
118
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
119
119
|
// calculations for data tables
|
|
@@ -195,13 +195,13 @@ const NormalisedStackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, fo
|
|
|
195
195
|
yMinLeft = Math.min(yMinLeft, start);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
198
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
199
199
|
chartJSON.yMaxLeft = 1; // as per your original override
|
|
200
200
|
// Format dimensions
|
|
201
201
|
const xAxisObject = xAxisObj[0];
|
|
202
202
|
const formatedDimesionList = (xAxisObject.groupBy === "NA" || xAxisObject.groupBy === undefined) &&
|
|
203
203
|
xAxisObject.dataType === "DATE"
|
|
204
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
204
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
205
205
|
: chartJSON.dimensionList;
|
|
206
206
|
// Assign formatted dimension list map (cleanest one-liner)
|
|
207
207
|
chartJSON.formattedDimensionListMap = new Map(chartJSON.dimensionList.map((d, i) => [d, formatedDimesionList[i]]));
|
|
@@ -107,7 +107,7 @@ const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
107
107
|
secondaryYLabel,
|
|
108
108
|
} = marginCalculation(
|
|
109
109
|
// for all margin related calculations
|
|
110
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
110
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
|
|
111
111
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
112
112
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
113
113
|
// calculations for data tables
|
|
@@ -184,12 +184,12 @@ const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
184
184
|
yMaxLeft = Math.max(yMaxLeft, end);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
187
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
188
188
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
189
189
|
let xAxisObject = xAxisObj[0];
|
|
190
190
|
let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
191
191
|
xAxisObject.dataType === "DATE"
|
|
192
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
192
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
193
193
|
: chartJSON.dimensionList;
|
|
194
194
|
chartJSON.dimensionList.forEach((d, i) => {
|
|
195
195
|
chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
|
|
@@ -236,9 +236,10 @@ const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
236
236
|
yScaleLeft = d3
|
|
237
237
|
.scaleLinear()
|
|
238
238
|
.domain([
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
chartJSON.yMinLeft >= 0 ?
|
|
240
|
+
customYaxisMinValue !== undefined &&
|
|
241
|
+
!Number.isNaN(customYaxisMinValue)
|
|
242
|
+
? customYaxisMinValue : 0
|
|
242
243
|
: chartJSON.yMinLeft < 0
|
|
243
244
|
? chartJSON.yMinLeft * 1.1
|
|
244
245
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -495,6 +496,7 @@ const StackLineChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
495
496
|
stackChartData.forEach((K, j) => K.forEach((d) => {
|
|
496
497
|
d["key"] = K.key;
|
|
497
498
|
K["color"] = JSON.parse(JSON.stringify(seriesData[j].properties.color));
|
|
499
|
+
K["individualAnnotationVisibility"] = JSON.parse(JSON.stringify(seriesData[j].properties.individualAnnotationVisibility));
|
|
498
500
|
d.data.labelPosition = seriesData[j].properties.dataLabelPosition;
|
|
499
501
|
d.data["labelColor"] =
|
|
500
502
|
seriesColor == "2"
|
|
@@ -102,7 +102,7 @@ const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
|
|
|
102
102
|
secondaryYLabel,
|
|
103
103
|
} = marginCalculation(
|
|
104
104
|
// for all margin related calculations
|
|
105
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
105
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
|
|
106
106
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
107
107
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
108
108
|
// calculations for data tables
|
|
@@ -156,7 +156,7 @@ const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
|
|
|
156
156
|
chartJSON.chartData = allChartData;
|
|
157
157
|
chartJSON.legendList = legendList;
|
|
158
158
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
159
|
-
// chartJSON.yMinLeft = yMinLeft;
|
|
159
|
+
// chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
160
160
|
chartJSON.yMaxRight = yMaxRight;
|
|
161
161
|
// chartJSON.yMinRight = yMinRight;
|
|
162
162
|
// Apply formatted dimensions
|
|
@@ -164,7 +164,7 @@ const TornadoChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
|
|
|
164
164
|
formatedDimesionList =
|
|
165
165
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
166
166
|
xAxisObject.dataType === "DATE"
|
|
167
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
167
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
168
168
|
: chartJSON.dimensionList;
|
|
169
169
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
170
170
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -103,7 +103,7 @@ const WaterfallChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
103
103
|
secondaryYLabel,
|
|
104
104
|
} = marginCalculation(
|
|
105
105
|
// for all margin related calculations
|
|
106
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
106
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
|
|
107
107
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
108
108
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
109
109
|
// calculations for data tables
|
|
@@ -191,7 +191,7 @@ const WaterfallChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
191
191
|
formatedDimesionList =
|
|
192
192
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
193
193
|
xAxisObject.dataType === "DATE"
|
|
194
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
194
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
195
195
|
: chartJSON.dimensionList;
|
|
196
196
|
getFormattedDimensionList(tempWaterfallChartData, xAxisObject);
|
|
197
197
|
};
|
|
@@ -208,7 +208,7 @@ const WaterfallChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
208
208
|
});
|
|
209
209
|
if ((xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
210
210
|
xAxisObject.dataType === "DATE") {
|
|
211
|
-
tempFormatedDimesionList = setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
211
|
+
tempFormatedDimesionList = setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d);
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
214
214
|
tempFormatedDimesionList = tempDimensionList;
|
|
@@ -234,9 +234,10 @@ const WaterfallChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOption
|
|
|
234
234
|
yScaleLeft = d3
|
|
235
235
|
.scaleLinear()
|
|
236
236
|
.domain([
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
chartJSON.yMinLeft >= 0 ?
|
|
238
|
+
customYaxisMinValue !== undefined &&
|
|
239
|
+
!Number.isNaN(customYaxisMinValue)
|
|
240
|
+
? customYaxisMinValue : 0
|
|
240
241
|
: chartJSON.yMinLeft < 0
|
|
241
242
|
? chartJSON.yMinLeft * 1.1
|
|
242
243
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TDefaultChartFormatOptionsType, TLegendEntry, TPieOfPieSeries
|
|
1
|
+
import { TData, TDefaultChartFormatOptionsType, TLegendEntry, TPieOfPieSeries } from "../Core/Common.types";
|
|
2
2
|
export interface IChartProps {
|
|
3
3
|
chartId: string;
|
|
4
|
-
data:
|
|
4
|
+
data: TData;
|
|
5
5
|
clientWidth: number;
|
|
6
6
|
clientHeight: number;
|
|
7
7
|
formatOptions: TDefaultChartFormatOptionsType;
|
|
@@ -9,7 +9,7 @@ import { logError } from "../../../../Services/ErrorLog";
|
|
|
9
9
|
const fileName = "ProgressChart.tsx";
|
|
10
10
|
const ProgressChart = ({ data, formatOptions, chartId, }) => {
|
|
11
11
|
const svgRef = useRef(); // Reference to the SVG element
|
|
12
|
-
|
|
12
|
+
let seriesData = generalizedChartData(data.ChartData); // Data for the chart
|
|
13
13
|
let chartFormatOptions; // Chart format options
|
|
14
14
|
let width; // svg total width
|
|
15
15
|
let height; // svg total height
|
|
@@ -54,7 +54,7 @@ const ProgressChart = ({ data, formatOptions, chartId, }) => {
|
|
|
54
54
|
};
|
|
55
55
|
const initProgressChartData = () => {
|
|
56
56
|
try {
|
|
57
|
-
|
|
57
|
+
seriesData = seriesData.sort((a, b) => b.data[0].value - a.data[0].value); // Sort data by value in descending order this will allow me to draw arcs in correct order
|
|
58
58
|
totalValue = data[0].data[0].value + data[1].data[0].value;
|
|
59
59
|
}
|
|
60
60
|
catch (error) {
|
|
@@ -9,7 +9,7 @@ import { logError } from "../../../../Services/ErrorLog";
|
|
|
9
9
|
const fileName = "PyramidChart.tsx";
|
|
10
10
|
const PyramidChart = ({ data, formatOptions, chartId, }) => {
|
|
11
11
|
const svgRef = useRef();
|
|
12
|
-
|
|
12
|
+
let seriesData = generalizedChartData(data.ChartData);
|
|
13
13
|
let chartFormatOptions;
|
|
14
14
|
let svg;
|
|
15
15
|
let width;
|
|
@@ -66,16 +66,16 @@ const PyramidChart = ({ data, formatOptions, chartId, }) => {
|
|
|
66
66
|
};
|
|
67
67
|
const initPyramidData = () => {
|
|
68
68
|
try {
|
|
69
|
-
|
|
69
|
+
seriesData = seriesData.sort((a, b) => {
|
|
70
70
|
const firstValue = a.data[0].value;
|
|
71
71
|
const secondValue = b.data[0].value;
|
|
72
72
|
return !chartFormatOptions.plotArea.flipPyramid
|
|
73
73
|
? firstValue - secondValue
|
|
74
74
|
: secondValue - firstValue;
|
|
75
75
|
});
|
|
76
|
-
pyramidTotalValue = d3.sum(
|
|
76
|
+
pyramidTotalValue = d3.sum(seriesData, (d) => Math.abs(d.data[0].value));
|
|
77
77
|
stackHeightArray = [0];
|
|
78
|
-
|
|
78
|
+
seriesData.forEach((d, i) => {
|
|
79
79
|
const height = (Math.abs(d.data[0].value) / pyramidTotalValue) * pyramidHeight;
|
|
80
80
|
stackHeightArray.push(stackHeightArray[i] + height);
|
|
81
81
|
});
|
|
@@ -86,7 +86,7 @@ const PyramidChart = ({ data, formatOptions, chartId, }) => {
|
|
|
86
86
|
};
|
|
87
87
|
const drawPyramidChart = () => {
|
|
88
88
|
try {
|
|
89
|
-
|
|
89
|
+
seriesData.forEach((d, i) => {
|
|
90
90
|
try {
|
|
91
91
|
const yTop = stackHeightArray[i];
|
|
92
92
|
const yBottom = stackHeightArray[i + 1];
|
|
@@ -315,7 +315,7 @@ const PyramidChart = ({ data, formatOptions, chartId, }) => {
|
|
|
315
315
|
? chartFormatOptions.annotation.connectorType.toLowerCase()
|
|
316
316
|
: "none";
|
|
317
317
|
annotationsList = [];
|
|
318
|
-
|
|
318
|
+
seriesData.forEach((d, i) => {
|
|
319
319
|
try {
|
|
320
320
|
let singleAnnotation = {
|
|
321
321
|
note: {
|
|
@@ -16,7 +16,7 @@ function logError(fileName, functionName, error) {
|
|
|
16
16
|
}
|
|
17
17
|
const RadialBarChart = ({ data, formatOptions, chartId, }) => {
|
|
18
18
|
const svgRef = useRef(); // Reference to the SVG element
|
|
19
|
-
const seriesData = generalizedChartData(data); // Input data for the chart, expected to be in TSeries format
|
|
19
|
+
const seriesData = generalizedChartData(data.ChartData); // Input data for the chart, expected to be in TSeries format
|
|
20
20
|
let chartFormatOptions; // Data for the pie chart, expected to be in TSeries format
|
|
21
21
|
let width; // svg total width
|
|
22
22
|
let height; // svg total height
|
|
@@ -48,7 +48,7 @@ const RadialBarChart = ({ data, formatOptions, chartId, }) => {
|
|
|
48
48
|
const loopOverChartData = () => {
|
|
49
49
|
try {
|
|
50
50
|
pieTotalValue = 0;
|
|
51
|
-
|
|
51
|
+
seriesData.forEach((d) => {
|
|
52
52
|
pieTotalValue += d.data[0].value;
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -58,8 +58,8 @@ const RadialBarChart = ({ data, formatOptions, chartId, }) => {
|
|
|
58
58
|
};
|
|
59
59
|
const initRadialBarChart = () => {
|
|
60
60
|
try {
|
|
61
|
-
let scaleMaxValue =
|
|
62
|
-
? d3.max(
|
|
61
|
+
let scaleMaxValue = seriesData.length > 1
|
|
62
|
+
? d3.max(seriesData, (d) => d.data[0].value) * 1.1
|
|
63
63
|
: data[0].data[0].value * 1.1;
|
|
64
64
|
let valuefontStyle = chartFormatOptions.plotArea.dataLabelValueFontStyle;
|
|
65
65
|
let maxDim = getNumberWithFormatFunction(chartFormatOptions.plotArea.plotAreaDisplayUnits, chartFormatOptions.plotArea.axialAxisDataLabelNumberFormat, chartFormatOptions.plotArea.axialAxisDataLabelDecimalPrecision)(scaleMaxValue);
|
|
@@ -72,7 +72,7 @@ const RadialBarChart = ({ data, formatOptions, chartId, }) => {
|
|
|
72
72
|
.attr("transform", getPiePosition())
|
|
73
73
|
.attr("width", innerWidth)
|
|
74
74
|
.attr("height", innerHeight);
|
|
75
|
-
const piConstant = Math.PI, arcMinRadius =
|
|
75
|
+
const piConstant = Math.PI, arcMinRadius = seriesData.length > 1 ? 10 : 70, arcPadding = convertStringToNumber(chartFormatOptions.plotArea.arcPadding), numTicks = convertStringToNumber(chartFormatOptions.plotArea.axialTicks);
|
|
76
76
|
let scale = d3
|
|
77
77
|
.scaleLinear()
|
|
78
78
|
.domain([0, scaleMaxValue])
|
|
@@ -82,8 +82,8 @@ const RadialBarChart = ({ data, formatOptions, chartId, }) => {
|
|
|
82
82
|
tempTicks.pop(); // remove the last tick if it equals the max value which will ovelap with 0 value
|
|
83
83
|
}
|
|
84
84
|
let ticks = tempTicks;
|
|
85
|
-
let keys =
|
|
86
|
-
let sumofmeasure =
|
|
85
|
+
let keys = seriesData.map((d, i) => d.data[0].legend);
|
|
86
|
+
let sumofmeasure = seriesData.reduce((accumulator, currentValue) => accumulator + currentValue.data[0].value, 0);
|
|
87
87
|
const numArcs = keys.length;
|
|
88
88
|
const arcWidth = (chartRadius - arcMinRadius - numArcs * arcPadding) / numArcs;
|
|
89
89
|
let arc = d3
|
|
@@ -7,7 +7,7 @@ import { logError } from "../../../../Services/ErrorLog";
|
|
|
7
7
|
import { chartMargins } from "../../Core/DefaultProperties.types";
|
|
8
8
|
const Speedometer = ({ data, formatOptions, chartId, }) => {
|
|
9
9
|
const svgRef = useRef();
|
|
10
|
-
const seriesData = generalizedChartData(data);
|
|
10
|
+
const seriesData = generalizedChartData(data.ChartData);
|
|
11
11
|
let chartFormatOptions;
|
|
12
12
|
let width; // svg total width
|
|
13
13
|
let height; // svg total height
|
|
@@ -333,7 +333,7 @@ const Speedometer = ({ data, formatOptions, chartId, }) => {
|
|
|
333
333
|
.attr("visibility", (d) => (d === "" ? "hidden" : "visible"));
|
|
334
334
|
}
|
|
335
335
|
if (chartFormatOptions.pointerValue.showPointerValue &&
|
|
336
|
-
|
|
336
|
+
seriesData.length === 2) {
|
|
337
337
|
setPointerValueText(positionTransformString);
|
|
338
338
|
}
|
|
339
339
|
let lineData = [
|
|
@@ -414,9 +414,9 @@ const Speedometer = ({ data, formatOptions, chartId, }) => {
|
|
|
414
414
|
maxValue: gaugeMaxMeasure,
|
|
415
415
|
transitionMs: 0,
|
|
416
416
|
});
|
|
417
|
-
if (
|
|
418
|
-
for (let i = 0; i <
|
|
419
|
-
powerGauge.render(setPointerofSpeedometer(
|
|
417
|
+
if (seriesData.length > 0) {
|
|
418
|
+
for (let i = 0; i < seriesData.length; i++)
|
|
419
|
+
powerGauge.render(setPointerofSpeedometer(seriesData[i], i), i);
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
catch (error) {
|
|
@@ -12,7 +12,7 @@ import { logError } from "../../../../Services/ErrorLog";
|
|
|
12
12
|
const fileName = "DonutChart.tsx";
|
|
13
13
|
const DonutChart = ({ data, formatOptions, chartId, }) => {
|
|
14
14
|
const svgRef = useRef();
|
|
15
|
-
const seriesData = generalizedChartData(data);
|
|
15
|
+
const seriesData = generalizedChartData(data.ChartData);
|
|
16
16
|
let chartFormatOptions;
|
|
17
17
|
let width; // svg total width
|
|
18
18
|
let height; // svg total height
|
|
@@ -51,7 +51,7 @@ const DonutChart = ({ data, formatOptions, chartId, }) => {
|
|
|
51
51
|
const loopOverSeriesData = () => {
|
|
52
52
|
try {
|
|
53
53
|
pieTotalValue = 0;
|
|
54
|
-
|
|
54
|
+
seriesData.forEach((d) => {
|
|
55
55
|
d.properties.dataLabelPosition == "2"
|
|
56
56
|
? (outsideDataLabelFlag = true)
|
|
57
57
|
: null;
|
|
@@ -81,7 +81,7 @@ const DonutChart = ({ data, formatOptions, chartId, }) => {
|
|
|
81
81
|
.value((d) => d.data[0].value)
|
|
82
82
|
.startAngle(((rotationAngle ?? 0) * (Math.PI / 180)) % 360)
|
|
83
83
|
.endAngle((((rotationAngle ?? 0) + 360) * (Math.PI / 180)) % 360);
|
|
84
|
-
let pieData = pie(
|
|
84
|
+
let pieData = pie(seriesData);
|
|
85
85
|
pieChartData = pieData?.map((d, i) => ({
|
|
86
86
|
...d,
|
|
87
87
|
x0: d.startAngle,
|