pace-chart-lib 0.0.9 → 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/ChartsWithAxisTypes.types.d.ts +1 -1
- 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
|
@@ -103,7 +103,7 @@ const AreaChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
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
|
|
@@ -164,7 +164,7 @@ const AreaChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
164
164
|
chartJSON.chartData = allChartData;
|
|
165
165
|
chartJSON.legendList = legendList;
|
|
166
166
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
167
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
167
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
168
168
|
chartJSON.yMaxRight = yMaxRight;
|
|
169
169
|
chartJSON.yMinRight = yMinRight;
|
|
170
170
|
// Apply formatted dimensions
|
|
@@ -172,7 +172,7 @@ const AreaChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
172
172
|
formatedDimesionList =
|
|
173
173
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
174
174
|
xAxisObject.dataType === "DATE"
|
|
175
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
175
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
176
176
|
: chartJSON.dimensionList;
|
|
177
177
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
178
178
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -197,9 +197,10 @@ const AreaChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions, })
|
|
|
197
197
|
yScaleLeft = d3
|
|
198
198
|
.scaleLinear()
|
|
199
199
|
.domain([
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
chartJSON.yMinLeft >= 0 ?
|
|
201
|
+
customYaxisMinValue !== undefined &&
|
|
202
|
+
!Number.isNaN(customYaxisMinValue)
|
|
203
|
+
? customYaxisMinValue : 0
|
|
203
204
|
: chartJSON.yMinLeft < 0
|
|
204
205
|
? chartJSON.yMinLeft * 1.1
|
|
205
206
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -113,7 +113,7 @@ const NormalizedStackAreaChart = ({ 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 NormalizedStackAreaChart = ({ 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 StackAreaChart = ({ 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 StackAreaChart = ({ 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 StackAreaChart = ({ 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,
|
|
@@ -40,6 +40,8 @@ export declare function getYAxisLabel(formatOptions: TDefaultChartFormatOptionsT
|
|
|
40
40
|
* @param {string[]} dimensionList - Array of dimension labels used for X-axis.
|
|
41
41
|
* @param {number} yMaxRight - Maximum value for scaling the secondary Y-axis.
|
|
42
42
|
* @param {boolean} isSecondaryAxisDrawn - Flag indicating whether the secondary Y-axis is displayed.
|
|
43
|
+
* @param {any} xAxisObj - Object containing properties related to the X-axis.
|
|
44
|
+
* @param {boolean} isBarChart - Flag indicating whether the chart is a bar chart.
|
|
43
45
|
*
|
|
44
46
|
* @returns {{
|
|
45
47
|
* margin: TMargin,
|
|
@@ -54,7 +56,7 @@ export declare function getYAxisLabel(formatOptions: TDefaultChartFormatOptionsT
|
|
|
54
56
|
* secondaryAxisTitleWidth: number
|
|
55
57
|
* }} Object containing calculated margins and supporting layout measurements.
|
|
56
58
|
*/
|
|
57
|
-
export declare function marginCalculation(windowWidth: number, windowHeight: number, maxNumberForPrimaryAxis: number, maxNumberForSecondaryAxis: number, yMaxLeft: number, formatOptions: TDefaultChartFormatOptionsType, legendList: string[], dimensionList: string[], yMaxRight: number, isSecondaryAxisDrawn: boolean, isNormalizedChart: boolean): {
|
|
59
|
+
export declare function marginCalculation(windowWidth: number, windowHeight: number, maxNumberForPrimaryAxis: number, maxNumberForSecondaryAxis: number, yMaxLeft: number, formatOptions: TDefaultChartFormatOptionsType, legendList: string[], dimensionList: string[], yMaxRight: number, isSecondaryAxisDrawn: boolean, isNormalizedChart: boolean, xAxisObject: any, isBarChart?: boolean): {
|
|
58
60
|
margin: TMargin;
|
|
59
61
|
yLabel: any;
|
|
60
62
|
xLabel: number;
|
|
@@ -380,10 +382,11 @@ export declare function setXaxistitle(formatOptions: TDefaultChartFormatOptionsT
|
|
|
380
382
|
* @param {TMargin} margin - Margins around the chart.
|
|
381
383
|
* @param {number} yTitle - Height allocated for the Y-axis title element.
|
|
382
384
|
* @param {number} yLabel - Offset for the Y-axis label, used for positioning.
|
|
385
|
+
* @param {number} width - Width allocated for the Y-axis title element.
|
|
383
386
|
*
|
|
384
387
|
* @returns {any} The SVG selection with the appended Y-axis title.
|
|
385
388
|
*/
|
|
386
|
-
export declare function yAxistitle(innerHeight: number, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, barChart: boolean, svg: any, margin: TMargin, yTitle: number, yLabel: number): any;
|
|
389
|
+
export declare function yAxistitle(innerHeight: number, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, barChart: boolean, svg: any, margin: TMargin, yTitle: number, yLabel: number, width?: number): any;
|
|
387
390
|
/**
|
|
388
391
|
* Adds a Y-axis title on the right side (secondary axis) of the chart,
|
|
389
392
|
* handling visibility, positioning, rotation, and styling based on format options.
|
|
@@ -123,6 +123,8 @@ export function getYAxisLabel(formatOptions, maxLegendLength) {
|
|
|
123
123
|
* @param {string[]} dimensionList - Array of dimension labels used for X-axis.
|
|
124
124
|
* @param {number} yMaxRight - Maximum value for scaling the secondary Y-axis.
|
|
125
125
|
* @param {boolean} isSecondaryAxisDrawn - Flag indicating whether the secondary Y-axis is displayed.
|
|
126
|
+
* @param {any} xAxisObj - Object containing properties related to the X-axis.
|
|
127
|
+
* @param {boolean} isBarChart - Flag indicating whether the chart is a bar chart.
|
|
126
128
|
*
|
|
127
129
|
* @returns {{
|
|
128
130
|
* margin: TMargin,
|
|
@@ -137,7 +139,7 @@ export function getYAxisLabel(formatOptions, maxLegendLength) {
|
|
|
137
139
|
* secondaryAxisTitleWidth: number
|
|
138
140
|
* }} Object containing calculated margins and supporting layout measurements.
|
|
139
141
|
*/
|
|
140
|
-
export function marginCalculation(windowWidth, windowHeight, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, yMaxLeft, formatOptions, legendList, dimensionList, yMaxRight, isSecondaryAxisDrawn, isNormalizedChart) {
|
|
142
|
+
export function marginCalculation(windowWidth, windowHeight, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, yMaxLeft, formatOptions, legendList, dimensionList, yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObject, isBarChart) {
|
|
141
143
|
try {
|
|
142
144
|
// min svg height/width final values are yet to decide.
|
|
143
145
|
let isDataTableDrawnWithAxis = formatOptions.dataTableProperties &&
|
|
@@ -146,8 +148,8 @@ export function marginCalculation(windowWidth, windowHeight, maxNumberForPrimary
|
|
|
146
148
|
// &&
|
|
147
149
|
// chartsWithDataTableArray.includes(chartType);
|
|
148
150
|
let isChartScrollable = !formatOptions.plotArea.fitChart;
|
|
149
|
-
let width = windowWidth < 200 ? 200 : windowWidth;
|
|
150
|
-
let height = windowHeight < 200 ? 200 : windowHeight;
|
|
151
|
+
let width = windowWidth < 200 ? 200 : isBarChart ? windowHeight : windowWidth;
|
|
152
|
+
let height = windowHeight < 200 ? 200 : isBarChart ? windowWidth : windowHeight;
|
|
151
153
|
let margin = { top: 0, left: 0, right: 0, bottom: 0 };
|
|
152
154
|
let width15Percent = width * 0.15 * 0.8;
|
|
153
155
|
let maxLegendWidth = calculateMaxLegendWidth(legendList, formatOptions);
|
|
@@ -159,8 +161,10 @@ export function marginCalculation(windowWidth, windowHeight, maxNumberForPrimary
|
|
|
159
161
|
: legend?.includes("-")
|
|
160
162
|
? legend?.slice(legend.indexOf("-") + 1).length
|
|
161
163
|
: legend?.length);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
165
|
+
xAxisObject.dataType === "DATE"
|
|
166
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, dimensionList).map((d) => d)
|
|
167
|
+
: dimensionList;
|
|
164
168
|
let maxDimension = formatedDimesionList
|
|
165
169
|
? formatedDimesionList[0] + ""
|
|
166
170
|
: "";
|
|
@@ -227,38 +231,49 @@ export function marginCalculation(windowWidth, windowHeight, maxNumberForPrimary
|
|
|
227
231
|
legendPosition = "None";
|
|
228
232
|
// if (chartType == "Waterfall" && !stackDataForTotals)
|
|
229
233
|
// legendPosition = "None";
|
|
234
|
+
let xAxisRelatedMargin = isBarChart ? (yTitle + yLabel) : (xTitle + xLabel);
|
|
235
|
+
let yAxisRelatedMargin = isBarChart ? (xTitle + xLabel) : (yTitle + yLabel);
|
|
236
|
+
// Swap xTitle <-> yTitle and xLabel <-> yLabel for bar charts
|
|
237
|
+
if (isBarChart) {
|
|
238
|
+
const tempTitle = xTitle;
|
|
239
|
+
xTitle = yTitle;
|
|
240
|
+
yTitle = tempTitle;
|
|
241
|
+
const tempLabel = xLabel;
|
|
242
|
+
xLabel = yLabel;
|
|
243
|
+
yLabel = tempLabel;
|
|
244
|
+
}
|
|
230
245
|
switch (legendPosition) {
|
|
231
246
|
case staticLegendPosition.none:
|
|
232
247
|
// margin.top = (formatOptions.type == "Waterfall") ? Ctitle + 10 : Ctitle + (normalizedChart ? 12 : 0);
|
|
233
248
|
margin.top = chartTitleHeight + 5 + (isNormalizedChart ? 12 : 0);
|
|
234
|
-
margin.bottom =
|
|
249
|
+
margin.bottom = xAxisRelatedMargin + 5 + (isChartScrollable ? 20 : 0);
|
|
235
250
|
margin.right =
|
|
236
251
|
15 + (isSecondaryAxisDrawn ? secondaryYLabel + secondaryAxisTitleWidth : 0);
|
|
237
|
-
margin.left =
|
|
252
|
+
margin.left = yAxisRelatedMargin + 5;
|
|
238
253
|
break;
|
|
239
254
|
case staticLegendPosition.top:
|
|
240
255
|
margin.top = 40 + chartTitleHeight + (isNormalizedChart ? 12 : 0);
|
|
241
|
-
margin.bottom =
|
|
256
|
+
margin.bottom = xAxisRelatedMargin + 5 + (isChartScrollable ? 20 : 0);
|
|
242
257
|
margin.right =
|
|
243
258
|
15 + (isSecondaryAxisDrawn ? secondaryYLabel + secondaryAxisTitleWidth : 0);
|
|
244
|
-
margin.left =
|
|
259
|
+
margin.left = yAxisRelatedMargin + 5;
|
|
245
260
|
break;
|
|
246
261
|
case staticLegendPosition.right:
|
|
247
262
|
margin.right = legendMargin + (isSecondaryAxisDrawn ? secondaryYLabel + secondaryAxisTitleWidth : 0) + 35;
|
|
248
263
|
margin.top = chartTitleHeight + 5 + (isNormalizedChart ? 12 : 0);
|
|
249
|
-
margin.bottom =
|
|
250
|
-
margin.left =
|
|
264
|
+
margin.bottom = xAxisRelatedMargin + 5 + (isChartScrollable ? 20 : 0);
|
|
265
|
+
margin.left = yAxisRelatedMargin + 5;
|
|
251
266
|
break;
|
|
252
267
|
case staticLegendPosition.bottom:
|
|
253
|
-
margin.bottom = 40 +
|
|
268
|
+
margin.bottom = 40 + xAxisRelatedMargin + (isChartScrollable ? 20 : 0);
|
|
254
269
|
margin.top = chartTitleHeight + 5 + (isNormalizedChart ? 12 : 0);
|
|
255
270
|
margin.right = 15 + (isSecondaryAxisDrawn ? secondaryYLabel + secondaryAxisTitleWidth : 0);
|
|
256
|
-
margin.left =
|
|
271
|
+
margin.left = yAxisRelatedMargin + 5;
|
|
257
272
|
break;
|
|
258
273
|
case staticLegendPosition.left:
|
|
259
|
-
margin.left = legendMargin +
|
|
274
|
+
margin.left = legendMargin + yAxisRelatedMargin + 33;
|
|
260
275
|
margin.top = chartTitleHeight + 5 + (isNormalizedChart ? 12 : 0);
|
|
261
|
-
margin.bottom =
|
|
276
|
+
margin.bottom = xAxisRelatedMargin + 5 + (isChartScrollable ? 20 : 0);
|
|
262
277
|
margin.right = 15 + (isSecondaryAxisDrawn ? secondaryYLabel + secondaryAxisTitleWidth : 0);
|
|
263
278
|
}
|
|
264
279
|
// margin.top = margin.top > 25 ? margin.top : 25;
|
|
@@ -487,7 +502,7 @@ export function customYscaleLabelFormatting(formatOptions, YminLeft, YmaxLeft, Y
|
|
|
487
502
|
? getNumberWithFormat(secondaryCustomYaxisMinValue, formatOptions.secondaryYAxisLabel.secondaryYAxisDisplayUnits, formatOptions.secondaryYAxisLabel.secondaryYAxisNumberFormat, formatOptions.secondaryYAxisLabel.secondaryYAxisLabelDecimalPrecision ?? "2").toString().length
|
|
488
503
|
: 0;
|
|
489
504
|
// primary scale : margin adjustments
|
|
490
|
-
let maxNumberForPrimaryAxis = yMinLength < yMaxLength ? YmaxLeft : YminLeft;
|
|
505
|
+
let maxNumberForPrimaryAxis = yMinLength < yMaxLength ? YmaxLeft : yMinLength === yMaxLength ? YmaxLeft : YminLeft;
|
|
491
506
|
if (customYaxisMinValue) {
|
|
492
507
|
let tempLength = customYaxisMinValueLength < yMaxLength ? YmaxLeft : customYaxisMinValue;
|
|
493
508
|
maxNumberForPrimaryAxis =
|
|
@@ -1000,7 +1015,7 @@ export function getLabelsFromAlgo(dataMin, dataMax, axisLengthPx, labelWidthPx =
|
|
|
1000
1015
|
if (dataRange === 0) {
|
|
1001
1016
|
return [dataMin];
|
|
1002
1017
|
}
|
|
1003
|
-
const maxLabels = dataRange < 10 ?
|
|
1018
|
+
const maxLabels = dataRange < 10 ? 10 : Math.max(2, Math.floor(axisLengthPx / labelWidthPx));
|
|
1004
1019
|
const rawInterval = dataRange / maxLabels;
|
|
1005
1020
|
const magnitude = Math.pow(10, Math.floor(Math.log10(rawInterval)));
|
|
1006
1021
|
const niceNumbers = [1, 1.5, 2, 2.5, 5, 10];
|
|
@@ -1233,7 +1248,7 @@ export function initXaxis(gTag, chartJSON, xLabel, formatOptions, xAxisObj, data
|
|
|
1233
1248
|
formatedResponsiveDimList =
|
|
1234
1249
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
1235
1250
|
dataType === "DATE"
|
|
1236
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, responsiveDimList.map((d) => d)).map((d) => d
|
|
1251
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, responsiveDimList.map((d) => d)).map((d) => d)
|
|
1237
1252
|
: responsiveDimList;
|
|
1238
1253
|
}
|
|
1239
1254
|
else {
|
|
@@ -1623,10 +1638,11 @@ export function setXaxistitle(formatOptions, barChart, svg, margin, xLabel, heig
|
|
|
1623
1638
|
* @param {TMargin} margin - Margins around the chart.
|
|
1624
1639
|
* @param {number} yTitle - Height allocated for the Y-axis title element.
|
|
1625
1640
|
* @param {number} yLabel - Offset for the Y-axis label, used for positioning.
|
|
1641
|
+
* @param {number} width - Width allocated for the Y-axis title element.
|
|
1626
1642
|
*
|
|
1627
1643
|
* @returns {any} The SVG selection with the appended Y-axis title.
|
|
1628
1644
|
*/
|
|
1629
|
-
export function yAxistitle(innerHeight, formatOptions, dataTableHeight, barChart, svg, margin, yTitle, yLabel) {
|
|
1645
|
+
export function yAxistitle(innerHeight, formatOptions, dataTableHeight, barChart, svg, margin, yTitle, yLabel, width) {
|
|
1630
1646
|
try {
|
|
1631
1647
|
let currentInnerHeight = dataTableHeight > 0
|
|
1632
1648
|
? innerHeight - dataTableHeight
|
|
@@ -4341,10 +4357,10 @@ export function stacklineAnnotations(chartData, xScale, yScaleLeft, yScaleRight,
|
|
|
4341
4357
|
break;
|
|
4342
4358
|
case "6":
|
|
4343
4359
|
chartData.forEach((d) => {
|
|
4344
|
-
let annotationVisibility = d.
|
|
4360
|
+
let annotationVisibility = d.individualAnnotationVisibility;
|
|
4345
4361
|
switch (annotationVisibility) {
|
|
4346
4362
|
case "1":
|
|
4347
|
-
for (let i = 0; i < chartData[0].
|
|
4363
|
+
for (let i = 0; i < chartData[0].length; i++) {
|
|
4348
4364
|
labelData.push(d[i]);
|
|
4349
4365
|
}
|
|
4350
4366
|
break;
|
|
@@ -4355,11 +4371,11 @@ export function stacklineAnnotations(chartData, xScale, yScaleLeft, yScaleRight,
|
|
|
4355
4371
|
labelData.push(d[0]);
|
|
4356
4372
|
break;
|
|
4357
4373
|
case "4":
|
|
4358
|
-
labelData.push(d[chartData[0].
|
|
4374
|
+
labelData.push(d[chartData[0].length - 1]);
|
|
4359
4375
|
break;
|
|
4360
4376
|
case "5":
|
|
4361
4377
|
labelData.push(d[0]);
|
|
4362
|
-
labelData.push(d[chartData[0].
|
|
4378
|
+
labelData.push(d[chartData[0].length - 1]);
|
|
4363
4379
|
break;
|
|
4364
4380
|
}
|
|
4365
4381
|
});
|
|
@@ -4683,19 +4699,20 @@ export const initYaxisBar = (formatOptions, gTag, xLabel, innerHeight, innerWidt
|
|
|
4683
4699
|
let xaxisLabelPosition = parseInt(formatOptions.xAxisLabel.xAxisPosition);
|
|
4684
4700
|
let responsiveDimList = responsiveXaxisLabel(dimensionList, innerWidth);
|
|
4685
4701
|
let labelWidth = formatOptions.xAxisLabel.labelTextWrap ? ((dimensionHeightWidthArray[3] + 10) < width * 0.1) ? (dimensionHeightWidthArray[3] + 10) : width * 0.1 : (formatOptions.xAxisLabel.xAxisLabelRotation == 0 ? columnWidth : (dimensionHeightWidthArray[0] + 5));
|
|
4702
|
+
let xLabelMargin = (formatOptions.xAxisLabel.labelTextWrap) ? xLabel : labelWidth;
|
|
4686
4703
|
let formatedResponsiveDimList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
4687
4704
|
xAxisObject.dataType === "DATE"
|
|
4688
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, responsiveDimList.map((d) => d)).map((d) => d
|
|
4705
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, responsiveDimList.map((d) => d)).map((d) => d)
|
|
4689
4706
|
: responsiveDimList;
|
|
4690
4707
|
gTag
|
|
4691
4708
|
.append("rect")
|
|
4692
|
-
.attr("transform", chartType === actualChartTypes.tornadoChart ? `translate(${-
|
|
4693
|
-
? (-
|
|
4709
|
+
.attr("transform", chartType === actualChartTypes.tornadoChart ? `translate(${-xLabelMargin - 20},0)` : `translate(${xaxisLabelPosition === 0
|
|
4710
|
+
? (-xLabelMargin - 5)
|
|
4694
4711
|
: xaxisLabelPosition === 1
|
|
4695
4712
|
? innerWidth
|
|
4696
|
-
: (xScaleBottom(0) + (-
|
|
4713
|
+
: (xScaleBottom(0) + (-xLabelMargin - 5))},0)`)
|
|
4697
4714
|
.attr("height", innerHeight)
|
|
4698
|
-
.attr("width", chartType === actualChartTypes.tornadoChart ?
|
|
4715
|
+
.attr("width", chartType === actualChartTypes.tornadoChart ? xLabelMargin + 20 : xLabelMargin + 5)
|
|
4699
4716
|
.attr("fill", formatOptions.xAxisLabel.xAxisLabelVisibility
|
|
4700
4717
|
? formatOptions.xAxisLabel.xAxisBackgroundColor
|
|
4701
4718
|
? formatOptions.xAxisLabel.xAxisBackgroundColor !== "#ffffff"
|
|
@@ -4714,10 +4731,10 @@ export const initYaxisBar = (formatOptions, gTag, xLabel, innerHeight, innerWidt
|
|
|
4714
4731
|
let foreignObject = YaxisG.selectAll("g")
|
|
4715
4732
|
.append("foreignObject")
|
|
4716
4733
|
.attr("class", "testingoverflowing")
|
|
4717
|
-
.attr("width",
|
|
4734
|
+
.attr("width", xLabelMargin)
|
|
4718
4735
|
.attr("height", "20px")
|
|
4719
4736
|
.attr("transform", `rotate(${90 - formatOptions.xAxisLabel.xAxisLabelRotation})
|
|
4720
|
-
translate(${formatOptions.xAxisLabel.xAxisLabelRotation != 0 ? `${xaxisLabelPosition === 1 ? 10 : -
|
|
4737
|
+
translate(${formatOptions.xAxisLabel.xAxisLabelRotation != 0 ? `${xaxisLabelPosition === 1 ? 10 : -xLabelMargin},${-10}` : -labelWidth / 2 + " ,2"})`);
|
|
4721
4738
|
foreignObject
|
|
4722
4739
|
.append("xhtml:h3")
|
|
4723
4740
|
.style("white-space", "pre")
|
|
@@ -57,7 +57,7 @@ export type TChartProps = {
|
|
|
57
57
|
yAxisObj: IYaxisData[];
|
|
58
58
|
xAxisObj: IXaxisData[];
|
|
59
59
|
chartId: string;
|
|
60
|
-
formatOptions
|
|
60
|
+
formatOptions?: TDefaultChartFormatOptionsType;
|
|
61
61
|
};
|
|
62
62
|
export type TChartJSON = {
|
|
63
63
|
dimensionList: string[];
|
|
@@ -102,7 +102,7 @@ const ColumnChart = ({ 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
|
|
@@ -157,7 +157,7 @@ const ColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
|
|
|
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 ColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
|
|
|
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 ColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOptions,
|
|
|
190
190
|
yScaleLeft = 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,
|
|
@@ -107,7 +107,7 @@ const ColumnHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, format
|
|
|
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
|
|
@@ -152,7 +152,7 @@ const ColumnHistogramChart = ({ title, data, yAxisObj, xAxisObj, chartId, format
|
|
|
152
152
|
chartJSON.chartData = allChartData;
|
|
153
153
|
chartJSON.legendList = legendList;
|
|
154
154
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
155
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
155
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
156
156
|
filteredData = JSON.parse(JSON.stringify(seriesData));
|
|
157
157
|
filteredData.forEach((d) => d.data.forEach((j) => cumulativeDataPoints.push(j.value)));
|
|
158
158
|
let yMin = (customYaxisMinValue || customYaxisMinValue == 0) ? customYaxisMinValue : 0;
|
|
@@ -116,7 +116,7 @@ const CustomColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpt
|
|
|
116
116
|
secondaryYLabel,
|
|
117
117
|
} = marginCalculation(
|
|
118
118
|
// for all margin related calculations
|
|
119
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
119
|
+
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart, xAxisObj[0]));
|
|
120
120
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
121
121
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
122
122
|
// calculations for data tables
|
|
@@ -206,7 +206,7 @@ const CustomColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpt
|
|
|
206
206
|
chartJSON.chartData = tempChartData;
|
|
207
207
|
chartJSON.legendList = legendList;
|
|
208
208
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
209
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
209
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
210
210
|
chartJSON.yMaxRight = yMaxRight;
|
|
211
211
|
chartJSON.yMinRight = yMinRight;
|
|
212
212
|
// Apply formatted dimensions
|
|
@@ -214,7 +214,7 @@ const CustomColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpt
|
|
|
214
214
|
formatedDimesionList =
|
|
215
215
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
216
216
|
xAxisObject.dataType === "DATE"
|
|
217
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
217
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
218
218
|
: chartJSON.dimensionList;
|
|
219
219
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
220
220
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -325,9 +325,10 @@ const CustomColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpt
|
|
|
325
325
|
yScaleLeft = d3
|
|
326
326
|
.scaleLinear()
|
|
327
327
|
.domain([
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
328
|
+
chartJSON.yMinLeft >= 0 ?
|
|
329
|
+
customYaxisMinValue !== undefined &&
|
|
330
|
+
!Number.isNaN(customYaxisMinValue)
|
|
331
|
+
? customYaxisMinValue : 0
|
|
331
332
|
: chartJSON.yMinLeft < 0
|
|
332
333
|
? chartJSON.yMinLeft * 1.1
|
|
333
334
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -102,7 +102,7 @@ const LayeredColumnChart = ({ 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]));
|
|
106
106
|
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
107
107
|
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
108
108
|
// calculations for data tables
|
|
@@ -162,7 +162,7 @@ const LayeredColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
162
162
|
chartJSON.chartData = allChartData;
|
|
163
163
|
chartJSON.legendList = legendList;
|
|
164
164
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
165
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
165
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
166
166
|
chartJSON.yMaxRight = yMaxRight;
|
|
167
167
|
chartJSON.yMinRight = yMinRight;
|
|
168
168
|
// Apply formatted dimensions
|
|
@@ -170,7 +170,7 @@ const LayeredColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
170
170
|
formatedDimesionList =
|
|
171
171
|
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
172
172
|
xAxisObject.dataType === "DATE"
|
|
173
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
173
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
174
174
|
: chartJSON.dimensionList;
|
|
175
175
|
chartJSON.dimensionList.forEach((dim, i) => {
|
|
176
176
|
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
@@ -201,9 +201,10 @@ const LayeredColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOp
|
|
|
201
201
|
yScaleLeft = d3
|
|
202
202
|
.scaleLinear()
|
|
203
203
|
.domain([
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
chartJSON.yMinLeft >= 0 ?
|
|
205
|
+
customYaxisMinValue !== undefined &&
|
|
206
|
+
!Number.isNaN(customYaxisMinValue)
|
|
207
|
+
? customYaxisMinValue : 0
|
|
207
208
|
: chartJSON.yMinLeft < 0
|
|
208
209
|
? chartJSON.yMinLeft * 1.1
|
|
209
210
|
: chartJSON.yMinLeft * 0.9,
|
|
@@ -107,7 +107,7 @@ const NormalizedStackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId,
|
|
|
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
|
|
@@ -183,12 +183,12 @@ const NormalizedStackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId,
|
|
|
183
183
|
yMinLeft = Math.min(yMinLeft, start);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
186
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
187
187
|
chartJSON.yMaxLeft = 1; // as per your original override
|
|
188
188
|
let xAxisObject = xAxisObj[0];
|
|
189
189
|
let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
190
190
|
xAxisObject.dataType === "DATE"
|
|
191
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
191
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
192
192
|
: chartJSON.dimensionList;
|
|
193
193
|
chartJSON.dimensionList.forEach((d, i) => {
|
|
194
194
|
chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
|
|
@@ -291,7 +291,7 @@ const NormalizedStackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId,
|
|
|
291
291
|
.scaleBand()
|
|
292
292
|
.domain(filteredDimension)
|
|
293
293
|
.range(calculatedRange)
|
|
294
|
-
.padding(0.
|
|
294
|
+
.padding(0.3 * parseFloat(formatOptions.plotArea.plotAreaGapWidth) / 100);
|
|
295
295
|
};
|
|
296
296
|
const initAxis = () => {
|
|
297
297
|
getXAxis();
|
|
@@ -522,6 +522,7 @@ const NormalizedStackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId,
|
|
|
522
522
|
stackChartData.forEach((K, j) => K.forEach((d) => {
|
|
523
523
|
d["key"] = K.key;
|
|
524
524
|
K["color"] = JSON.parse(JSON.stringify(seriesData[j].properties.color));
|
|
525
|
+
K["individualAnnotationVisibility"] = JSON.parse(JSON.stringify(seriesData[j].properties.individualAnnotationVisibility));
|
|
525
526
|
d.data.labelPosition = seriesData[j].properties.dataLabelPosition;
|
|
526
527
|
d.data["labelColor"] =
|
|
527
528
|
seriesColor == "2"
|
|
@@ -107,7 +107,7 @@ const StackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpti
|
|
|
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
|
|
@@ -175,12 +175,12 @@ const StackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpti
|
|
|
175
175
|
yMaxLeft = Math.max(yMaxLeft, end);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
178
|
+
chartJSON.yMinLeft = yMinLeft > 0 ? 0 : yMinLeft;
|
|
179
179
|
chartJSON.yMaxLeft = yMaxLeft;
|
|
180
180
|
let xAxisObject = xAxisObj[0];
|
|
181
181
|
let formatedDimesionList = (xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
182
182
|
xAxisObject.dataType === "DATE"
|
|
183
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d
|
|
183
|
+
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d)
|
|
184
184
|
: chartJSON.dimensionList;
|
|
185
185
|
chartJSON.dimensionList.forEach((d, i) => {
|
|
186
186
|
chartJSON.formattedDimensionListMap.set(d, formatedDimesionList[i]);
|
|
@@ -227,9 +227,10 @@ const StackColumnChart = ({ title, data, yAxisObj, xAxisObj, chartId, formatOpti
|
|
|
227
227
|
yScaleLeft = d3
|
|
228
228
|
.scaleLinear()
|
|
229
229
|
.domain([
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
chartJSON.yMinLeft >= 0 ?
|
|
231
|
+
customYaxisMinValue !== undefined &&
|
|
232
|
+
!Number.isNaN(customYaxisMinValue)
|
|
233
|
+
? customYaxisMinValue : 0
|
|
233
234
|
: chartJSON.yMinLeft < 0
|
|
234
235
|
? chartJSON.yMinLeft * 1.1
|
|
235
236
|
: chartJSON.yMinLeft * 0.9,
|