pace-chart-lib 1.0.2 → 1.0.4
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,212 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import { fontStyleOptions, } from "../../Core/Common.types";
|
|
4
|
-
import { chartMargins } from "../../Core/DefaultProperties.types";
|
|
5
|
-
import * as d3 from "d3";
|
|
6
|
-
import { calculateLegendsMaxPossibleWidth, convertStringToNumber, drawChartTitle, firstFunctionBeforeRender, generalizedChartData, getNumberWithFormatFunction, hideTooltipOnMouseOut, initChartArea, initLegendListWithTotalValueAllowance, initSvg, marginCalculationsForChartsWithoutAxis, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
|
|
7
|
-
import { drawTotalValue } from "../PieFamily/PieFamilyCommonFunctions";
|
|
8
|
-
import { logError } from "../../../../Services/ErrorLog";
|
|
9
|
-
const fileName = "ProgressChart.tsx";
|
|
10
|
-
const ProgressChart = ({ data, formatOptions, chartId, }) => {
|
|
11
|
-
const svgRef = useRef(); // Reference to the SVG element
|
|
12
|
-
let seriesData = generalizedChartData(data.ChartData); // Data for the chart
|
|
13
|
-
let chartFormatOptions; // Chart format options
|
|
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 maxLegendDimensions = [0, 0]; // to calculate margins [width, height]
|
|
19
|
-
let innerHeight; // Height of the chart excluding margins
|
|
20
|
-
let innerWidth; // Width of the chart excluding margins
|
|
21
|
-
let totalValue; // Total value of the progress chart
|
|
22
|
-
let chartAreaTagG; // Group element for the chart area
|
|
23
|
-
let svg; // D3 selection of the SVG element
|
|
24
|
-
let legendListWidth; // Width of the legend list
|
|
25
|
-
let radius; // Radius of the pie chart
|
|
26
|
-
let innerRadius; // Inner radius of the pie chart
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
drawChart();
|
|
29
|
-
}, [formatOptions]);
|
|
30
|
-
const drawChart = () => {
|
|
31
|
-
// Skipped try-catch as per instruction
|
|
32
|
-
({ chartFormatOptions, svg, width, height } = firstFunctionBeforeRender(svgRef, formatOptions));
|
|
33
|
-
maxLegendDimensions = calculateLegendsMaxPossibleWidth(chartFormatOptions, seriesData);
|
|
34
|
-
({ margins, innerHeight, innerWidth, legendListWidth, chartTitleHeight } =
|
|
35
|
-
marginCalculationsForChartsWithoutAxis(chartFormatOptions, width, height, maxLegendDimensions, margins));
|
|
36
|
-
setRadiusAndInnerRadius();
|
|
37
|
-
initSvg(svgRef, width, height, chartFormatOptions); // Initialize SVG with width, height and background color
|
|
38
|
-
chartAreaTagG = initChartArea(svg, margins);
|
|
39
|
-
drawChartTitle(svgRef, chartTitleHeight, width, chartFormatOptions);
|
|
40
|
-
initLegendListWithTotalValueAllowance(chartFormatOptions, svg, seriesData, width, height, legendListWidth, chartTitleHeight, chartId, margins);
|
|
41
|
-
initProgressChartData();
|
|
42
|
-
drawProgressChart();
|
|
43
|
-
drawTotalValue(chartFormatOptions, totalValue, chartTitleHeight, svg, width, height);
|
|
44
|
-
};
|
|
45
|
-
const setRadiusAndInnerRadius = () => {
|
|
46
|
-
try {
|
|
47
|
-
radius = Math.min(innerHeight * 0.45, innerWidth * 0.45);
|
|
48
|
-
innerRadius = Math.min((convertStringToNumber(chartFormatOptions.plotArea.innerRadius) / 100) *
|
|
49
|
-
radius, radius);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
logError(fileName, "setRadiusAndInnerRadius", error);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const initProgressChartData = () => {
|
|
56
|
-
try {
|
|
57
|
-
seriesData = seriesData.sort((a, b) => b.data[0].value - a.data[0].value); // Sort data by value in descending order this will allow me to draw arcs in correct order
|
|
58
|
-
totalValue = data[0].data[0].value + data[1].data[0].value;
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
logError(fileName, "initProgressChartData", error);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const drawProgressChart = () => {
|
|
65
|
-
try {
|
|
66
|
-
let maxValue = data[0].data[0].value;
|
|
67
|
-
let progressValue = data[1].data[0].value;
|
|
68
|
-
let completeAngle = Math.PI * 2; // 360 degrees in radians
|
|
69
|
-
let progressAngle = (progressValue / maxValue) * Math.PI * 2;
|
|
70
|
-
let valuefontStyle = chartFormatOptions.plotArea.dataLabelValueFontStyle;
|
|
71
|
-
const arc = d3
|
|
72
|
-
.arc()
|
|
73
|
-
.innerRadius(innerRadius)
|
|
74
|
-
.outerRadius(radius)
|
|
75
|
-
.startAngle(0)
|
|
76
|
-
.cornerRadius(convertStringToNumber(chartFormatOptions.plotArea.cornerRadius));
|
|
77
|
-
// Create a complete arc
|
|
78
|
-
chartAreaTagG
|
|
79
|
-
.append("path")
|
|
80
|
-
.attr("class", "secondary-circle")
|
|
81
|
-
.attr("fill", data[0].properties.color)
|
|
82
|
-
.attr("fill-opacity", chartFormatOptions.plotArea.opacityforProgressScale)
|
|
83
|
-
.attr("d", arc({ endAngle: completeAngle }))
|
|
84
|
-
.on("mousemove", (d) => {
|
|
85
|
-
try {
|
|
86
|
-
showTooltipOnMouseMove([
|
|
87
|
-
{
|
|
88
|
-
key: data[0].properties.alias,
|
|
89
|
-
value: chartFormatOptions.toolTip.toolTipNumberFormatProgress ==
|
|
90
|
-
",.0%"
|
|
91
|
-
? "100 %"
|
|
92
|
-
: getNumberWithFormatFunction("None", chartFormatOptions.toolTip
|
|
93
|
-
.toolTipNumberFormatProgress, chartFormatOptions.toolTip.toolTipDecimalPrecision)(maxValue),
|
|
94
|
-
},
|
|
95
|
-
], chartFormatOptions);
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
logError(fileName, "drawProgressChart.onMouseMove.secondary-circle", error);
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
.on("mouseout", () => {
|
|
102
|
-
try {
|
|
103
|
-
hideTooltipOnMouseOut();
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
logError(fileName, "drawProgressChart.onMouseOut.secondary-circle", error);
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
.attr("transform", getTransformString());
|
|
110
|
-
// Create the progress arc
|
|
111
|
-
chartAreaTagG
|
|
112
|
-
.append("path")
|
|
113
|
-
.attr("class", "progress-circle")
|
|
114
|
-
.attr("fill", data[1].properties.color)
|
|
115
|
-
.attr("fill-opacity", chartFormatOptions.plotArea.opacityforProgressGoal)
|
|
116
|
-
.attr("d", arc({ endAngle: progressAngle }))
|
|
117
|
-
.on("mousemove", (d) => {
|
|
118
|
-
try {
|
|
119
|
-
showTooltipOnMouseMove([
|
|
120
|
-
{
|
|
121
|
-
key: data[1].properties.alias,
|
|
122
|
-
value: chartFormatOptions.toolTip.toolTipNumberFormatProgress ==
|
|
123
|
-
",.0%"
|
|
124
|
-
? Math.round((progressValue / maxValue) * 100) + "%"
|
|
125
|
-
: getNumberWithFormatFunction("None", chartFormatOptions.toolTip.toolTipDecimalPrecision, chartFormatOptions.toolTip.toolTipNumberFormatProgress)(maxValue),
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
key: data[0].properties.alias,
|
|
129
|
-
value: chartFormatOptions.toolTip.toolTipNumberFormatProgress ==
|
|
130
|
-
",.0%"
|
|
131
|
-
? "100 %"
|
|
132
|
-
: getNumberWithFormatFunction("None", chartFormatOptions.toolTip.toolTipDecimalPrecision, chartFormatOptions.toolTip.toolTipNumberFormatProgress)(progressValue),
|
|
133
|
-
},
|
|
134
|
-
], chartFormatOptions);
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
logError(fileName, "drawProgressChart.onMouseMove.progress-circle", error);
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
.on("mouseout", () => {
|
|
141
|
-
try {
|
|
142
|
-
hideTooltipOnMouseOut();
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
logError(fileName, "drawProgressChart.onMouseOut.progress-circle", error);
|
|
146
|
-
}
|
|
147
|
-
})
|
|
148
|
-
.attr("transform", "translate(" + innerWidth / 2 + "," + innerHeight / 2 + ")")
|
|
149
|
-
.transition()
|
|
150
|
-
.duration(1000)
|
|
151
|
-
.attrTween("d", function (d) {
|
|
152
|
-
try {
|
|
153
|
-
const interpolate = d3.interpolate(0, progressAngle);
|
|
154
|
-
return function (t) {
|
|
155
|
-
try {
|
|
156
|
-
return arc({ endAngle: interpolate(t) });
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
logError(fileName, "drawProgressChart.attrTween.inner", error);
|
|
160
|
-
return "";
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
logError(fileName, "drawProgressChart.attrTween", error);
|
|
166
|
-
return () => "";
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
// Add text to display progress value
|
|
170
|
-
chartAreaTagG
|
|
171
|
-
.append("text")
|
|
172
|
-
.attr("transform", getTransformString())
|
|
173
|
-
.attr("dy", "0.35em")
|
|
174
|
-
.attr("text-anchor", "middle")
|
|
175
|
-
.attr("visibility", chartFormatOptions.plotArea.dataLabels ? "visible" : "hidden")
|
|
176
|
-
.attr("fill", chartFormatOptions.plotArea.dataLabelValueColor !== "#ffffff"
|
|
177
|
-
? chartFormatOptions.plotArea.dataLabelValueColor
|
|
178
|
-
: "none")
|
|
179
|
-
.attr("font-style", valuefontStyle.includes(fontStyleOptions.italic)
|
|
180
|
-
? fontStyleOptions.italic
|
|
181
|
-
: "")
|
|
182
|
-
.attr("text-decoration", valuefontStyle.includes(fontStyleOptions.underline)
|
|
183
|
-
? fontStyleOptions.underline
|
|
184
|
-
: "")
|
|
185
|
-
.attr("font-weight", valuefontStyle.includes(fontStyleOptions.bold)
|
|
186
|
-
? fontStyleOptions.bold
|
|
187
|
-
: "")
|
|
188
|
-
.attr("font-family", chartFormatOptions.plotArea.dataLabelValueFontFamily)
|
|
189
|
-
.attr("font-size", chartFormatOptions.plotArea.dataLabelValueFontSize)
|
|
190
|
-
.text(() => {
|
|
191
|
-
return chartFormatOptions.plotArea.dataLabelNumberFormatProgress ==
|
|
192
|
-
",.0%"
|
|
193
|
-
? Math.round((progressValue / maxValue) * 100) + "%"
|
|
194
|
-
: getNumberWithFormatFunction(chartFormatOptions.plotArea.dataLabelDecimalPrecision, chartFormatOptions.plotArea.dataLabelNumberFormatProgress, chartFormatOptions.plotArea.plotAreaDisplayUnits)(progressValue);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
catch (error) {
|
|
198
|
-
logError(fileName, "drawProgressChart", error);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
const getTransformString = () => {
|
|
202
|
-
try {
|
|
203
|
-
return "translate(" + innerWidth / 2 + "," + innerHeight / 2 + ")";
|
|
204
|
-
}
|
|
205
|
-
catch (error) {
|
|
206
|
-
logError(fileName, "getTransformString", error);
|
|
207
|
-
return "";
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
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%" } })] }));
|
|
211
|
-
};
|
|
212
|
-
export default ProgressChart;
|
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as d3 from "d3";
|
|
3
|
-
import * as d3Annotation from "d3-svg-annotation";
|
|
4
|
-
import { useEffect, useRef } from "react";
|
|
5
|
-
import { AnnotationTypeMap, ConnectedStyle, ConnecterCurve, dataLabelPositionType, fontStyleOptions, staticDataLabelPositions, } from "../../Core/Common.types";
|
|
6
|
-
import { calculateLegendsMaxPossibleWidth, convertStringToNumber, drawChartTitle, firstFunctionBeforeRender, generalizedChartData, getNumberWithFormatFunction, hideTooltipOnMouseOut, initLegendListWithTotalValueAllowance, initSvg, marginCalculationsForChartsWithoutAxis, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
|
|
7
|
-
import { chartMargins } from "../../Core/DefaultProperties.types";
|
|
8
|
-
import { logError } from "../../../../Services/ErrorLog";
|
|
9
|
-
const fileName = "PyramidChart.tsx";
|
|
10
|
-
const PyramidChart = ({ data, formatOptions, chartId, }) => {
|
|
11
|
-
const svgRef = useRef();
|
|
12
|
-
let seriesData = generalizedChartData(data.ChartData);
|
|
13
|
-
let chartFormatOptions;
|
|
14
|
-
let svg;
|
|
15
|
-
let width;
|
|
16
|
-
let height;
|
|
17
|
-
let chartTitleHeight = 40;
|
|
18
|
-
let margins = chartMargins;
|
|
19
|
-
let maxLegendDimensions = [0, 0];
|
|
20
|
-
let innerHeight;
|
|
21
|
-
let innerWidth;
|
|
22
|
-
let pyramidSide;
|
|
23
|
-
let pyramidHeight;
|
|
24
|
-
let stackHeightArray = [0];
|
|
25
|
-
let chartAreaTagG;
|
|
26
|
-
let pyramidTotalValue;
|
|
27
|
-
let legendListWidth;
|
|
28
|
-
let annotationsList;
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
drawChart();
|
|
31
|
-
}, [formatOptions]);
|
|
32
|
-
const drawChart = () => {
|
|
33
|
-
({ chartFormatOptions, svg, width, height } = firstFunctionBeforeRender(svgRef, formatOptions));
|
|
34
|
-
maxLegendDimensions = calculateLegendsMaxPossibleWidth(chartFormatOptions, seriesData);
|
|
35
|
-
({ margins, innerHeight, innerWidth, legendListWidth, chartTitleHeight } =
|
|
36
|
-
marginCalculationsForChartsWithoutAxis(chartFormatOptions, width, height, maxLegendDimensions, margins));
|
|
37
|
-
initPyramidSideCalculations();
|
|
38
|
-
initSvg(svgRef, width, height, chartFormatOptions);
|
|
39
|
-
chartAreaTagG = initChartArea();
|
|
40
|
-
drawChartTitle(svgRef, chartTitleHeight, width, chartFormatOptions);
|
|
41
|
-
initLegendListWithTotalValueAllowance(chartFormatOptions, svg, seriesData, width, height, legendListWidth, chartTitleHeight, chartId, margins, false);
|
|
42
|
-
initPyramidData();
|
|
43
|
-
drawPyramidChart();
|
|
44
|
-
prepareNewAnnotationsList();
|
|
45
|
-
pyramidAnnotations([]);
|
|
46
|
-
};
|
|
47
|
-
const initPyramidSideCalculations = () => {
|
|
48
|
-
try {
|
|
49
|
-
pyramidSide = Math.min(innerHeight, innerWidth);
|
|
50
|
-
pyramidHeight = 0.866 * pyramidSide;
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
logError(fileName, "initPyramidSideCalculations", error);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const initChartArea = () => {
|
|
57
|
-
try {
|
|
58
|
-
return svg
|
|
59
|
-
.append("g")
|
|
60
|
-
.attr("transform", `translate(${margins.left},${margins.top + (innerHeight - pyramidHeight) / 2})`);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
logError(fileName, "initChartArea", error);
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const initPyramidData = () => {
|
|
68
|
-
try {
|
|
69
|
-
seriesData = seriesData.sort((a, b) => {
|
|
70
|
-
const firstValue = a.data[0].value;
|
|
71
|
-
const secondValue = b.data[0].value;
|
|
72
|
-
return !chartFormatOptions.plotArea.flipPyramid
|
|
73
|
-
? firstValue - secondValue
|
|
74
|
-
: secondValue - firstValue;
|
|
75
|
-
});
|
|
76
|
-
pyramidTotalValue = d3.sum(seriesData, (d) => Math.abs(d.data[0].value));
|
|
77
|
-
stackHeightArray = [0];
|
|
78
|
-
seriesData.forEach((d, i) => {
|
|
79
|
-
const height = (Math.abs(d.data[0].value) / pyramidTotalValue) * pyramidHeight;
|
|
80
|
-
stackHeightArray.push(stackHeightArray[i] + height);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
logError(fileName, "initPyramidData", error);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const drawPyramidChart = () => {
|
|
88
|
-
try {
|
|
89
|
-
seriesData.forEach((d, i) => {
|
|
90
|
-
try {
|
|
91
|
-
const yTop = stackHeightArray[i];
|
|
92
|
-
const yBottom = stackHeightArray[i + 1];
|
|
93
|
-
let inversionConstant = chartFormatOptions.plotArea.flipPyramid
|
|
94
|
-
? 1
|
|
95
|
-
: 0;
|
|
96
|
-
const topWidth = pyramidSide *
|
|
97
|
-
(inversionConstant - stackHeightArray[i] / pyramidHeight);
|
|
98
|
-
const bottomWidth = pyramidSide *
|
|
99
|
-
(inversionConstant - stackHeightArray[i + 1] / pyramidHeight);
|
|
100
|
-
const centerX = innerWidth / 2;
|
|
101
|
-
const pyramidContainer = chartAreaTagG
|
|
102
|
-
.append("g")
|
|
103
|
-
.attr("id", "PyramidChart")
|
|
104
|
-
.attr("class", "parentGroup");
|
|
105
|
-
pyramidContainer
|
|
106
|
-
.append("polygon")
|
|
107
|
-
.attr("class", "segment")
|
|
108
|
-
.attr("hoverId", d.legend)
|
|
109
|
-
.attr("points", `
|
|
110
|
-
${centerX - topWidth / 2},${yTop}
|
|
111
|
-
${centerX + topWidth / 2},${yTop}
|
|
112
|
-
${centerX + bottomWidth / 2},${yBottom}
|
|
113
|
-
${centerX - bottomWidth / 2},${yBottom}
|
|
114
|
-
`)
|
|
115
|
-
.attr("fill", d.properties.color || "#4cb2ff")
|
|
116
|
-
.on("mousemove", function () {
|
|
117
|
-
try {
|
|
118
|
-
showTooltipOnMouseMove([
|
|
119
|
-
{
|
|
120
|
-
key: d.legend,
|
|
121
|
-
value: chartFormatOptions.toolTip.toolTipNumberFormat == ",.0%"
|
|
122
|
-
? d.data[0].value
|
|
123
|
-
? (Math.abs(d.data[0].value / pyramidTotalValue) *
|
|
124
|
-
100).toFixed(convertStringToNumber(chartFormatOptions.toolTip
|
|
125
|
-
.toolTipDecimalPrecision)) + "%"
|
|
126
|
-
: ""
|
|
127
|
-
: getNumberWithFormatFunction("None", chartFormatOptions.toolTip.toolTipNumberFormat, chartFormatOptions.toolTip.toolTipDecimalPrecision)(d.data[0].value),
|
|
128
|
-
},
|
|
129
|
-
], chartFormatOptions);
|
|
130
|
-
d3.select(this)
|
|
131
|
-
.style("opacity", 0.8)
|
|
132
|
-
.style("stroke", chartFormatOptions.chartArea.chartAreaColor)
|
|
133
|
-
.style("stroke-width", "3px");
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
logError(fileName, "drawPyramidChart.onMouseMove", error);
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
.on("mouseout", function () {
|
|
140
|
-
try {
|
|
141
|
-
hideTooltipOnMouseOut();
|
|
142
|
-
d3.select(this)
|
|
143
|
-
.style("opacity", 1)
|
|
144
|
-
.style("stroke", "unset")
|
|
145
|
-
.style("stroke-width", "unset");
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
logError(fileName, "drawPyramidChart.onMouseOut", error);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
logError(fileName, "drawPyramidChart.forEach", error);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
catch (error) {
|
|
158
|
-
logError(fileName, "drawPyramidChart", error);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
// Already has try/catch, just add logError in catch
|
|
162
|
-
const pyramidAnnotations = (oldAnnotationList) => {
|
|
163
|
-
try {
|
|
164
|
-
const self = this;
|
|
165
|
-
let AnnotationType = chartFormatOptions.annotation.annotationType ?? "1";
|
|
166
|
-
if (chartFormatOptions.annotation.annotationVisibility) {
|
|
167
|
-
let Disable = [AnnotationType == "1" ? "connector" : ""];
|
|
168
|
-
let makeAnnotations = d3Annotation.annotation();
|
|
169
|
-
let ConnectorType = chartFormatOptions.annotation.connectorType
|
|
170
|
-
? chartFormatOptions.annotation.connectorType.toLowerCase()
|
|
171
|
-
: "None";
|
|
172
|
-
let AnnotationsList = annotationsList;
|
|
173
|
-
let finalAnnotationList = annotationsList;
|
|
174
|
-
makeAnnotations
|
|
175
|
-
.editMode(chartFormatOptions.annotation.annotationDraggable)
|
|
176
|
-
.accessors({
|
|
177
|
-
x: function () {
|
|
178
|
-
return innerWidth * 0.5;
|
|
179
|
-
},
|
|
180
|
-
y: function (d, i) {
|
|
181
|
-
return d.y;
|
|
182
|
-
},
|
|
183
|
-
})
|
|
184
|
-
.on("dragend", function (annotation) {
|
|
185
|
-
try {
|
|
186
|
-
annotations
|
|
187
|
-
.selectAll(".connector")
|
|
188
|
-
.attr("hoverId", (d) => d.data.legend)
|
|
189
|
-
.style("stroke", chartFormatOptions.annotation.connectorColor || "#ccc")
|
|
190
|
-
.attr("stroke-dasharray", ConnectedStyle[chartFormatOptions.annotation.connectorStyle]);
|
|
191
|
-
annotations
|
|
192
|
-
.selectAll(`.connector-${ConnectorType}`)
|
|
193
|
-
.attr("fill", chartFormatOptions.annotation.connectorColor || "#ccc")
|
|
194
|
-
.style("stroke", chartFormatOptions.annotation.connectorColor || "#ccc");
|
|
195
|
-
annotations
|
|
196
|
-
.selectAll(".note-line")
|
|
197
|
-
.attr("hoverId", (d) => d.data.currentLegend)
|
|
198
|
-
.style("stroke", chartFormatOptions.annotation.connectorColor || "#ccc")
|
|
199
|
-
.attr("stroke-dasharray", ConnectedStyle[chartFormatOptions.annotation.connectorStyle])
|
|
200
|
-
.filter((d) => d._dx == 0 && d._dy == 0)
|
|
201
|
-
.remove();
|
|
202
|
-
annotations
|
|
203
|
-
.selectAll(".annotation-note-label")
|
|
204
|
-
.filter((d) => d.data && d.data.isVisible)
|
|
205
|
-
.style("display", "block");
|
|
206
|
-
annotations
|
|
207
|
-
.selectAll(".annotation-note-title")
|
|
208
|
-
.filter((d) => d.data && d.data.isVisible)
|
|
209
|
-
.style("display", "block");
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
logError(fileName, "pyramidAnnotations.onDragEnd", error);
|
|
213
|
-
}
|
|
214
|
-
})
|
|
215
|
-
.notePadding(0)
|
|
216
|
-
.annotations(finalAnnotationList);
|
|
217
|
-
let annotations = chartAreaTagG
|
|
218
|
-
.append("g")
|
|
219
|
-
.attr("class", "annotation-group parentGroup")
|
|
220
|
-
.call(makeAnnotations);
|
|
221
|
-
annotations.selectAll("rect").style("visibility", "hidden");
|
|
222
|
-
annotations.selectAll(".annotation-subject").remove();
|
|
223
|
-
annotations
|
|
224
|
-
.selectAll(".connector")
|
|
225
|
-
.style("stroke", chartFormatOptions.annotation.connectorColor || "#ccc")
|
|
226
|
-
.attr("stroke-dasharray", ConnectedStyle[chartFormatOptions.annotation.connectorStyle]);
|
|
227
|
-
annotations
|
|
228
|
-
.selectAll(`.connector-${ConnectorType}`)
|
|
229
|
-
.attr("fill", chartFormatOptions.annotation.connectorColor || "#ccc")
|
|
230
|
-
.style("stroke", chartFormatOptions.annotation.connectorColor || "#ccc");
|
|
231
|
-
annotations
|
|
232
|
-
.selectAll(".note-line")
|
|
233
|
-
.style("stroke", chartFormatOptions.annotation.connectorColor || "#ccc")
|
|
234
|
-
.attr("stroke-dasharray", ConnectedStyle[chartFormatOptions.annotation.connectorStyle])
|
|
235
|
-
.filter((d) => d._dx == 0 && d._dy == 0)
|
|
236
|
-
.remove();
|
|
237
|
-
annotations
|
|
238
|
-
.selectAll(".connector-end")
|
|
239
|
-
.filter((d) => d.connector.end == "dot" && d._dx == 0 && d._dy == 0)
|
|
240
|
-
.remove();
|
|
241
|
-
annotations
|
|
242
|
-
.selectAll(".annotation-note-label")
|
|
243
|
-
.filter((d) => d.data && !d.data.isVisible)
|
|
244
|
-
.style("display", "none");
|
|
245
|
-
annotations
|
|
246
|
-
.selectAll(".annotation-note-title")
|
|
247
|
-
.filter((d) => d.data && !d.data.isVisible)
|
|
248
|
-
.style("display", "none");
|
|
249
|
-
chartFormatOptions.annotation.annotationType ==
|
|
250
|
-
dataLabelPositionType.automatic &&
|
|
251
|
-
annotations
|
|
252
|
-
.selectAll(".annotation-note-content")
|
|
253
|
-
.attr("transform", function () {
|
|
254
|
-
const transform = d3.select(this).attr("transform");
|
|
255
|
-
const translateValues = transform.match(/translate\(([^,]+),([^,]+)\)/);
|
|
256
|
-
if (translateValues) {
|
|
257
|
-
const currentX = parseFloat(translateValues[1]);
|
|
258
|
-
return `translate(${currentX}, 0)`;
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
annotations
|
|
262
|
-
.selectAll(".annotation-note-label")
|
|
263
|
-
.attr("y", "15")
|
|
264
|
-
.attr("text-anchor", "middle");
|
|
265
|
-
annotations
|
|
266
|
-
.selectAll(".annotation-note-title")
|
|
267
|
-
.attr("text-anchor", "middle");
|
|
268
|
-
annotations
|
|
269
|
-
.selectAll(".annotation-note-content")
|
|
270
|
-
.attr("transform", `translate(0,-28)`);
|
|
271
|
-
!chartFormatOptions.plotArea.dataLabelName &&
|
|
272
|
-
annotations.selectAll("tspan").attr("dy", "0");
|
|
273
|
-
chartFormatOptions.plotArea.dataLabelName &&
|
|
274
|
-
annotations
|
|
275
|
-
.selectAll(".annotation-note-title")
|
|
276
|
-
.attr("hoverId", (d) => d.data.legend)
|
|
277
|
-
.style("font-size", (d) => d.data.labelFontSize)
|
|
278
|
-
.attr("font-family", (d) => d.data.labelFontFamily)
|
|
279
|
-
.style("font-style", (d) => d.data.labelFontStyle.includes(fontStyleOptions.italic)
|
|
280
|
-
? fontStyleOptions.italic
|
|
281
|
-
: "")
|
|
282
|
-
.style("text-decoration", (d) => d.data.labelFontStyle.includes(fontStyleOptions.underline)
|
|
283
|
-
? fontStyleOptions.underline
|
|
284
|
-
: "")
|
|
285
|
-
.style("font-weight", (d) => d.data.labelFontStyle.includes(fontStyleOptions.bold)
|
|
286
|
-
? fontStyleOptions.bold
|
|
287
|
-
: "300")
|
|
288
|
-
.style("fill", (d) => d.data.labelFontColor);
|
|
289
|
-
chartFormatOptions.plotArea.dataLabelValue &&
|
|
290
|
-
annotations
|
|
291
|
-
.selectAll(".annotation-note-label")
|
|
292
|
-
.attr("hoverId", (d) => d.data.legend)
|
|
293
|
-
.style("font-size", (d) => d.data.valueFontSize)
|
|
294
|
-
.attr("font-family", (d) => d.data.valueFontFamily)
|
|
295
|
-
.style("font-style", (d) => d.data.valueFontStyle.includes(fontStyleOptions.italic)
|
|
296
|
-
? fontStyleOptions.italic
|
|
297
|
-
: "")
|
|
298
|
-
.style("text-decoration", (d) => d.data.valueFontStyle.includes(fontStyleOptions.underline)
|
|
299
|
-
? fontStyleOptions.underline
|
|
300
|
-
: "")
|
|
301
|
-
.style("font-weight", (d) => d.data.valueFontStyle.includes(fontStyleOptions.bold)
|
|
302
|
-
? fontStyleOptions.bold
|
|
303
|
-
: "300")
|
|
304
|
-
.style("fill", (d) => d.data.valueFontColor);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
catch (e) {
|
|
308
|
-
logError(fileName, "pyramidAnnotations", e);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
const prepareNewAnnotationsList = () => {
|
|
312
|
-
try {
|
|
313
|
-
let annotationType = chartFormatOptions.annotation.annotationType ?? "1";
|
|
314
|
-
let connectorType = chartFormatOptions.annotation.connectorType
|
|
315
|
-
? chartFormatOptions.annotation.connectorType.toLowerCase()
|
|
316
|
-
: "none";
|
|
317
|
-
annotationsList = [];
|
|
318
|
-
seriesData.forEach((d, i) => {
|
|
319
|
-
try {
|
|
320
|
-
let singleAnnotation = {
|
|
321
|
-
note: {
|
|
322
|
-
title: chartFormatOptions.plotArea.dataLabelName
|
|
323
|
-
? d.properties.alias
|
|
324
|
-
: "",
|
|
325
|
-
label: chartFormatOptions.plotArea.dataLabelNumberFormat == ",.0%"
|
|
326
|
-
? (Math.abs(d.data[0].value / pyramidTotalValue) * 100).toFixed(convertStringToNumber(chartFormatOptions.plotArea.dataLabelDecimalPrecision)) + "%"
|
|
327
|
-
: chartFormatOptions.plotArea.dataLabelValue
|
|
328
|
-
? d.data[0].value >= 1000000000 &&
|
|
329
|
-
chartFormatOptions.annotation.annotationNumberFormat ===
|
|
330
|
-
".2s"
|
|
331
|
-
? Math.round(d.data[0].value / 1000000000) + "B"
|
|
332
|
-
: getNumberWithFormatFunction(chartFormatOptions.annotation.annotationDisplayUnits, chartFormatOptions.plotArea.dataLabelNumberFormat, chartFormatOptions.plotArea.dataLabelDecimalPrecision)(d.data[0].value)
|
|
333
|
-
: "",
|
|
334
|
-
align: "middle",
|
|
335
|
-
},
|
|
336
|
-
data: {
|
|
337
|
-
x: innerWidth / 2,
|
|
338
|
-
y: getYCordinate(d, i, d.properties.dataLabelPosition),
|
|
339
|
-
isVisible: true,
|
|
340
|
-
dimension: d.legend,
|
|
341
|
-
legend: d.legend,
|
|
342
|
-
measure: d.data[0].value,
|
|
343
|
-
labelFontFamily: d.properties.labelFont,
|
|
344
|
-
labelFontSize: d.properties.labelFontSize,
|
|
345
|
-
labelFontColor: d.properties.labelFontColor,
|
|
346
|
-
labelFontStyle: d.properties.labelFontStyle,
|
|
347
|
-
valueFontFamily: d.properties.valueFont,
|
|
348
|
-
valueFontSize: d.properties.valueFontSize,
|
|
349
|
-
valueFontColor: d.properties.valueFontColor,
|
|
350
|
-
valueFontStyle: d.properties.valueFontStyle,
|
|
351
|
-
},
|
|
352
|
-
dx: 0,
|
|
353
|
-
dy: 0,
|
|
354
|
-
connector: {
|
|
355
|
-
end: connectorType,
|
|
356
|
-
curve: ConnecterCurve[chartFormatOptions.annotation.connectorCurve],
|
|
357
|
-
},
|
|
358
|
-
subject: {
|
|
359
|
-
height: 15,
|
|
360
|
-
width: 15,
|
|
361
|
-
},
|
|
362
|
-
type: AnnotationTypeMap[annotationType],
|
|
363
|
-
color: chartFormatOptions.plotArea.dataLabelNameColor != "#000000"
|
|
364
|
-
? chartFormatOptions.plotArea.dataLabelNameColor
|
|
365
|
-
: "#000000",
|
|
366
|
-
height: width,
|
|
367
|
-
width: width,
|
|
368
|
-
index: i,
|
|
369
|
-
};
|
|
370
|
-
annotationsList.push(singleAnnotation);
|
|
371
|
-
}
|
|
372
|
-
catch (error) {
|
|
373
|
-
logError(fileName, "prepareNewAnnotationsList.forEach", error);
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
catch (error) {
|
|
378
|
-
logError(fileName, "prepareNewAnnotationsList", error);
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
const getYCordinate = (d, i, labelPosition) => {
|
|
382
|
-
try {
|
|
383
|
-
switch (labelPosition) {
|
|
384
|
-
case staticDataLabelPositions.top:
|
|
385
|
-
return stackHeightArray[i] + 30;
|
|
386
|
-
case staticDataLabelPositions.middle:
|
|
387
|
-
return (stackHeightArray[i] + stackHeightArray[i + 1]) / 2 + 15;
|
|
388
|
-
case staticDataLabelPositions.bottom:
|
|
389
|
-
return stackHeightArray[i + 1];
|
|
390
|
-
default:
|
|
391
|
-
return stackHeightArray[i] + 30;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
catch (error) {
|
|
395
|
-
logError(fileName, "getYCordinate", error);
|
|
396
|
-
return 0;
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
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%" } })] }));
|
|
400
|
-
};
|
|
401
|
-
export default PyramidChart;
|