pace-chart-lib 1.0.1 → 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.
- package/dist/{components → Components}/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +76 -38
- package/dist/{components → Components}/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.d.ts +4 -2
- package/dist/{components → Components}/Charts/Core/CommonFunctions.d.ts +3 -1
- package/dist/{components → Components}/Charts/Core/DefaultProperties.types.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/pace-chart-lib.es.js +54619 -0
- package/dist/pace-chart-lib.umd.js +54622 -0
- package/dist/vite.svg +1 -0
- package/package.json +1 -1
- package/dist/Services/ErrorLog.js +0 -3
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/AreaChart.js +0 -496
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/LineChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/LineChart.js +0 -491
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.js +0 -517
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackLineChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackLineChart.js +0 -553
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.js +0 -517
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackLineChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackLineChart.js +0 -553
- package/dist/components/Charts/ChartsWithAxis/BarFamily/BarChart.d.ts +0 -12
- package/dist/components/Charts/ChartsWithAxis/BarFamily/BarChart.js +0 -9
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +0 -4909
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.d.ts +0 -0
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.js +0 -0
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.js +0 -49
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart copy.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart copy.js +0 -486
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.js +0 -497
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.js +0 -418
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.js +0 -1013
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.js +0 -478
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LineChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LineChart.js +0 -451
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.js +0 -533
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackLineChart.js +0 -512
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.js +0 -530
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackLineChart.js +0 -512
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/BarChart.d.ts +0 -12
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/BarChart.js +0 -9
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.js +0 -497
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.js +0 -497
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredColumnChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredColumnChart.js +0 -479
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.js +0 -478
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.js +0 -473
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.js +0 -465
- package/dist/components/Charts/ChartsWithAxis/LineFamily/100%StackLineChart.d.ts +0 -0
- package/dist/components/Charts/ChartsWithAxis/LineFamily/100%StackLineChart.js +0 -0
- package/dist/components/Charts/ChartsWithAxis/LineFamily/LineChart.js +0 -451
- package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalisedStackLineChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalisedStackLineChart.js +0 -554
- package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.js +0 -510
- package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.d.ts +0 -4
- package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.js +0 -507
- package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.js +0 -393
- package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.js +0 -606
- package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxis.types.d.ts +0 -0
- package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxis.types.js +0 -0
- package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.js +0 -815
- package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.d.ts +0 -0
- package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.js +0 -0
- package/dist/components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.js +0 -32
- package/dist/components/Charts/ChartsWithoutAxis/Maps/Cordinates.js +0 -15021
- package/dist/components/Charts/ChartsWithoutAxis/Maps/Maps.js +0 -391
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/BubbleChart.js +0 -367
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.js +0 -570
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.js +0 -212
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.js +0 -401
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.js +0 -313
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/SankeyChart.js +0 -719
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/ScatterChart.js +0 -807
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.js +0 -514
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/VennChart.js +0 -282
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/WordCloud.js +0 -207
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/DonutChart.js +0 -476
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieChart.js +0 -420
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieFamilyCommonFunctions.js +0 -106
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/PieofPieChart.js +0 -507
- package/dist/components/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.js +0 -246
- package/dist/components/Charts/Core/Common.type.d.ts +0 -0
- package/dist/components/Charts/Core/Common.type.js +0 -0
- package/dist/components/Charts/Core/Common.types.js +0 -133
- package/dist/components/Charts/Core/CommonFunctions.js +0 -1782
- package/dist/components/Charts/Core/DefaultChartDataProperties.js +0 -64
- package/dist/components/Charts/Core/DefaultProperties.d.ts +0 -0
- package/dist/components/Charts/Core/DefaultProperties.js +0 -0
- package/dist/components/Charts/Core/DefaultProperties.type.d.ts +0 -586
- package/dist/components/Charts/Core/DefaultProperties.type.js +0 -585
- package/dist/components/Charts/Core/DefaultProperties.types.js +0 -592
- package/dist/index.js +0 -40
- /package/dist/{components → Components}/Charts/ChartsWithAxis/AreaFamily/AreaChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/LineFamily/LineChart.d.ts +0 -0
- /package/dist/{components/Charts/ChartsWithAxis/ColumnFamily → Components/Charts/ChartsWithAxis/LineFamily}/NormalizedStackLineChart.d.ts +0 -0
- /package/dist/{components/Charts/ChartsWithAxis/ColumnFamily → Components/Charts/ChartsWithAxis/LineFamily}/StackLineChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/Maps/Cordinates.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/Maps/Maps.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/BubbleChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/SankeyChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/ScatterChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/VennChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/OtherCharts/WordCloud.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/DonutChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/PieChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/PieFamilyCommonFunctions.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/PieofPieChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.d.ts +0 -0
- /package/dist/{components → Components}/Charts/Core/Common.types.d.ts +0 -0
- /package/dist/{components → Components}/Charts/Core/DefaultChartDataProperties.d.ts +0 -0
|
@@ -1,246 +0,0 @@
|
|
|
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.ChartData,
|
|
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
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
export var staticLegendShape;
|
|
2
|
-
(function (staticLegendShape) {
|
|
3
|
-
staticLegendShape["rectangle"] = "rectangle";
|
|
4
|
-
staticLegendShape["circle"] = "circle";
|
|
5
|
-
staticLegendShape["hollowCircle"] = "hollowCircle";
|
|
6
|
-
staticLegendShape["areaWithLine"] = "areaWithLine";
|
|
7
|
-
staticLegendShape["line"] = "line";
|
|
8
|
-
staticLegendShape["custom"] = "custom";
|
|
9
|
-
staticLegendShape["none"] = "none";
|
|
10
|
-
})(staticLegendShape || (staticLegendShape = {}));
|
|
11
|
-
export var connectedStyle;
|
|
12
|
-
(function (connectedStyle) {
|
|
13
|
-
connectedStyle["solid"] = "unset";
|
|
14
|
-
connectedStyle[connectedStyle["dotted"] = 2] = "dotted";
|
|
15
|
-
connectedStyle[connectedStyle["dashed"] = 7] = "dashed";
|
|
16
|
-
})(connectedStyle || (connectedStyle = {}));
|
|
17
|
-
export var staticLineStyle;
|
|
18
|
-
(function (staticLineStyle) {
|
|
19
|
-
staticLineStyle["solid"] = "solid";
|
|
20
|
-
staticLineStyle["dotted"] = "dotted";
|
|
21
|
-
staticLineStyle["dashed"] = "dashed";
|
|
22
|
-
})(staticLineStyle || (staticLineStyle = {}));
|
|
23
|
-
import * as d3 from "d3";
|
|
24
|
-
import * as d3Annotation from "d3-svg-annotation";
|
|
25
|
-
export const ConnecterCurve = {
|
|
26
|
-
"1": "",
|
|
27
|
-
"2": d3.curveLinear,
|
|
28
|
-
"3": d3.curveStep
|
|
29
|
-
};
|
|
30
|
-
export const AnnotationTypeMap = {
|
|
31
|
-
1: d3Annotation.annotationLabel,
|
|
32
|
-
2: d3Annotation.annotationLabel,
|
|
33
|
-
3: d3Annotation.annotationCallout,
|
|
34
|
-
4: d3Annotation.annotationCalloutElbow,
|
|
35
|
-
5: d3Annotation.annotationCalloutCurve,
|
|
36
|
-
};
|
|
37
|
-
export const ConnectedStyle = {
|
|
38
|
-
"solid": "unset",
|
|
39
|
-
"Dotted": "2",
|
|
40
|
-
"Dashed": "7"
|
|
41
|
-
};
|
|
42
|
-
export var staticLegendPosition;
|
|
43
|
-
(function (staticLegendPosition) {
|
|
44
|
-
staticLegendPosition["left"] = "Left";
|
|
45
|
-
staticLegendPosition["right"] = "Right";
|
|
46
|
-
staticLegendPosition["top"] = "Top";
|
|
47
|
-
staticLegendPosition["bottom"] = "Bottom";
|
|
48
|
-
staticLegendPosition["none"] = "None";
|
|
49
|
-
})(staticLegendPosition || (staticLegendPosition = {}));
|
|
50
|
-
export var staticDisplayUnits;
|
|
51
|
-
(function (staticDisplayUnits) {
|
|
52
|
-
staticDisplayUnits["thousands"] = "Thousands";
|
|
53
|
-
staticDisplayUnits["millions"] = "Millions";
|
|
54
|
-
staticDisplayUnits["billions"] = "Billions";
|
|
55
|
-
staticDisplayUnits["none"] = "None";
|
|
56
|
-
})(staticDisplayUnits || (staticDisplayUnits = {}));
|
|
57
|
-
export var staticNumberUnits;
|
|
58
|
-
(function (staticNumberUnits) {
|
|
59
|
-
staticNumberUnits["percentage"] = ",.0%";
|
|
60
|
-
staticNumberUnits["general"] = "";
|
|
61
|
-
staticNumberUnits["scientific"] = ".2n";
|
|
62
|
-
staticNumberUnits["currency_USD"] = ".2$";
|
|
63
|
-
staticNumberUnits["currency_CAD"] = ".2c";
|
|
64
|
-
staticNumberUnits["currency_EUR"] = ".2\u0113";
|
|
65
|
-
staticNumberUnits["currency_CHF"] = ".2ch";
|
|
66
|
-
staticNumberUnits["currency_UK"] = ".2\u00A3";
|
|
67
|
-
staticNumberUnits["currency_INR"] = ".2\u20B9";
|
|
68
|
-
staticNumberUnits["commaSeparated"] = ",";
|
|
69
|
-
})(staticNumberUnits || (staticNumberUnits = {}));
|
|
70
|
-
export var staticDataLabelPositions;
|
|
71
|
-
(function (staticDataLabelPositions) {
|
|
72
|
-
staticDataLabelPositions["top"] = "1";
|
|
73
|
-
staticDataLabelPositions["bottom"] = "3";
|
|
74
|
-
staticDataLabelPositions["middle"] = "2";
|
|
75
|
-
})(staticDataLabelPositions || (staticDataLabelPositions = {}));
|
|
76
|
-
export var staticTotalAlignment;
|
|
77
|
-
(function (staticTotalAlignment) {
|
|
78
|
-
staticTotalAlignment["start"] = "1";
|
|
79
|
-
staticTotalAlignment["middle"] = "2";
|
|
80
|
-
staticTotalAlignment["end"] = "3";
|
|
81
|
-
})(staticTotalAlignment || (staticTotalAlignment = {}));
|
|
82
|
-
export var staticTotalPosition;
|
|
83
|
-
(function (staticTotalPosition) {
|
|
84
|
-
staticTotalPosition["top"] = "1";
|
|
85
|
-
staticTotalPosition["bottom"] = "2";
|
|
86
|
-
})(staticTotalPosition || (staticTotalPosition = {}));
|
|
87
|
-
export const colorThemeTypes = {
|
|
88
|
-
none: "1",
|
|
89
|
-
discrete: "2",
|
|
90
|
-
colorTheme: "3",
|
|
91
|
-
};
|
|
92
|
-
export const dataLabelPositionType = {
|
|
93
|
-
automatic: "1",
|
|
94
|
-
startOnly: "2",
|
|
95
|
-
endOnly: "3",
|
|
96
|
-
startAndEndBoth: "4",
|
|
97
|
-
none: "5"
|
|
98
|
-
};
|
|
99
|
-
export var connectorKPIforSpeedometerType;
|
|
100
|
-
(function (connectorKPIforSpeedometerType) {
|
|
101
|
-
connectorKPIforSpeedometerType["PointerValue"] = "1";
|
|
102
|
-
connectorKPIforSpeedometerType["Absolute"] = "2";
|
|
103
|
-
connectorKPIforSpeedometerType["CAGR"] = "3";
|
|
104
|
-
connectorKPIforSpeedometerType["PercentageGrowth"] = "4";
|
|
105
|
-
})(connectorKPIforSpeedometerType || (connectorKPIforSpeedometerType = {}));
|
|
106
|
-
export const legendColorMode = {
|
|
107
|
-
singleColor: "2",
|
|
108
|
-
multiColor: "1",
|
|
109
|
-
};
|
|
110
|
-
export const fontStyleOptions = {
|
|
111
|
-
underline: "Underline",
|
|
112
|
-
bold: "Bold",
|
|
113
|
-
italic: "Italic",
|
|
114
|
-
normal: "Normal",
|
|
115
|
-
};
|
|
116
|
-
export var verticalLegendAllignment;
|
|
117
|
-
(function (verticalLegendAllignment) {
|
|
118
|
-
verticalLegendAllignment["top"] = "Top";
|
|
119
|
-
verticalLegendAllignment["middle"] = "Middle";
|
|
120
|
-
verticalLegendAllignment["bottom"] = "Bottom";
|
|
121
|
-
})(verticalLegendAllignment || (verticalLegendAllignment = {}));
|
|
122
|
-
export var horizontalLegendAllignment;
|
|
123
|
-
(function (horizontalLegendAllignment) {
|
|
124
|
-
horizontalLegendAllignment["start"] = "Start";
|
|
125
|
-
horizontalLegendAllignment["middle"] = "Middle";
|
|
126
|
-
horizontalLegendAllignment["end"] = "End";
|
|
127
|
-
})(horizontalLegendAllignment || (horizontalLegendAllignment = {}));
|
|
128
|
-
export const referenceLineTypes = {
|
|
129
|
-
None: "None",
|
|
130
|
-
Mean: "Mean",
|
|
131
|
-
Median: "Median",
|
|
132
|
-
Custom: "Custom",
|
|
133
|
-
};
|