pace-chart-lib 1.0.2 → 1.0.3

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 (131) hide show
  1. package/dist/{components → Components}/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +76 -38
  2. package/dist/{components → Components}/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.d.ts +4 -2
  3. package/dist/{components → Components}/Charts/Core/CommonFunctions.d.ts +3 -1
  4. package/dist/{components → Components}/Charts/Core/DefaultProperties.types.d.ts +2 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/pace-chart-lib.es.js +54619 -0
  7. package/dist/pace-chart-lib.umd.js +54622 -0
  8. package/dist/vite.svg +1 -0
  9. package/package.json +1 -1
  10. package/dist/Services/ErrorLog.js +0 -3
  11. package/dist/components/Charts/ChartsWithAxis/AreaFamily/AreaChart.js +0 -496
  12. package/dist/components/Charts/ChartsWithAxis/AreaFamily/LineChart.d.ts +0 -4
  13. package/dist/components/Charts/ChartsWithAxis/AreaFamily/LineChart.js +0 -491
  14. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.js +0 -517
  15. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackLineChart.d.ts +0 -4
  16. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackLineChart.js +0 -553
  17. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.js +0 -517
  18. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackLineChart.d.ts +0 -4
  19. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackLineChart.js +0 -553
  20. package/dist/components/Charts/ChartsWithAxis/BarFamily/BarChart.d.ts +0 -12
  21. package/dist/components/Charts/ChartsWithAxis/BarFamily/BarChart.js +0 -9
  22. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +0 -4909
  23. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.d.ts +0 -0
  24. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.js +0 -0
  25. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.js +0 -49
  26. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart copy.d.ts +0 -4
  27. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart copy.js +0 -486
  28. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.js +0 -497
  29. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.js +0 -418
  30. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.js +0 -1013
  31. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.js +0 -478
  32. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LineChart.d.ts +0 -4
  33. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LineChart.js +0 -451
  34. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.js +0 -533
  35. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackLineChart.js +0 -512
  36. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.js +0 -530
  37. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackLineChart.js +0 -512
  38. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/BarChart.d.ts +0 -12
  39. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/BarChart.js +0 -9
  40. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.js +0 -497
  41. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.js +0 -497
  42. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredColumnChart.d.ts +0 -4
  43. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredColumnChart.js +0 -479
  44. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.js +0 -478
  45. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.js +0 -473
  46. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.js +0 -465
  47. package/dist/components/Charts/ChartsWithAxis/LineFamily/100%StackLineChart.d.ts +0 -0
  48. package/dist/components/Charts/ChartsWithAxis/LineFamily/100%StackLineChart.js +0 -0
  49. package/dist/components/Charts/ChartsWithAxis/LineFamily/LineChart.js +0 -451
  50. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalisedStackLineChart.d.ts +0 -4
  51. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalisedStackLineChart.js +0 -554
  52. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.d.ts +0 -4
  53. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.js +0 -510
  54. package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.d.ts +0 -4
  55. package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.js +0 -507
  56. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.js +0 -393
  57. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.js +0 -606
  58. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxis.types.d.ts +0 -0
  59. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxis.types.js +0 -0
  60. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.js +0 -815
  61. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.d.ts +0 -0
  62. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.js +0 -0
  63. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.js +0 -32
  64. package/dist/components/Charts/ChartsWithoutAxis/Maps/Cordinates.js +0 -15021
  65. package/dist/components/Charts/ChartsWithoutAxis/Maps/Maps.js +0 -391
  66. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/BubbleChart.js +0 -367
  67. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.js +0 -570
  68. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.js +0 -212
  69. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.js +0 -401
  70. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.js +0 -313
  71. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/SankeyChart.js +0 -719
  72. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ScatterChart.js +0 -807
  73. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.js +0 -514
  74. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/VennChart.js +0 -282
  75. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/WordCloud.js +0 -207
  76. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/DonutChart.js +0 -476
  77. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieChart.js +0 -420
  78. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieFamilyCommonFunctions.js +0 -106
  79. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieofPieChart.js +0 -507
  80. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.js +0 -246
  81. package/dist/components/Charts/Core/Common.type.d.ts +0 -0
  82. package/dist/components/Charts/Core/Common.type.js +0 -0
  83. package/dist/components/Charts/Core/Common.types.js +0 -133
  84. package/dist/components/Charts/Core/CommonFunctions.js +0 -1782
  85. package/dist/components/Charts/Core/DefaultChartDataProperties.js +0 -64
  86. package/dist/components/Charts/Core/DefaultProperties.d.ts +0 -0
  87. package/dist/components/Charts/Core/DefaultProperties.js +0 -0
  88. package/dist/components/Charts/Core/DefaultProperties.type.d.ts +0 -586
  89. package/dist/components/Charts/Core/DefaultProperties.type.js +0 -585
  90. package/dist/components/Charts/Core/DefaultProperties.types.js +0 -592
  91. package/dist/index.js +0 -40
  92. /package/dist/{components → Components}/Charts/ChartsWithAxis/AreaFamily/AreaChart.d.ts +0 -0
  93. /package/dist/{components → Components}/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.d.ts +0 -0
  94. /package/dist/{components → Components}/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.d.ts +0 -0
  95. /package/dist/{components → Components}/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.d.ts +0 -0
  96. /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.d.ts +0 -0
  97. /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.d.ts +0 -0
  98. /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.d.ts +0 -0
  99. /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.d.ts +0 -0
  100. /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.d.ts +0 -0
  101. /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.d.ts +0 -0
  102. /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.d.ts +0 -0
  103. /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.d.ts +0 -0
  104. /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.d.ts +0 -0
  105. /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.d.ts +0 -0
  106. /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.d.ts +0 -0
  107. /package/dist/{components → Components}/Charts/ChartsWithAxis/LineFamily/LineChart.d.ts +0 -0
  108. /package/dist/{components/Charts/ChartsWithAxis/ColumnFamily → Components/Charts/ChartsWithAxis/LineFamily}/NormalizedStackLineChart.d.ts +0 -0
  109. /package/dist/{components/Charts/ChartsWithAxis/ColumnFamily → Components/Charts/ChartsWithAxis/LineFamily}/StackLineChart.d.ts +0 -0
  110. /package/dist/{components → Components}/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.d.ts +0 -0
  111. /package/dist/{components → Components}/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.d.ts +0 -0
  112. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.d.ts +0 -0
  113. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/Maps/Cordinates.d.ts +0 -0
  114. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/Maps/Maps.d.ts +0 -0
  115. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/BubbleChart.d.ts +0 -0
  116. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.d.ts +0 -0
  117. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.d.ts +0 -0
  118. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.d.ts +0 -0
  119. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.d.ts +0 -0
  120. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/SankeyChart.d.ts +0 -0
  121. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/ScatterChart.d.ts +0 -0
  122. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.d.ts +0 -0
  123. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/VennChart.d.ts +0 -0
  124. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/WordCloud.d.ts +0 -0
  125. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/DonutChart.d.ts +0 -0
  126. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/PieChart.d.ts +0 -0
  127. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/PieFamilyCommonFunctions.d.ts +0 -0
  128. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/PieofPieChart.d.ts +0 -0
  129. /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.d.ts +0 -0
  130. /package/dist/{components → Components}/Charts/Core/Common.types.d.ts +0 -0
  131. /package/dist/{components → Components}/Charts/Core/DefaultChartDataProperties.d.ts +0 -0
@@ -1,815 +0,0 @@
1
- import { calculateWidthHeightDynamically, getLabelsFromAlgo } from "../ChartsWithAxis/ChartsWithAxisFunctions";
2
- import { fontStyleOptions, staticLegendPosition } from "../Core/Common.types";
3
- import { convertStringToNumber, getNumberWithFormatFunction, preCalculateTextDimensions } from "../Core/CommonFunctions";
4
- const fileName = "ChartsWithoutAxisFunctions.ts";
5
- /**
6
- * Calculates margins for Bubble and Scatter charts based on various parameters.
7
- * @param width // Width of the chart container.
8
- * @param height // Height of the chart container.
9
- * @param maxMeasure // Maximum measure value.
10
- * @param formatOptions // Formatting options for the chart.
11
- * @param maxDimension // Maximum dimension value.
12
- * @param maxLegendDimensions // Maximum dimensions for the legend.
13
- * @returns /** An object containing calculated margins and other related dimensions.
14
- */
15
- export function marginCalculationForBubbleScatter(width, height, maxMeasure, formatOptions, maxDimension, maxLegendDimensions) {
16
- try {
17
- // chartsWithDataTableArray.includes(chartType);
18
- let margins = { top: 0, left: 0, right: 0, bottom: 0 };
19
- let width15Percent = width * 0.15 * 0.8;
20
- let maxLegendWidth = maxLegendDimensions[0];
21
- let legendMargin = width15Percent < maxLegendWidth + 10
22
- ? width15Percent
23
- : maxLegendWidth + 10;
24
- // (xAxisObject.GroupBy == "NA" || xAxisObject.GroupBy == undefined) ? parentReference.dataModifierService.setDateFormats(xAxisObject.Name.name, basestyle.xAxisLabel.xAxisNumberFormat,chartData.dimensionList.map(d=>[d]),xAxisObject.Name.dataSourceId).map(d=> d[0]): chartData.dimensionList;
25
- let totalHeight = formatOptions.plotArea.numberOfBubbles ? 20 : 0;
26
- let dimensionHeightWidth = preCalculateTextDimensions(getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision ?? "2")(maxDimension).toString(), convertStringToNumber(formatOptions.xAxisLabel.xAxisLabelFontSize), formatOptions.xAxisLabel.xAxisLabelFontFamily, formatOptions.xAxisLabel.xAxisLabelRotation);
27
- let maxDimensionWidth = dimensionHeightWidth.width + 10;
28
- let xTitle = formatOptions.xAxisTitle.xAxisTitleVisibility
29
- ? formatOptions.xAxisTitle.xAxisDynamicTitleText.length !== 0
30
- ? preCalculateTextDimensions(formatOptions.xAxisTitle.xAxisTitleHTML, undefined, undefined).height
31
- : preCalculateTextDimensions(formatOptions.xAxisTitle.xAxisTitleText, 13, "Helvetica").height
32
- : 0;
33
- xTitle = xTitle > height * 0.1 ? height * 0.1 : xTitle;
34
- let xLabel = formatOptions.xAxisLabel.xAxisLabelVisibility
35
- ? maxDimensionWidth
36
- : 0;
37
- let yTitle = formatOptions.yAxisTitle.yAxisTitleVisibility
38
- ? formatOptions.yAxisTitle.yAxisDynamicTitleText.length !== 0
39
- ? preCalculateTextDimensions(formatOptions.yAxisTitle.yAxisTitleHTML, undefined, undefined).height
40
- : preCalculateTextDimensions(formatOptions.yAxisTitle.yAxisTitleText, 13, "Helvetica").height
41
- : 0;
42
- yTitle = yTitle > width * 0.1 ? width * 0.1 : yTitle;
43
- let yLabel = formatOptions.yAxisLabel.yAxisLabelVisibility
44
- ? preCalculateTextDimensions(getNumberWithFormatFunction(formatOptions.yAxisLabel.yAxisDisplayUnits, formatOptions.yAxisLabel.yAxisNumberFormat, formatOptions.yAxisLabel.yAxisLabelDecimalPrecision ?? "2")(maxMeasure).toString(), convertStringToNumber(formatOptions.yAxisLabel.yAxisLabelFontSize), formatOptions.yAxisLabel.yAxisLabelFontFamily, formatOptions.yAxisLabel.yAxisLabelRotation).width + 10
45
- : 0;
46
- let chartTitleHeight = formatOptions.chartTitle.chartTitleVisibility
47
- ? formatOptions.chartTitle.dynamicTitleText.length !== 0
48
- ? preCalculateTextDimensions(formatOptions.chartTitle.chartTitleHTML, undefined, undefined).height
49
- : preCalculateTextDimensions(formatOptions.chartTitle.chartTitleText, 16, "Helvetica").height
50
- : 0;
51
- chartTitleHeight =
52
- chartTitleHeight > height * 0.1 ? height * 0.1 : chartTitleHeight;
53
- let legendPosition = formatOptions.legends.legendPosition;
54
- let legendVisibility = formatOptions.legends.legendVisibility;
55
- let stackDataForTotals = false;
56
- if (!legendVisibility)
57
- legendPosition = "None";
58
- // if (chartType == "Waterfall" && !stackDataForTotals)
59
- // legendPosition = "None";
60
- switch (legendPosition) {
61
- case staticLegendPosition.none:
62
- // margin.top = (formatOptions.type == "Waterfall") ? Ctitle + 10 : Ctitle + (normalizedChart ? 12 : 0);
63
- margins.top = chartTitleHeight + 5;
64
- margins.bottom = xTitle + xLabel + 5 + totalHeight;
65
- margins.right =
66
- 15;
67
- margins.left = yTitle + yLabel + 5;
68
- break;
69
- case staticLegendPosition.top:
70
- margins.top = 40 + chartTitleHeight;
71
- margins.bottom = xTitle + xLabel + 5 + totalHeight;
72
- ;
73
- margins.right =
74
- 15;
75
- margins.left = yTitle + yLabel + 5;
76
- break;
77
- case staticLegendPosition.right:
78
- margins.right = legendMargin + 35;
79
- margins.top = chartTitleHeight + 5;
80
- margins.bottom = xTitle + xLabel + 5 + totalHeight;
81
- ;
82
- margins.left = yTitle + yLabel + 5;
83
- break;
84
- case staticLegendPosition.bottom:
85
- margins.bottom = 40 + xLabel + xTitle + totalHeight;
86
- ;
87
- margins.top = chartTitleHeight + 5;
88
- margins.right = 15;
89
- margins.left = yTitle + yLabel + 5;
90
- break;
91
- case staticLegendPosition.left:
92
- margins.left = legendMargin + yTitle + yLabel + 33;
93
- margins.top = chartTitleHeight + 5;
94
- margins.bottom = xTitle + xLabel + 5 + totalHeight;
95
- ;
96
- margins.right = 15;
97
- }
98
- if (formatOptions.xAxisLabel.xAxisPosition &&
99
- formatOptions.xAxisLabel.xAxisPosition == "1") {
100
- margins.bottom = margins.bottom - xLabel;
101
- margins.top = margins.top + xLabel;
102
- }
103
- let manualMarginArray = formatOptions.chartPadding.paddingArrayLTRB;
104
- if (manualMarginArray) {
105
- margins.top += manualMarginArray[1];
106
- margins.bottom += manualMarginArray[3];
107
- margins.right += manualMarginArray[2];
108
- margins.left += manualMarginArray[0];
109
- }
110
- let innerHeight = height - margins.top - margins.bottom;
111
- let innerWidth = width - margins.left - margins.right;
112
- return {
113
- margins,
114
- yLabel,
115
- xLabel,
116
- yTitle,
117
- xTitle,
118
- chartTitleHeight,
119
- legendMargin,
120
- innerHeight,
121
- innerWidth,
122
- };
123
- }
124
- catch (error) {
125
- logError(fileName, "marginCalculationForBubbleScatter", error);
126
- }
127
- }
128
- export function customYscaleLabelFormatting(formatOptions, YminLeft, YmaxLeft) {
129
- try {
130
- let customYaxisIntervalValue = parseFloat(formatOptions.yAxisLabel.yAxisIntervalText);
131
- let customYaxisMaxValue = parseFloat(formatOptions.yAxisLabel.yAxisMaxText);
132
- let customYaxisMinValue = parseFloat(formatOptions.yAxisLabel.yAxisMinText);
133
- if (formatOptions.yAxisLabel.yAxisIntervalsVisibility) {
134
- // if (formatOptions.xAxisLabel.xAxisPosition == "2") {
135
- // formatOptions.xAxisLabel.xAxisPosition = "0";
136
- // }
137
- customYaxisMinValue =
138
- formatOptions.yAxisLabel.yAxisMinText !== ""
139
- ? parseFloat(formatOptions.yAxisLabel.yAxisMinText)
140
- : YminLeft;
141
- let maxValue = formatOptions.yAxisLabel.yAxisMaxText;
142
- customYaxisMaxValue = maxValue.length > 0 ? parseFloat(maxValue) : YmaxLeft;
143
- customYaxisMaxValue ? (YmaxLeft = customYaxisMaxValue) : null;
144
- }
145
- else {
146
- customYaxisMaxValue = YmaxLeft;
147
- customYaxisMinValue = YminLeft;
148
- customYaxisIntervalValue = undefined;
149
- }
150
- let yMinLength = YminLeft
151
- ? getNumberWithFormatFunction(formatOptions.yAxisLabel.yAxisDisplayUnits, formatOptions.yAxisLabel.yAxisNumberFormat, formatOptions.yAxisLabel.yAxisLabelDecimalPrecision ?? "2")(YminLeft).toString().length
152
- : 0;
153
- let yMaxLength = YmaxLeft
154
- ? getNumberWithFormatFunction(formatOptions.yAxisLabel.yAxisDisplayUnits, formatOptions.yAxisLabel.yAxisNumberFormat, formatOptions.yAxisLabel.yAxisLabelDecimalPrecision ?? "2")(YmaxLeft).toString().length
155
- : 0;
156
- let customYaxisMaxValueLength = customYaxisMaxValue
157
- ? getNumberWithFormatFunction(formatOptions.yAxisLabel.yAxisDisplayUnits, formatOptions.yAxisLabel.yAxisNumberFormat, formatOptions.yAxisLabel.yAxisLabelDecimalPrecision ?? "2")(customYaxisMaxValue).toString().length
158
- : 0;
159
- let customYaxisMinValueLength = customYaxisMinValue
160
- ? getNumberWithFormatFunction(formatOptions.yAxisLabel.yAxisDisplayUnits, formatOptions.yAxisLabel.yAxisNumberFormat, formatOptions.yAxisLabel.yAxisLabelDecimalPrecision ?? "2")(customYaxisMinValue).toString().length
161
- : 0;
162
- // primary scale : margin adjustments
163
- let longestMeasure = yMinLength < yMaxLength ? YmaxLeft : YminLeft;
164
- if (customYaxisMinValue) {
165
- let tempLength = customYaxisMinValueLength < yMaxLength ? YmaxLeft : customYaxisMinValue;
166
- longestMeasure =
167
- longestMeasure < tempLength
168
- ? tempLength
169
- : longestMeasure;
170
- }
171
- if (customYaxisMaxValue) {
172
- let tempLength = customYaxisMaxValueLength > yMinLength ? customYaxisMaxValue : YminLeft;
173
- longestMeasure =
174
- longestMeasure < tempLength
175
- ? tempLength
176
- : longestMeasure;
177
- }
178
- if (customYaxisMaxValue && customYaxisMinValue) {
179
- longestMeasure =
180
- customYaxisMaxValueLength > customYaxisMinValueLength
181
- ? customYaxisMaxValue
182
- : customYaxisMinValue;
183
- }
184
- return { longestMeasure, customYaxisIntervalValue, customYaxisMaxValue, customYaxisMinValue };
185
- }
186
- catch (error) {
187
- logError(fileName, "customYscaleLabelFormatting", error);
188
- }
189
- }
190
- export function customXscaleLabelFormatting(formatOptions, xMinLeft, xMaxLeft) {
191
- try {
192
- let customXaxisIntervalValue = parseFloat(formatOptions.xAxisLabel.xAxisIntervalText);
193
- let customXaxisMaxValue = parseFloat(formatOptions.xAxisLabel.xAxisMaxText);
194
- let customXaxisMinValue = parseFloat(formatOptions.xAxisLabel.xAxisMinText);
195
- if (formatOptions.xAxisLabel.xAxisIntervalsVisibility) {
196
- // if (formatOptions.xAxisLabel.xAxisPosition == "2") {
197
- // formatOptions.xAxisLabel.xAxisPosition = "0";
198
- // }
199
- customXaxisMinValue =
200
- formatOptions.xAxisLabel.xAxisMinText !== ""
201
- ? parseFloat(formatOptions.xAxisLabel.xAxisMinText)
202
- : xMinLeft;
203
- let maxValue = formatOptions.xAxisLabel.xAxisMaxText.toString();
204
- customXaxisMaxValue = maxValue.length > 0 ? parseFloat(maxValue) : xMaxLeft;
205
- customXaxisMaxValue ? (xMaxLeft = customXaxisMaxValue) : null;
206
- }
207
- else {
208
- customXaxisMaxValue = xMaxLeft;
209
- customXaxisMinValue = xMinLeft;
210
- customXaxisIntervalValue = undefined;
211
- }
212
- let yMinLength = xMinLeft
213
- ? getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision ?? "2")(xMinLeft).toString().length
214
- : 0;
215
- let yMaxLength = xMaxLeft
216
- ? getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision ?? "2")(xMaxLeft).toString().length
217
- : 0;
218
- let customXaxisMaxValueLength = customXaxisMaxValue
219
- ? getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision ?? "2")(customXaxisMaxValue).toString().length
220
- : 0;
221
- let customXaxisMinValueLength = customXaxisMinValue
222
- ? getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision ?? "2")(customXaxisMinValue).toString().length
223
- : 0;
224
- // primary scale : margin adjustments
225
- let longestDimension = yMinLength < yMaxLength ? xMaxLeft : xMinLeft;
226
- if (customXaxisMinValue) {
227
- let tempLength = customXaxisMinValueLength < yMaxLength ? xMaxLeft : customXaxisMinValue;
228
- longestDimension =
229
- longestDimension < tempLength
230
- ? tempLength
231
- : longestDimension;
232
- }
233
- if (customXaxisMaxValue) {
234
- let tempLength = customXaxisMaxValueLength > yMinLength ? customXaxisMaxValue : xMinLeft;
235
- longestDimension =
236
- longestDimension < tempLength
237
- ? tempLength
238
- : longestDimension;
239
- }
240
- if (customXaxisMaxValue && customXaxisMinValue) {
241
- longestDimension =
242
- customXaxisMaxValueLength > customXaxisMinValueLength
243
- ? customXaxisMaxValue
244
- : customXaxisMinValue;
245
- }
246
- return { longestDimension, customXaxisIntervalValue, customXaxisMaxValue, customXaxisMinValue };
247
- }
248
- catch (error) {
249
- logError(fileName, "customXscaleLabelFormatting", error);
250
- }
251
- }
252
- /**
253
- * Sets the X-axis title on the SVG chart, adjusting visibility, positioning, and styling based on format options and chart type.
254
- *
255
- * @param {TDefaultChartFormatOptionsType} formatOptions - Chart format options including axis title settings and visibility.
256
- * @param {boolean} barChart - Flag indicating if the chart is a bar chart.
257
- * @param {any} svg - D3 selection of the SVG element where the X-axis title will be appended.
258
- * @param {TMargin} margin - Margin object containing top, left, right, and bottom margins.
259
- * @param {number} xLabel - Height offset for the X-axis label.
260
- * @param {number} height - Total height of the SVG/chart container.
261
- * @param {number} xTitle - Height allocated for the X-axis title element.
262
- * @param {string} chartType - The type of chart (e.g., "bar", "line", etc.).
263
- * @param {number} yLabel - Y-axis label offset (used for positioning in some cases).
264
- * @param {number} innerWidth - Inner width of the static SVG container.
265
- * @param {number} innerHeight - Height of the inner chart area (excluding margins).
266
- *
267
- * @returns {any} The modified SVG selection with the appended X-axis title element.
268
- */
269
- export function setXaxistitle(formatOptions, barChart, svg, margin, xLabel, height, xTitle, chartType, yLabel, innerWidth, innerHeight) {
270
- try {
271
- let xAxisLabelPosition = formatOptions.xAxisLabel.xAxisPosition;
272
- let chartsWithXScrollFlag = true;
273
- let chartsWithYScrollFlag = false;
274
- let object = svg
275
- .append("foreignObject")
276
- .attr("visibility", barChart
277
- ? formatOptions.yAxisTitle.yAxisTitleVisibility
278
- ? "visible"
279
- : "hidden"
280
- : formatOptions.xAxisTitle.xAxisTitleVisibility
281
- ? "visible"
282
- : "hidden")
283
- .attr("transform", !formatOptions.plotArea.fitChart && chartsWithXScrollFlag
284
- ? `translate(${margin.left},${margin.top +
285
- innerHeight +
286
- (formatOptions?.xAxisLabel?.xAxisPosition == "1" ? 0 : xLabel)})`
287
- : !formatOptions.plotArea.fitChart && chartsWithYScrollFlag
288
- ? `translate(${margin.left},${height - xTitle - 5})`
289
- : `translate(${margin.left},${margin.top +
290
- innerHeight +
291
- (chartsWithXScrollFlag
292
- ? formatOptions?.xAxisLabel?.xAxisPosition == "1"
293
- ? 0
294
- : xLabel
295
- : chartType == "tornado"
296
- ? xLabel + 5
297
- : yLabel + 5)})`
298
- // `translate(${margin.left},${Margin.top + innerHeight + (chartsWithXScrollFlag ? (formatOptions?.xAxisLabel?.xAxisPosition == "1" ? 0 : Xlabel) : (attributes.type == ActualChartTypes.TornadoChart) ? Xlabel + 5 : yLabel + 5) })`
299
- )
300
- .attr("class", "xAxisTitle")
301
- .attr("width", innerWidth)
302
- .attr("height", xTitle + "px")
303
- .style("z-index", "9999");
304
- if (formatOptions.xAxisTitle.xAxisDynamicTitleText.length !== 0) {
305
- object
306
- .append("xhtml:div")
307
- .style("color", "rgba(119,119,119)")
308
- .attr("title", formatOptions.xAxisTitle.xAxisTitleText)
309
- .style("white-space", "pre")
310
- .style("text-overflow", "ellipsis")
311
- .html(formatOptions.xAxisTitle.xAxisTitleHTML
312
- ? formatOptions.xAxisTitle.xAxisTitleHTML
313
- : formatOptions.xAxisTitle.xAxisTitleText);
314
- }
315
- else {
316
- object
317
- .append("xhtml:h3")
318
- .style("white-space", "pre")
319
- .style("text-overflow", "ellipsis")
320
- .style("user-select", "none")
321
- .style("margin", 0)
322
- .style("padding", 0)
323
- .style("text-align", "center")
324
- .style("overflow", "hidden")
325
- .attr("class", "xAxisTitle")
326
- .style("padding-top", "5px")
327
- .style("text-anchor", "middle")
328
- .style("color", "rgba(119,119,119)")
329
- .style("font-size", "12px")
330
- .style("font-size", formatOptions.xAxisTitle.xAxisTitleFontSize)
331
- .style("font-family", formatOptions.xAxisTitle.xAxisTitleFontFamily)
332
- .style("font-style", formatOptions.xAxisTitle.xAxisTitleFontStyle)
333
- .attr("title", formatOptions.xAxisTitle.xAxisTitleText !== "~$~Dimension"
334
- ? formatOptions.xAxisTitle.xAxisTitleText
335
- : "")
336
- .html(formatOptions.xAxisTitle.xAxisTitleText !== "~$~Dimension"
337
- ? formatOptions.xAxisTitle.xAxisTitleText
338
- : "");
339
- }
340
- }
341
- catch (error) {
342
- logError(fileName, "setXaxistitle", error);
343
- }
344
- }
345
- /**
346
- * Adds a Y-axis title to the SVG chart, handling visibility, positioning, rotation, and styling based on format options.
347
- *
348
- * @param {number} innerHeight - The height of the inner chart area (excluding margins).
349
- * @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options, including Y-axis title settings.
350
- * @param {number} dataTableHeight - Height of any data table below the chart, used to adjust positioning.
351
- * @param {boolean} barChart - Whether the chart is a bar chart.
352
- * @param {any} svg - D3 selection of the SVG element where the Y-axis title will be appended.
353
- * @param {TMargin} margin - Margins around the chart.
354
- * @param {number} yTitle - Height allocated for the Y-axis title element.
355
- * @param {number} yLabel - Offset for the Y-axis label, used for positioning.
356
- *
357
- * @returns {any} The SVG selection with the appended Y-axis title.
358
- */
359
- export function yAxistitle(innerHeight, formatOptions, dataTableHeight, barChart, svg, margin, yTitle, yLabel) {
360
- try {
361
- let currentInnerHeight = dataTableHeight > 0
362
- ? innerHeight - dataTableHeight
363
- : innerHeight
364
- ? innerHeight
365
- : innerHeight;
366
- let object = svg
367
- .append("foreignObject")
368
- .attr("visibility", barChart
369
- ? formatOptions.xAxisTitle.xAxisTitleVisibility
370
- ? "visible"
371
- : "hidden"
372
- : formatOptions.yAxisTitle.yAxisTitleVisibility
373
- ? "visible"
374
- : "hidden")
375
- .attr("x", `-${margin.top + currentInnerHeight}`)
376
- .attr("y", margin.left - yTitle - yLabel + 5)
377
- .attr("class", "yAxisTitle")
378
- .attr("transform", "rotate(-90)")
379
- .attr("width", currentInnerHeight)
380
- .attr("height", yTitle + "px");
381
- if (formatOptions.yAxisTitle.yAxisDynamicTitleText.length !== 0) {
382
- object
383
- .append("xhtml:div")
384
- .style("color", "rgba(119,119,119)")
385
- .attr("title", formatOptions.yAxisTitle.yAxisTitleText)
386
- .style("white-space", "pre")
387
- .style("text-overflow", "ellipsis")
388
- .html(formatOptions.yAxisTitle.yAxisTitleHTML
389
- ? formatOptions.yAxisTitle.yAxisTitleHTML
390
- : formatOptions.yAxisTitle.yAxisTitleText);
391
- }
392
- else {
393
- object
394
- .append("xhtml:h3")
395
- .style("white-space", "pre")
396
- .style("text-overflow", "ellipsis")
397
- .style("user-select", "none")
398
- .style("margin", 0)
399
- .style("padding", 0)
400
- .style("text-align", "center")
401
- .style("overflow", "hidden")
402
- .attr("class", "xAxisTitle")
403
- // .style("padding-top", "5px")
404
- .style("text-anchor", "middle")
405
- .style("color", "rgba(119,119,119)")
406
- .style("font-size", "12px")
407
- .style("font-size", formatOptions.yAxisTitle.yAxisTitleFontSize)
408
- .style("font-family", formatOptions.yAxisTitle.yAxisTitleFontFamily)
409
- .style("font-style", formatOptions.yAxisTitle.yAxisTitleFontStyle)
410
- .attr("title", formatOptions.yAxisTitle.yAxisTitleText)
411
- .html(formatOptions.yAxisTitle.yAxisTitleText);
412
- }
413
- return svg;
414
- }
415
- catch (error) {
416
- logError(fileName, "yAxistitle", error);
417
- }
418
- }
419
- /**
420
- * Generates an array of Y-axis labels based on provided min, max values,
421
- * chart dimensions, format options, and optional custom min/max values.
422
- *
423
- * @param {number} Ymax - The maximum Y value from data or chart.
424
- * @param {number} Ymin - The minimum Y value from data or chart.
425
- * @param {number} innerHeight - The inner height of the chart area in pixels.
426
- * @param {TDefaultChartFormatOptionsType} formatOptions - Configuration options for formatting the axis labels.
427
- * @param {TChartJSON} chartJSON - Chart metadata including Y axis min/max values.
428
- * @param {number} customYaxisMinValue - Optional custom minimum Y-axis value.
429
- * @param {number} customYaxisMaxValue - Optional custom maximum Y-axis value.
430
- *
431
- * @returns {{ yAxisLabelArray: number[], customTickValue?: number }} Object containing the array of Y-axis labels and optionally the computed custom tick count.
432
- */
433
- // to get exact value of interval user enter, here we return the array of the intervals to be shown on y-axis scale
434
- export function responsiveYaxisLabel(Ymax, Ymin, innerHeight, formatOptions, customYaxisMinValue, customYaxisMaxValue) {
435
- try {
436
- let customYaxisIntervalValue = parseFloat(formatOptions.yAxisLabel.yAxisIntervalText);
437
- let yAxisLabelArray = [];
438
- let customTickValue;
439
- if (customYaxisIntervalValue &&
440
- customYaxisIntervalValue !== 0 &&
441
- customYaxisIntervalValue !== undefined) {
442
- let minValue = customYaxisMinValue || customYaxisMinValue == 0
443
- ? customYaxisMinValue
444
- : Ymin;
445
- let maxValue = customYaxisMaxValue || customYaxisMaxValue == 0
446
- ? customYaxisMaxValue
447
- : Ymax;
448
- if (minValue < 0) {
449
- customTickValue = Math.floor((maxValue - minValue) / customYaxisIntervalValue);
450
- }
451
- else {
452
- customTickValue = Math.floor(maxValue / customYaxisIntervalValue);
453
- }
454
- let minRequiredTicks = 18;
455
- customYaxisMaxValue || customYaxisMaxValue == 0
456
- ? (Ymax = customYaxisMaxValue)
457
- : "";
458
- let tickvalue = customYaxisMinValue || customYaxisMinValue == 0
459
- ? customYaxisMinValue
460
- : Ymin < 0
461
- ? Math.round(Ymin)
462
- : 0;
463
- yAxisLabelArray.push(tickvalue);
464
- if (customTickValue > 100) {
465
- let message = "Tick count cannot exceed more than 100.";
466
- // openWarningBox(message); // we will add warning pop up later on
467
- if (minValue < 0) {
468
- customYaxisIntervalValue = (maxValue - tickvalue) / 100;
469
- }
470
- else {
471
- customYaxisIntervalValue = maxValue / 100;
472
- }
473
- }
474
- customTickValue = customTickValue < 100 ? customTickValue : 100;
475
- if (customTickValue > minRequiredTicks) {
476
- for (let interval = 0; interval < parseInt(customTickValue); interval++) {
477
- tickvalue += customYaxisIntervalValue;
478
- if (parseFloat(tickvalue.toFixed(5)) <= Ymax) {
479
- yAxisLabelArray.push(tickvalue);
480
- }
481
- else
482
- break;
483
- }
484
- }
485
- else {
486
- for (let interval = 0; interval < minRequiredTicks; interval++) {
487
- tickvalue += customYaxisIntervalValue;
488
- if (tickvalue <= Ymax) {
489
- yAxisLabelArray.push(tickvalue);
490
- }
491
- else
492
- break;
493
- }
494
- }
495
- }
496
- else {
497
- // // Algorithm from aishwarya
498
- // let labelWidthPx = calculateWidthHeightDynamically(
499
- // (customYaxisMaxValue || chartJSON.yMaxLeft).toString(),
500
- // formatOptions.yAxisLabel.yAxisLabelFontSize,
501
- // formatOptions.yAxisLabel.yAxisLabelFontFamily,
502
- // 0
503
- // );
504
- // yAxisLabelArray = getLabelsFromAlgo(
505
- // customYaxisMinValue || chartJSON.yMinLeft,
506
- // customYaxisMaxValue || chartJSON.yMaxLeft,
507
- // innerHeight,
508
- // labelWidthPx[0]
509
- // );
510
- customTickValue =
511
- innerHeight / 30;
512
- }
513
- return { yAxisLabelArray, customTickValue };
514
- }
515
- catch (e) {
516
- logError(fileName, "responsiveYaxisLabel", e);
517
- }
518
- }
519
- export function responsiveXaxisLabelForNumericValue(xMax, xMin, innerWidth, formatOptions, customXaxisMinValue, customXaxisMaxValue, innerHeight, barChart) {
520
- try {
521
- let customXaxisIntervalValue = parseFloat(formatOptions.xAxisLabel.xAxisIntervalText);
522
- let xAxisLabelArray = [];
523
- let customTickValue;
524
- if (customXaxisIntervalValue &&
525
- customXaxisIntervalValue !== 0 &&
526
- customXaxisIntervalValue !== undefined) {
527
- let minValue = customXaxisMinValue || customXaxisMinValue == 0
528
- ? customXaxisMinValue
529
- : xMin;
530
- let maxValue = customXaxisMaxValue || customXaxisMaxValue == 0
531
- ? customXaxisMaxValue
532
- : xMax;
533
- if (minValue < 0) {
534
- customTickValue = Math.floor((maxValue - minValue) / customXaxisIntervalValue);
535
- }
536
- else {
537
- customTickValue = Math.floor(maxValue / customXaxisIntervalValue);
538
- }
539
- let minRequiredTicks = 18;
540
- customXaxisMaxValue || customXaxisMaxValue == 0
541
- ? (xMax = customXaxisMaxValue)
542
- : "";
543
- let tickvalue = customXaxisMinValue || customXaxisMinValue == 0
544
- ? customXaxisMinValue
545
- : xMin < 0
546
- ? Math.round(xMin)
547
- : 0;
548
- xAxisLabelArray.push(tickvalue);
549
- if (customTickValue > 100) {
550
- let message = "Tick count cannot exceed more than 100.";
551
- // openWarningBox(message); // we will add warning pop up later on
552
- if (minValue < 0) {
553
- customXaxisIntervalValue = (maxValue - tickvalue) / 100;
554
- }
555
- else {
556
- customXaxisIntervalValue = maxValue / 100;
557
- }
558
- }
559
- customTickValue = customTickValue < 100 ? customTickValue : 100;
560
- if (customTickValue > minRequiredTicks) {
561
- for (let interval = 0; interval < parseInt(customTickValue); interval++) {
562
- tickvalue += customXaxisIntervalValue;
563
- if (parseFloat(tickvalue.toFixed(5)) <= xMax) {
564
- xAxisLabelArray.push(tickvalue);
565
- }
566
- else
567
- break;
568
- }
569
- }
570
- else {
571
- for (let interval = 0; interval < minRequiredTicks; interval++) {
572
- tickvalue += customXaxisIntervalValue;
573
- if (tickvalue <= xMax) {
574
- xAxisLabelArray.push(tickvalue);
575
- }
576
- else
577
- break;
578
- }
579
- }
580
- }
581
- else {
582
- // Algorithm from aishwarya
583
- let labelWidthPx = calculateWidthHeightDynamically((customXaxisMaxValue || xMax).toString(), formatOptions.xAxisLabel.xAxisLabelFontSize, formatOptions.xAxisLabel.xAxisLabelFontFamily, 0);
584
- xAxisLabelArray = getLabelsFromAlgo(customXaxisMinValue || xMin, customXaxisMaxValue || xMax, barChart ? innerHeight : innerWidth, labelWidthPx[0]);
585
- customTickValue =
586
- innerWidth / 30;
587
- }
588
- return { xAxisLabelArray, customTickValue };
589
- }
590
- catch (e) {
591
- logError(fileName, "responsiveXaxisLabel", e);
592
- }
593
- }
594
- export function initYaxis(gTag, formatOptions, dataTableHeight, yLabel, yAxisLeft, innerHeight) {
595
- try {
596
- let fontStyle = formatOptions.yAxisLabel.yAxisLabelFontStyle;
597
- gTag
598
- .append("rect")
599
- .attr("transform", `translate(${-yLabel},0)`)
600
- .attr("height", dataTableHeight > 0 ? innerHeight - dataTableHeight : innerHeight)
601
- .attr("width", yLabel)
602
- .attr("fill", formatOptions.yAxisLabel.yAxisLabelVisibility
603
- ? formatOptions.yAxisLabel.yAxisBackgroundColor
604
- ? formatOptions.yAxisLabel.yAxisBackgroundColor !== "#ffffff"
605
- ? formatOptions.yAxisLabel.yAxisBackgroundColor
606
- : "none"
607
- : formatOptions.chartArea.chartAreaColor
608
- : formatOptions.chartArea.chartAreaColor);
609
- const yAxisG = gTag.append("g").call(yAxisLeft);
610
- yAxisG.selectAll("line")
611
- .style("shape-rendering", "crispEdges")
612
- .attr("stroke", formatOptions.plotArea.gridLinesColor)
613
- .attr("stroke-width", "0.05em")
614
- .attr("stroke-opacity", formatOptions.plotArea.fitChart ? "1" : "0");
615
- yAxisG.selectAll("text")
616
- .style("fill", formatOptions.yAxisLabel.yAxisLabelColor !== "#ffffff"
617
- ? formatOptions.yAxisLabel.yAxisLabelColor
618
- : "none")
619
- .style("user-select", "none")
620
- .style("font-size", formatOptions.yAxisLabel.yAxisLabelFontSize)
621
- .style("font-family", formatOptions.yAxisLabel.yAxisLabelFontFamily)
622
- .style("font-style", formatOptions.yAxisLabel.yAxisLabelFontStyle)
623
- .style("font-style", fontStyle.includes(fontStyleOptions.italic) ? fontStyleOptions.italic : "")
624
- .style("text-decoration", fontStyle.includes(fontStyleOptions.underline) ? fontStyleOptions.underline : "")
625
- .style("font-weight", fontStyle.includes(fontStyleOptions.bold) ? fontStyleOptions.bold : "")
626
- .attr("visibility", formatOptions.yAxisLabel.yAxisLabelVisibility ? "visible" : "hidden");
627
- yAxisG.select(".domain")
628
- .style("shape-rendering", "crispEdges")
629
- .style("stroke", formatOptions.yAxisLabel.yAxisColor)
630
- .attr("stroke-width", formatOptions.yAxisLabel.yAxisWidth
631
- ? formatOptions.yAxisLabel.yAxisWidth
632
- : formatOptions.plotArea.plotAreaBorderThickness);
633
- }
634
- catch (error) {
635
- logError(fileName, "initYaxis", error);
636
- }
637
- }
638
- export function initXaxis(gTag, formatOptions, dataTableHeight, xLabel, xAxis, innerHeight, innerWidth, margins, yScale) {
639
- try {
640
- let fontStyle = formatOptions.xAxisLabel.xAxisLabelFontStyle;
641
- let xaxisLabelPosition = formatOptions.xAxisLabel.xAxisPosition;
642
- let labelRotation = formatOptions.xAxisLabel.xAxisLabelRotation;
643
- labelRotation = parseInt(labelRotation);
644
- // gTag
645
- // .append("rect")
646
- // .attr("transform", `translate(0,${innerHeight})`)
647
- // .attr("height", xLabel)
648
- // .attr("width", innerWidth)
649
- // .attr(
650
- // "fill",
651
- // formatOptions.xAxisLabel.xAxisLabelVisibility
652
- // ? formatOptions.xAxisLabel.xAxisBackgroundColor
653
- // ? formatOptions.xAxisLabel.xAxisBackgroundColor !== "#ffffff"
654
- // ? formatOptions.xAxisLabel.xAxisBackgroundColor
655
- // : "none"
656
- // : formatOptions.chartArea.chartAreaColor
657
- // : formatOptions.chartArea.chartAreaColor
658
- // );
659
- // const yAxisG = gTag.append("g")
660
- // .attr(
661
- // "transform",
662
- // `translate(0,${xaxisLabelPosition === "0"
663
- // ? innerHeight
664
- // : xaxisLabelPosition === "1"
665
- // ? 0
666
- // : yScale(0)
667
- // })`
668
- // )
669
- // .call(yAxisLeft);
670
- // yAxisG.selectAll("line")
671
- // .style("shape-rendering", "crispEdges")
672
- // .attr("stroke", formatOptions.plotArea.gridLinesColor)
673
- // .attr("stroke-width", "0.05em")
674
- // .attr("stroke-opacity", formatOptions.plotArea.fitChart ? "1" : "0");
675
- // yAxisG.selectAll("text")
676
- // .style(
677
- // "fill",
678
- // formatOptions.xAxisLabel.xAxisLabelColor !== "#ffffff"
679
- // ? formatOptions.xAxisLabel.xAxisLabelColor
680
- // : "none"
681
- // )
682
- // .style("user-select", "none")
683
- // .style("font-size", formatOptions.xAxisLabel.xAxisLabelFontSize)
684
- // .style("font-family", formatOptions.xAxisLabel.xAxisLabelFontFamily)
685
- // .style("font-style", formatOptions.xAxisLabel.xAxisLabelFontStyle)
686
- // .style("font-style", fontStyle.includes(fontStyleOptions.italic) ? fontStyleOptions.italic : "")
687
- // .style(
688
- // "text-decoration",
689
- // fontStyle.includes(fontStyleOptions.underline) ? fontStyleOptions.underline : ""
690
- // )
691
- // .style("font-weight", fontStyle.includes(fontStyleOptions.bold) ? fontStyleOptions.bold : "")
692
- // .attr(
693
- // "visibility",
694
- // formatOptions.xAxisLabel.xAxisLabelVisibility ? "visible" : "hidden"
695
- // );
696
- // yAxisG.select(".domain")
697
- // .style("shape-rendering", "crispEdges")
698
- // .style("stroke", formatOptions.xAxisLabel.xAxisColor)
699
- // .attr(
700
- // "stroke-width",
701
- // formatOptions.xAxisLabel.xAxisWidth
702
- // ? formatOptions.xAxisLabel.xAxisWidth
703
- // : formatOptions.plotArea.plotAreaBorderThickness
704
- // );
705
- gTag
706
- .append("rect")
707
- .attr("transform", `translate(1,${xaxisLabelPosition === "0"
708
- ? dataTableHeight > 0
709
- ? innerHeight - dataTableHeight
710
- : innerHeight
711
- : xaxisLabelPosition === "1"
712
- ? -xLabel
713
- : yScale(0)})`)
714
- .attr("height", xLabel)
715
- .attr("width", innerWidth)
716
- .attr("fill", formatOptions.xAxisLabel.xAxisLabelVisibility
717
- ? formatOptions.xAxisLabel.xAxisBackgroundColor
718
- ? formatOptions.xAxisLabel.xAxisBackgroundColor !== "#ffffff"
719
- ? formatOptions.xAxisLabel.xAxisBackgroundColor
720
- : "none"
721
- : formatOptions.chartArea.chartAreaColor
722
- : formatOptions.chartArea.chartAreaColor);
723
- const XaxisG = gTag
724
- .append("g")
725
- .attr("transform", `translate(0,${xaxisLabelPosition === "0"
726
- ? innerHeight
727
- : xaxisLabelPosition === "1"
728
- ? 0
729
- : yScale(0)})`)
730
- .call(xAxis);
731
- let dx = xaxisLabelPosition === "1" ? "5" : "0";
732
- let foreignObject = XaxisG.selectAll("g")
733
- .append("foreignObject")
734
- .attr("class", "testingoverflowing")
735
- .style("width", Math.round(xLabel))
736
- .style("height", "20px")
737
- .attr("transform", (d, i) => `rotate(${xaxisLabelPosition === "1"
738
- ? -labelRotation
739
- : labelRotation != 0
740
- ? 180 - labelRotation
741
- : 0}) translate (${labelRotation != 0
742
- ? dx + `, -5`
743
- : -xLabel / 2 + " , " + (xaxisLabelPosition === "1" ? "-15" : "8")})`);
744
- foreignObject
745
- .append("xhtml:h3")
746
- .style("transform", xaxisLabelPosition === "1"
747
- ? ""
748
- : labelRotation != 0
749
- ? "rotate(180deg)"
750
- : "0")
751
- .style("white-space", "pre")
752
- .style("text-overflow", "ellipsis")
753
- .style("text-align", labelRotation != 0 ? "start" : "center")
754
- .style("user-select", "none")
755
- .style("margin", 0)
756
- .style("padding", 0)
757
- .style("overflow", "hidden")
758
- .style("font-family", formatOptions.xAxisLabel.xAxisLabelFontFamily)
759
- // .style("font-style", formatOptions.xAxisLabel.xAxisLabelFontStyle)
760
- .style("color", formatOptions.xAxisLabel.xAxisLabelColor)
761
- .style("font-size", formatOptions.xAxisLabel.xAxisLabelFontSize + "px")
762
- .style("font-style", fontStyle.includes(fontStyleOptions.italic) ? fontStyleOptions.italic : "")
763
- .style("text-decoration", fontStyle.includes(fontStyleOptions.underline) ? fontStyleOptions.underline : "")
764
- .style("font-weight", fontStyle.includes(fontStyleOptions.bold) ? fontStyleOptions.bold : "")
765
- .style("visibility", formatOptions.xAxisLabel.xAxisLabelVisibility ? "visible" : "hidden")
766
- .attr("title", (d, i) => getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision)(d))
767
- .html((d, i) => getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision)(d));
768
- //default text elements are set to hidden
769
- XaxisG.selectAll("text").style("visibility", formatOptions.xAxisLabel.xAxisLabelVisibility ? "hidden" : "hidden");
770
- XaxisG.selectAll("line")
771
- .style("stroke", formatOptions.plotArea.gridLinesColor)
772
- .style("shape-rendering", "crispEdges")
773
- .attr("visibility", formatOptions.xAxisLabel.xAxisLabelVisibility
774
- ? "visible"
775
- : formatOptions.plotArea.gridLinesVertical
776
- ? "visible"
777
- : "hidden");
778
- XaxisG.select(".domain")
779
- .style("stroke", formatOptions.xAxisLabel.xAxisColor)
780
- .attr("stroke-width", formatOptions.xAxisLabel.xAxisWidth
781
- ? formatOptions.xAxisLabel.xAxisWidth
782
- : formatOptions.plotArea.plotAreaBorderThickness)
783
- .style("shape-rendering", "crispEdges");
784
- }
785
- catch (error) {
786
- logError(fileName, "initXaxis", error);
787
- }
788
- }
789
- export const setnumberOfBubbles = (svg, legendPosition, chartFormatOptions, height, width, margins, innnerHeight, xTitleHeight, XLabelHeight, bubbleCount) => {
790
- try {
791
- if (chartFormatOptions.plotArea.numberOfBubbles) {
792
- let currentInnerHeight = legendPosition == "Bottom" ? height - 55 : height - 25;
793
- let object = svg
794
- .append("foreignObject")
795
- .attr("transform", `translate(${margins.left},${currentInnerHeight})`)
796
- //.attr("class", "chartTitle")
797
- .attr("width", width)
798
- .attr("height", "20px");
799
- object
800
- .append("xhtml:div")
801
- .style("white-space", "pre")
802
- .style("color", "#000000")
803
- .style("font-size", "12px ")
804
- .style("text-overflow", "ellipsis")
805
- .html((chartFormatOptions.plotArea.totalAlias ? chartFormatOptions.plotArea.totalAliasText : `Total count : `) + (bubbleCount));
806
- }
807
- }
808
- catch (error) {
809
- logError(fileName, "setnumberOfBubbles", error);
810
- }
811
- };
812
- // Dummy logError function for demonstration (should be implemented elsewhere)
813
- function logError(fileName, functionName, error) {
814
- console.error(`[${fileName}] [${functionName}]`, error);
815
- }