pace-chart-lib 0.0.6 → 0.0.8

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 (150) hide show
  1. package/README.md +10 -54
  2. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +46 -0
  3. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +2285 -0
  4. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.d.ts +169 -0
  5. package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.js +47 -0
  6. package/dist/Components1/Charts/ChartsWithAxis/LineFamily/LineChart.d.ts +4 -0
  7. package/dist/Components1/Charts/ChartsWithAxis/LineFamily/LineChart.js +403 -0
  8. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.d.ts +0 -0
  9. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.js +0 -0
  10. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.d.ts +0 -0
  11. package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.js +0 -0
  12. package/dist/Components1/Charts/Core/Common.type.d.ts +8 -0
  13. package/dist/Components1/Charts/Core/Common.type.js +9 -0
  14. package/dist/Components1/Charts/Core/CommonFunctions.d.ts +12 -0
  15. package/dist/Components1/Charts/Core/CommonFunctions.js +512 -0
  16. package/dist/Components1/Charts/Core/DefaultProperties.d.ts +586 -0
  17. package/dist/Components1/Charts/Core/DefaultProperties.js +585 -0
  18. package/dist/Services/ErrorLog.d.ts +1 -0
  19. package/dist/Services/ErrorLog.js +3 -0
  20. package/dist/components/Charts/ChartsWithAxis/AreaFamily/AreaChart.d.ts +4 -0
  21. package/dist/components/Charts/ChartsWithAxis/AreaFamily/AreaChart.js +497 -0
  22. package/dist/components/Charts/ChartsWithAxis/AreaFamily/LineChart.d.ts +4 -0
  23. package/dist/components/Charts/ChartsWithAxis/AreaFamily/LineChart.js +491 -0
  24. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.d.ts +4 -0
  25. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.js +520 -0
  26. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackLineChart.d.ts +4 -0
  27. package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackLineChart.js +553 -0
  28. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.d.ts +4 -0
  29. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.js +519 -0
  30. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackLineChart.d.ts +4 -0
  31. package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackLineChart.js +553 -0
  32. package/dist/components/Charts/ChartsWithAxis/BarFamily/BarChart.d.ts +12 -0
  33. package/dist/components/Charts/ChartsWithAxis/BarFamily/BarChart.js +9 -0
  34. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +623 -0
  35. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +4897 -0
  36. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.d.ts +0 -0
  37. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.js +0 -0
  38. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.d.ts +173 -0
  39. package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.js +49 -0
  40. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart copy.d.ts +4 -0
  41. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart copy.js +486 -0
  42. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.d.ts +4 -0
  43. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.js +498 -0
  44. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.d.ts +4 -0
  45. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.js +417 -0
  46. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.d.ts +4 -0
  47. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.js +1014 -0
  48. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.d.ts +4 -0
  49. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.js +479 -0
  50. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LineChart.d.ts +4 -0
  51. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LineChart.js +451 -0
  52. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.d.ts +4 -0
  53. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.js +535 -0
  54. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackLineChart.d.ts +4 -0
  55. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackLineChart.js +512 -0
  56. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.d.ts +4 -0
  57. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.js +532 -0
  58. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackLineChart.d.ts +4 -0
  59. package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackLineChart.js +512 -0
  60. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/BarChart.d.ts +12 -0
  61. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/BarChart.js +9 -0
  62. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.d.ts +4 -0
  63. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.js +498 -0
  64. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.d.ts +4 -0
  65. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.js +498 -0
  66. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredColumnChart.d.ts +4 -0
  67. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredColumnChart.js +479 -0
  68. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.d.ts +4 -0
  69. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.js +479 -0
  70. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.d.ts +4 -0
  71. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.js +474 -0
  72. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.d.ts +4 -0
  73. package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.js +464 -0
  74. package/dist/components/Charts/ChartsWithAxis/LineFamily/100%StackLineChart.d.ts +0 -0
  75. package/dist/components/Charts/ChartsWithAxis/LineFamily/100%StackLineChart.js +0 -0
  76. package/dist/components/Charts/ChartsWithAxis/LineFamily/LineChart.d.ts +4 -0
  77. package/dist/components/Charts/ChartsWithAxis/LineFamily/LineChart.js +452 -0
  78. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalisedStackLineChart.d.ts +4 -0
  79. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalisedStackLineChart.js +554 -0
  80. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.d.ts +4 -0
  81. package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.js +513 -0
  82. package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.d.ts +4 -0
  83. package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.js +508 -0
  84. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.d.ts +4 -0
  85. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.js +395 -0
  86. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.d.ts +4 -0
  87. package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.js +608 -0
  88. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxis.types.d.ts +0 -0
  89. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxis.types.js +0 -0
  90. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.d.ts +92 -0
  91. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.js +815 -0
  92. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.d.ts +0 -0
  93. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.js +0 -0
  94. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.d.ts +108 -0
  95. package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.js +32 -0
  96. package/dist/components/Charts/ChartsWithoutAxis/Maps/Cordinates.d.ts +26 -0
  97. package/dist/components/Charts/ChartsWithoutAxis/Maps/Cordinates.js +15021 -0
  98. package/dist/components/Charts/ChartsWithoutAxis/Maps/Maps.d.ts +4 -0
  99. package/dist/components/Charts/ChartsWithoutAxis/Maps/Maps.js +391 -0
  100. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/BubbleChart.d.ts +4 -0
  101. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/BubbleChart.js +367 -0
  102. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.d.ts +4 -0
  103. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.js +569 -0
  104. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.d.ts +3 -0
  105. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.js +212 -0
  106. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.d.ts +3 -0
  107. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.js +401 -0
  108. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.d.ts +4 -0
  109. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.js +313 -0
  110. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/SankeyChart.d.ts +4 -0
  111. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/SankeyChart.js +719 -0
  112. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ScatterChart.d.ts +4 -0
  113. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ScatterChart.js +807 -0
  114. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.d.ts +3 -0
  115. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.js +514 -0
  116. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/VennChart.d.ts +4 -0
  117. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/VennChart.js +282 -0
  118. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/WordCloud.d.ts +4 -0
  119. package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/WordCloud.js +207 -0
  120. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/DonutChart.d.ts +4 -0
  121. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/DonutChart.js +476 -0
  122. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieChart.d.ts +4 -0
  123. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieChart.js +420 -0
  124. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieFamilyCommonFunctions.d.ts +10 -0
  125. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieFamilyCommonFunctions.js +106 -0
  126. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieofPieChart.d.ts +3 -0
  127. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieofPieChart.js +507 -0
  128. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.d.ts +3 -0
  129. package/dist/components/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.js +246 -0
  130. package/dist/components/Charts/Core/Common.type.d.ts +0 -0
  131. package/dist/components/Charts/Core/Common.type.js +0 -0
  132. package/dist/components/Charts/Core/Common.types.d.ts +369 -0
  133. package/dist/components/Charts/Core/Common.types.js +133 -0
  134. package/dist/components/Charts/Core/CommonFunctions.d.ts +236 -0
  135. package/dist/components/Charts/Core/CommonFunctions.js +1778 -0
  136. package/dist/components/Charts/Core/DefaultChartDataProperties.d.ts +65 -0
  137. package/dist/components/Charts/Core/DefaultChartDataProperties.js +64 -0
  138. package/dist/components/Charts/Core/DefaultProperties.d.ts +0 -0
  139. package/dist/components/Charts/Core/DefaultProperties.js +0 -0
  140. package/dist/components/Charts/Core/DefaultProperties.type.d.ts +586 -0
  141. package/dist/components/Charts/Core/DefaultProperties.type.js +585 -0
  142. package/dist/components/Charts/Core/DefaultProperties.types.d.ts +592 -0
  143. package/dist/components/Charts/Core/DefaultProperties.types.js +592 -0
  144. package/dist/index.d.ts +34 -2
  145. package/dist/index.js +40 -2
  146. package/package.json +40 -29
  147. package/dist/components/charts/linechart/LineChart.d.ts +0 -12
  148. package/dist/components/charts/linechart/LineChart.js +0 -5
  149. /package/dist/{components/charts/barchart → Components1/Charts/ChartsWithAxis/BarFamily}/BarChart.d.ts +0 -0
  150. /package/dist/{components/charts/barchart → Components1/Charts/ChartsWithAxis/BarFamily}/BarChart.js +0 -0
@@ -0,0 +1,246 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ //#region imports
3
+ import * as d3 from "d3";
4
+ import { useEffect, useRef } from "react";
5
+ import { colorThemeTypes, fontStyleOptions, } from "../../Core/Common.types";
6
+ import { drawChartTitle, firstFunctionBeforeRender, getNumberWithFormatFunction, hideTooltipOnMouseOut, initChartArea, initSvg, marginCalculationsForChartsWithoutLegends, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
7
+ import { chartMargins } from "../../Core/DefaultProperties.types";
8
+ import { logError } from "../../../../Services/ErrorLog";
9
+ //#endregion
10
+ const fileName = "TreemapChart.tsx";
11
+ const Treemap = ({ data, formatOptions, chartId }) => {
12
+ const svgRef = useRef(); // Reference to the SVG element where the chart will be drawn
13
+ let chartFormatOptions; // Format options for the chart, including colors, titles, and other settings
14
+ let width; // svg total width
15
+ let height; // svg total height
16
+ let chartTitleHeight = 40; // Height of the chart title
17
+ let margins = chartMargins; // Margins for the chart
18
+ let innerHeight; // Height of the chart excluding margins
19
+ let innerWidth; // Width of the chart excluding margins
20
+ let chartAreaTagG;
21
+ let chartData; // Data for the treemap, structured as an array of nodes
22
+ let defaultColor; // Default color for the treemap nodes if color scheme is not set
23
+ let svg; // D3 selection of the SVG element
24
+ // #region useEffec
25
+ useEffect(() => {
26
+ drawChart();
27
+ }, [formatOptions]);
28
+ // #endregion
29
+ const drawChart = () => {
30
+ ({ chartFormatOptions, svg, width, height } = firstFunctionBeforeRender(svgRef, formatOptions));
31
+ ({ margins, chartTitleHeight, innerHeight, innerWidth } =
32
+ marginCalculationsForChartsWithoutLegends(chartFormatOptions, height, width, true));
33
+ initSvg(svgRef, width, height, chartFormatOptions);
34
+ chartAreaTagG = initChartArea(svg, margins);
35
+ drawChartTitle(svgRef, chartTitleHeight, width, chartFormatOptions);
36
+ initChartData();
37
+ prepareTreeColors();
38
+ initChartRect();
39
+ };
40
+ const initChartData = () => {
41
+ try {
42
+ const rawData = {
43
+ name: "root",
44
+ children: data,
45
+ }; // Creating hierarchy data structure for D3 treemap
46
+ const root = d3
47
+ .hierarchy(rawData)
48
+ .sum((d) => d.data && d.data[0].value)
49
+ .sort((a, b) => (b.data.data[0].value ?? 0) - (a.data.data[0].value ?? 0));
50
+ chartData = d3
51
+ .treemap()
52
+ .tile(d3.treemapSquarify)
53
+ .size([innerWidth, innerHeight])
54
+ .padding(1)
55
+ .round(true)(root)
56
+ .leaves();
57
+ defaultColor = chartData[0].data.properties.color;
58
+ }
59
+ catch (error) {
60
+ logError(fileName, "initChartData", error);
61
+ }
62
+ };
63
+ const prepareTreeColors = () => {
64
+ try {
65
+ let colorScheme = chartFormatOptions.colorScale.showColor;
66
+ if (colorScheme === colorThemeTypes.colorTheme) {
67
+ let valueIndex = chartData[0].data.data.length > 1 ? 1 : 0;
68
+ let startColor = chartFormatOptions.colorScale.startColor;
69
+ let endColor = chartFormatOptions.colorScale.endColor;
70
+ // Extract unique values
71
+ let uniqueValueSet = new Set(chartData.map((d) => d.data.data[valueIndex].value));
72
+ let uniqueValues = Array.from(uniqueValueSet).sort((a, b) => a - b);
73
+ let totalUniqueValueCount = uniqueValues.length;
74
+ let colorScale;
75
+ if (totalUniqueValueCount === 1) {
76
+ colorScale = () => startColor; // Single value — one color
77
+ }
78
+ else {
79
+ const interpolator = d3.interpolateLab(startColor, endColor);
80
+ colorScale = d3
81
+ .scaleOrdinal()
82
+ .domain(uniqueValues.map(String))
83
+ .range(uniqueValues.map((_, i) => interpolator(i / (totalUniqueValueCount - 1))));
84
+ }
85
+ // Assign themeColor to each data point
86
+ chartData = chartData.map((d) => {
87
+ let value = d.data.data[valueIndex].value;
88
+ d.data.properties["themeColor"] = colorScale(value.toString());
89
+ return d;
90
+ });
91
+ appendColorScale(startColor, endColor, totalUniqueValueCount, uniqueValues);
92
+ }
93
+ }
94
+ catch (error) {
95
+ logError(fileName, "prepareTreeColors", error);
96
+ }
97
+ };
98
+ const appendColorScale = (startColor, endColor, totalUniqueValueCount, uniqueValues) => {
99
+ try {
100
+ let colorScale = d3
101
+ .scalePow()
102
+ .exponent(1)
103
+ .domain([0, totalUniqueValueCount - 1])
104
+ .range([startColor, endColor]);
105
+ let object = svg
106
+ .append("foreignObject")
107
+ .attr("class", "parentGroup")
108
+ .attr("x", width - 130)
109
+ .attr("y", height - 30)
110
+ .attr("width", 115)
111
+ .attr("height", 10);
112
+ let div = object
113
+ .selectAll(null)
114
+ .data(uniqueValues)
115
+ .enter()
116
+ .append("xhtml:div")
117
+ .style("width", `${100 / totalUniqueValueCount}%`)
118
+ .style("height", "100%")
119
+ .style("flex-direction", "row")
120
+ .style("display", "inline-block")
121
+ .attr("width", "20px")
122
+ .attr("height", "10px")
123
+ .style("background-color", (d, i) => colorScale(i))
124
+ .append("div")
125
+ .attr("width", "20px")
126
+ .attr("height", "10px")
127
+ .style("display", "inline-block");
128
+ // adding colorscale text
129
+ const colorScaleText = svg
130
+ .append("g")
131
+ .attr("transform", `translate(${width - 120},${height - 10})`)
132
+ .append("text")
133
+ .attr("text-anchor", "end")
134
+ .attr("class", "DisplayUnit")
135
+ .style("fill", chartFormatOptions.yAxisTitle.yAxisTitleColor)
136
+ .style("font-size", "10px")
137
+ .style("font-family", chartFormatOptions.yAxisTitle.yAxisTitleFontFamily)
138
+ .text("min");
139
+ svg
140
+ .append("g")
141
+ .attr("transform", `translate(${width - 10},${height - 10})`)
142
+ .append("text")
143
+ .attr("text-anchor", "end")
144
+ .attr("class", "DisplayUnit")
145
+ .style("fill", chartFormatOptions.yAxisTitle.yAxisTitleColor)
146
+ .style("font-size", "10px")
147
+ .style("font-family", chartFormatOptions.yAxisTitle.yAxisTitleFontFamily)
148
+ .text("max");
149
+ }
150
+ catch (error) {
151
+ logError(fileName, "appendColorScale", error);
152
+ }
153
+ };
154
+ const getColor = (d) => {
155
+ try {
156
+ let colorScheme = chartFormatOptions.colorScale.showColor;
157
+ switch (colorScheme) {
158
+ case colorThemeTypes.none:
159
+ return defaultColor;
160
+ case colorThemeTypes.discrete:
161
+ return d.properties.color;
162
+ case colorThemeTypes.colorTheme:
163
+ return d.properties.themeColor;
164
+ default:
165
+ return;
166
+ }
167
+ }
168
+ catch (error) {
169
+ logError(fileName, "getColor", error);
170
+ }
171
+ };
172
+ const initChartRect = () => {
173
+ try {
174
+ const leaf = chartAreaTagG
175
+ .selectAll("g")
176
+ .data(chartData)
177
+ .enter()
178
+ .append("g")
179
+ .attr("transform", (d) => `translate(${d.x0},${d.y0})`);
180
+ leaf
181
+ .append("rect")
182
+ .attr("fill", (d) => getColor(d.data))
183
+ .attr("fill-opacity", 0.7)
184
+ .attr("width", (d) => d.x1 - d.x0)
185
+ .attr("height", (d) => d.y1 - d.y0)
186
+ .on("mousemove", (d, data) => {
187
+ showTooltipOnMouseMove([
188
+ {
189
+ key: chartFormatOptions.yAxisTitle.yAxisTitleText,
190
+ value: getNumberWithFormatFunction(chartFormatOptions.toolTip.toolTipDisplayUnits, chartFormatOptions.toolTip.toolTipNumberFormat, chartFormatOptions.toolTip.toolTipDecimalPrecision)(data.data.data[0].value),
191
+ },
192
+ { key: "Legend", value: data.data.data[0].legend },
193
+ data.data.data[1]
194
+ ? {
195
+ key: data.data.data[1].legend,
196
+ value: getNumberWithFormatFunction(chartFormatOptions.toolTip.toolTipDisplayUnits, chartFormatOptions.toolTip.toolTipNumberFormat, chartFormatOptions.toolTip.toolTipDecimalPrecision)(data.data.data[1].value),
197
+ }
198
+ : "",
199
+ ], chartFormatOptions);
200
+ })
201
+ .on("mouseout", () => hideTooltipOnMouseOut());
202
+ // Add clipPath
203
+ leaf
204
+ .append("clipPath")
205
+ .attr("id", (d, i) => `clip-${i}-${chartId}`)
206
+ .append("rect")
207
+ .attr("width", (d) => d.x1 - d.x0)
208
+ .attr("height", (d) => d.y1 - d.y0);
209
+ // Add clipped text
210
+ leaf
211
+ .append("text")
212
+ .style("fill", (d) => d.data.properties.labelFontColor)
213
+ .style("font-family", (d) => d.data.properties.fontFamily)
214
+ .style("font-size", (d) => d.data.properties.fontSize)
215
+ .style("font-style", (d) => d.data.properties.fontStyle.includes(fontStyleOptions.italic)
216
+ ? fontStyleOptions.italic
217
+ : "")
218
+ .style("text-decoration", (d) => d.data.properties.fontStyle.includes(fontStyleOptions.underline)
219
+ ? fontStyleOptions.underline
220
+ : "")
221
+ .style("font-weight", (d) => d.data.properties.fontStyle.includes(fontStyleOptions.bold)
222
+ ? fontStyleOptions.bold
223
+ : "")
224
+ .attr("clip-path", (d, i) => `url(#clip-${i}-${chartId})`);
225
+ if (chartFormatOptions.plotArea.dataLabelName) {
226
+ leaf
227
+ .selectAll("text")
228
+ .append("tspan")
229
+ .attr("x", 5)
230
+ .attr("y", "1.1em")
231
+ .text((d) => d.data.legend);
232
+ }
233
+ leaf
234
+ .selectAll("text")
235
+ .append("tspan")
236
+ .attr("x", 5)
237
+ .attr("y", chartFormatOptions.plotArea.dataLabelName ? "2.1em" : "1.1em")
238
+ .text((d) => getNumberWithFormatFunction(chartFormatOptions.plotArea.plotAreaDisplayUnits, chartFormatOptions.plotArea.dataLabelNumberFormat, chartFormatOptions.plotArea.dataLabelDecimalPrecision)(d.data.data[0].value));
239
+ }
240
+ catch (error) {
241
+ logError(fileName, "initChartRect", error);
242
+ }
243
+ };
244
+ return (_jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx("div", { id: "chartTooltipDiv" }), _jsx("svg", { className: "chartSVG", ref: svgRef, id: chartId, style: { width: "100%", height: "100%" } })] }));
245
+ };
246
+ export default Treemap;
File without changes
File without changes
@@ -0,0 +1,369 @@
1
+ export declare enum staticLegendShape {
2
+ rectangle = "rectangle",
3
+ circle = "circle",
4
+ hollowCircle = "hollowCircle",
5
+ areaWithLine = "areaWithLine",
6
+ line = "line",
7
+ custom = "custom",
8
+ none = "none"
9
+ }
10
+ export declare enum connectedStyle {
11
+ "solid" = "unset",
12
+ "dotted" = 2,
13
+ "dashed" = 7
14
+ }
15
+ export declare enum staticLineStyle {
16
+ "solid" = "solid",
17
+ "dotted" = "dotted",
18
+ "dashed" = "dashed"
19
+ }
20
+ import { defaultChartFormatOptions } from "./DefaultProperties.types";
21
+ import * as d3 from "d3";
22
+ import * as d3Annotation from "d3-svg-annotation";
23
+ export type TTextMeasureOptions = {
24
+ content: string;
25
+ fontSize?: number;
26
+ fontFamily?: string;
27
+ rotationDegree?: number;
28
+ fixedWidth?: number;
29
+ };
30
+ export type TTextDimensions = {
31
+ width: number;
32
+ height: number;
33
+ rotatedWidth: number;
34
+ rotatedHeight: number;
35
+ };
36
+ export type TDefaultChartFormatOptionsType = typeof defaultChartFormatOptions;
37
+ export interface ICustomArcDatum extends d3.DefaultArcObject {
38
+ x0: number;
39
+ x1: number;
40
+ y0: number;
41
+ y1: number;
42
+ depth: number;
43
+ data: TSeries;
44
+ }
45
+ export type TNode = {
46
+ height: any;
47
+ parent: any;
48
+ value: any;
49
+ x0: number;
50
+ x1: number;
51
+ y0: number;
52
+ y1: number;
53
+ depth: number;
54
+ data: TSeries;
55
+ };
56
+ export type TLegendEntry = {
57
+ color?: string;
58
+ name?: string;
59
+ type?: string;
60
+ axis?: string;
61
+ alias?: string;
62
+ fontSize?: number;
63
+ fontStyle?: string[];
64
+ fontFamily?: string;
65
+ labelColor?: string;
66
+ markerShape?: string;
67
+ markerColor?: string;
68
+ lineWidth?: number;
69
+ lineStyle?: string;
70
+ markerSize?: number;
71
+ opacity?: number;
72
+ annotation?: number;
73
+ disableAnnotation?: boolean;
74
+ connector?: number;
75
+ disableConnector?: boolean;
76
+ measureUniqueId?: string;
77
+ legendUniqueId?: string;
78
+ borderStyle?: string;
79
+ borderWidth?: number;
80
+ borderRadius?: number;
81
+ borderColor?: string;
82
+ labelFontSize?: number;
83
+ labelFontStyle?: string[];
84
+ labelFont?: string;
85
+ labelFontColor?: string;
86
+ valueFontSize?: number;
87
+ valueFontStyle?: string[];
88
+ valueFont?: string;
89
+ valueFontColor?: string;
90
+ backgroundColor?: string;
91
+ nodeHeight?: number;
92
+ nodeWidth?: number;
93
+ dataLabelPosition?: string;
94
+ secondaryAxisBgColor?: string;
95
+ actualChartType?: string;
96
+ hideZeroValues?: boolean;
97
+ stackBorderWidth?: number;
98
+ stackBorderColor?: string;
99
+ stackBorderStyle?: number;
100
+ seriesLabelVisibility?: boolean;
101
+ totalValue?: number;
102
+ currentMeasure?: string;
103
+ legend?: string;
104
+ dimensions?: string[];
105
+ maximumMeasure?: number;
106
+ measures?: number[];
107
+ minimumMeasure?: number;
108
+ disableLineStyle?: boolean;
109
+ endColor?: string;
110
+ disableAnnotationPosition?: boolean;
111
+ startColor?: string;
112
+ disableMarkerShape?: boolean;
113
+ disableMarkerColor?: boolean;
114
+ setColorScale?: boolean;
115
+ areaBorderColor?: string;
116
+ disableDataLabelPosition?: boolean;
117
+ disableMarkerSize?: boolean;
118
+ annotationPosition?: number;
119
+ individualAnnotationVisibility?: string;
120
+ currentLegend?: string;
121
+ tooltip?: string;
122
+ tooltipMeasure?: number;
123
+ themeColor?: string;
124
+ };
125
+ export declare const ConnecterCurve: {
126
+ "1": string;
127
+ "2": d3.CurveFactory;
128
+ "3": d3.CurveFactory;
129
+ };
130
+ export declare const AnnotationTypeMap: {
131
+ 1: typeof d3Annotation.annotationLabel;
132
+ 2: typeof d3Annotation.annotationLabel;
133
+ 3: typeof d3Annotation.annotationCallout;
134
+ 4: typeof d3Annotation.annotationCalloutElbow;
135
+ 5: typeof d3Annotation.annotationCalloutCurve;
136
+ };
137
+ export declare const ConnectedStyle: {
138
+ solid: string;
139
+ Dotted: string;
140
+ Dashed: string;
141
+ };
142
+ export type TChartMargins = {
143
+ top: number;
144
+ right: number;
145
+ bottom: number;
146
+ left: number;
147
+ };
148
+ export type TPieOfPieSeries = {
149
+ legend: string;
150
+ data: TDataPoint[];
151
+ children?: TPieOfPieSeries[];
152
+ };
153
+ export type TAnnotationObject = {
154
+ note: {
155
+ title: string;
156
+ label: string;
157
+ align: string;
158
+ };
159
+ data: {
160
+ x: number;
161
+ y: number;
162
+ legend: string;
163
+ dimension: string;
164
+ measure: number;
165
+ labelFontFamily: string;
166
+ labelFontColor: string;
167
+ labelFontSize: number;
168
+ labelFontStyle: string[];
169
+ valueFontFamily: string;
170
+ valueFontColor: string;
171
+ valueFontSize: number;
172
+ valueFontStyle: string[];
173
+ isVisible: boolean;
174
+ };
175
+ dx: 0;
176
+ dy: 0;
177
+ connector: {
178
+ end: string;
179
+ curve: d3.CurveFactory;
180
+ };
181
+ subject: {
182
+ height: number;
183
+ width: number;
184
+ };
185
+ type: d3Annotation.annotationLabel<any>;
186
+ color: string;
187
+ height: number;
188
+ width: number;
189
+ index: number;
190
+ };
191
+ export declare enum staticLegendPosition {
192
+ "left" = "Left",
193
+ "right" = "Right",
194
+ "top" = "Top",
195
+ "bottom" = "Bottom",
196
+ "none" = "None"
197
+ }
198
+ export declare enum staticDisplayUnits {
199
+ "thousands" = "Thousands",
200
+ "millions" = "Millions",
201
+ "billions" = "Billions",
202
+ "none" = "None"
203
+ }
204
+ export declare enum staticNumberUnits {
205
+ "percentage" = ",.0%",
206
+ "general" = "",
207
+ "scientific" = ".2n",
208
+ "currency_USD" = ".2$",
209
+ "currency_CAD" = ".2c",
210
+ "currency_EUR" = ".2\u0113",
211
+ "currency_CHF" = ".2ch",
212
+ "currency_UK" = ".2\u00A3",
213
+ "currency_INR" = ".2\u20B9",
214
+ "commaSeparated" = ","
215
+ }
216
+ export declare enum staticDataLabelPositions {
217
+ "top" = "1",
218
+ "bottom" = "3",
219
+ "middle" = "2"
220
+ }
221
+ export declare enum staticTotalAlignment {
222
+ "start" = "1",
223
+ "middle" = "2",
224
+ "end" = "3"
225
+ }
226
+ export declare enum staticTotalPosition {
227
+ "top" = "1",
228
+ "bottom" = "2"
229
+ }
230
+ export declare const colorThemeTypes: {
231
+ none: string;
232
+ discrete: string;
233
+ colorTheme: string;
234
+ };
235
+ export declare const dataLabelPositionType: {
236
+ automatic: string;
237
+ startOnly: string;
238
+ endOnly: string;
239
+ startAndEndBoth: string;
240
+ none: string;
241
+ };
242
+ export declare enum connectorKPIforSpeedometerType {
243
+ PointerValue = "1",
244
+ Absolute = "2",
245
+ CAGR = "3",
246
+ PercentageGrowth = "4"
247
+ }
248
+ export declare const legendColorMode: {
249
+ singleColor: string;
250
+ multiColor: string;
251
+ };
252
+ export declare const fontStyleOptions: {
253
+ underline: string;
254
+ bold: string;
255
+ italic: string;
256
+ normal: string;
257
+ };
258
+ export declare enum verticalLegendAllignment {
259
+ top = "Top",
260
+ middle = "Middle",
261
+ bottom = "Bottom"
262
+ }
263
+ export declare enum horizontalLegendAllignment {
264
+ start = "Start",
265
+ middle = "Middle",
266
+ end = "End"
267
+ }
268
+ export type TSeries = {
269
+ legend: string;
270
+ data: TDataPoint[];
271
+ properties?: TLegendEntry;
272
+ };
273
+ export type TData = {
274
+ ChartData: TSeries[];
275
+ DimensionList: string[];
276
+ };
277
+ export type TDataPoint = {
278
+ 0?: number;
279
+ 1?: number;
280
+ dimension: string;
281
+ value: number;
282
+ legend: string;
283
+ hideZero?: boolean;
284
+ axis?: string;
285
+ key?: string;
286
+ type?: string;
287
+ labelPosition?: string;
288
+ labelColor?: string;
289
+ };
290
+ export interface ICustomArcDatum extends d3.DefaultArcObject {
291
+ x0: number;
292
+ x1: number;
293
+ y0: number;
294
+ y1: number;
295
+ depth: number;
296
+ data: TSeries;
297
+ }
298
+ export interface IMapsProps {
299
+ chartId: string;
300
+ data: TSeries[];
301
+ geoJsonNode: TGeoJsonNode;
302
+ formatOptions: TDefaultChartFormatOptionsType;
303
+ }
304
+ type TGeoJsonNode = {
305
+ dimensionName: string;
306
+ mappings: {
307
+ actualName: string;
308
+ mappedName: string;
309
+ }[];
310
+ dimensionNode: TDimensionNode;
311
+ groups: {
312
+ groupName: string;
313
+ groupedRegions: string[];
314
+ }[];
315
+ };
316
+ type TDimensionNode = {
317
+ "actualName": string;
318
+ "dataType": string;
319
+ "name": string;
320
+ "datasourceId": string;
321
+ "isVisible": boolean;
322
+ "type": string;
323
+ "datasourceName": string;
324
+ };
325
+ export type TLegendsFormatting = {
326
+ color?: string;
327
+ name?: string;
328
+ alias?: string;
329
+ fontSize?: number;
330
+ fontStyle?: string[];
331
+ fontFamily?: string;
332
+ markerShape?: string;
333
+ markerColor?: string;
334
+ actualChartType?: string;
335
+ };
336
+ export type bubbleScatterData = {
337
+ dimension: number;
338
+ dimensionName: string;
339
+ legendColor: string;
340
+ legendName: string;
341
+ measure: number;
342
+ measureName: string;
343
+ sizeName: string;
344
+ sizeValue: number;
345
+ };
346
+ export type TBubbleChartProps = {
347
+ chartId: string;
348
+ clientWidth: number;
349
+ clientHeight: number;
350
+ data: bubbleScatterData[];
351
+ legendEntries: TLegendsFormatting[];
352
+ formatOptions: TDefaultChartFormatOptionsType;
353
+ };
354
+ export declare const referenceLineTypes: {
355
+ None: string;
356
+ Mean: string;
357
+ Median: string;
358
+ Custom: string;
359
+ };
360
+ export type TScatterChartProps = {
361
+ chartId: string;
362
+ clientWidth: number;
363
+ clientHeight: number;
364
+ data: bubbleScatterData[];
365
+ shapesList: TLegendsFormatting[];
366
+ colorsList: TLegendsFormatting[];
367
+ formatOptions: TDefaultChartFormatOptionsType;
368
+ };
369
+ export {};