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,807 +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 { fontStyleOptions, horizontalLegendAllignment, referenceLineTypes, staticLegendPosition, verticalLegendAllignment, } from "../../Core/Common.types";
|
|
6
|
-
import { calculateLegendsMaxPossibleWidth, convertStringToNumber, drawChartTitle, firstFunctionBeforeRender, getNumberWithFormatFunction, hideTooltipOnMouseOut, initChartArea, initSvg, showTooltipOnMouseMove, } from "../../Core/CommonFunctions";
|
|
7
|
-
import { chartMargins } from "../../Core/DefaultProperties.types";
|
|
8
|
-
import { customXscaleLabelFormatting, customYscaleLabelFormatting, initXaxis, initYaxis, marginCalculationForBubbleScatter, responsiveXaxisLabelForNumericValue, responsiveYaxisLabel, setnumberOfBubbles, setXaxistitle, yAxistitle, } from "../ChartsWithoutAxisFunctions";
|
|
9
|
-
import { logError } from "../../../../Services/ErrorLog";
|
|
10
|
-
//#endregion
|
|
11
|
-
const fileName = "ScatterChart.tsx";
|
|
12
|
-
const ScatterChart = ({ data, formatOptions, chartId, shapesList, colorsList, }) => {
|
|
13
|
-
//#region Variables
|
|
14
|
-
const svgRef = useRef(); // Reference to the SVG element
|
|
15
|
-
let chartFormatOptions; // Format options for the chart
|
|
16
|
-
let maxLegendDimensions = [0, 0]; // to calculate margins [width, height]
|
|
17
|
-
let width; // svg total width
|
|
18
|
-
let height; // svg total height
|
|
19
|
-
let chartTitleHeight = 40; // Height of the chart title
|
|
20
|
-
let margins = chartMargins; // Margins for the chart
|
|
21
|
-
let innerHeight; // Height of the chart excluding margins
|
|
22
|
-
let innerWidth; // Width of the chart excluding margins
|
|
23
|
-
let chartAreaTagG; // Group element for the chart area
|
|
24
|
-
let svg; // SVG element for the chart
|
|
25
|
-
let measuresList = []; // List of measures for the bubble chart
|
|
26
|
-
let dimensionsList = []; // List of dimensions for the bubble chart
|
|
27
|
-
let minDimension; // Longest dimension for the chart
|
|
28
|
-
let maxDimension; // Longest measure for the chart
|
|
29
|
-
let minMeasure; // Longest measure for the chart
|
|
30
|
-
let maxMeasure; // Longest measure for the chart
|
|
31
|
-
let yLabel; // Y-axis label
|
|
32
|
-
let xLabel; // X-axis label
|
|
33
|
-
let yTitle; // Y-axis title
|
|
34
|
-
let xTitle; // X-axis title
|
|
35
|
-
let legendMargin; // Margin for the legend
|
|
36
|
-
let longestDimension; // Longest dimension for the chart
|
|
37
|
-
let customXaxisIntervalValue; // Custom X-axis interval value
|
|
38
|
-
let customXaxisMaxValue; // Custom X-axis maximum value
|
|
39
|
-
let customXaxisMinValue; // Custom X-axis minimum value
|
|
40
|
-
let longestMeasure; // Longest measure for the chart
|
|
41
|
-
let customYaxisIntervalValue; // Custom Y-axis interval value
|
|
42
|
-
let customYaxisMaxValue; // Custom Y-axis maximum value
|
|
43
|
-
let customYaxisMinValue; // Custom Y-axis minimum value
|
|
44
|
-
let xScale; // X-axis scale
|
|
45
|
-
let yScale; // Y-axis scale
|
|
46
|
-
let colorsMap = new Map(); // Map to store colors for the chart
|
|
47
|
-
let shapesMap = new Map(); // Map to store shapes for the chartl
|
|
48
|
-
//#endregion
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
drawChart();
|
|
51
|
-
}, [formatOptions, data, chartId]);
|
|
52
|
-
const drawChart = () => {
|
|
53
|
-
({ chartFormatOptions, svg, width, height } = firstFunctionBeforeRender(svgRef, formatOptions));
|
|
54
|
-
let tempLegendEntries = [
|
|
55
|
-
...shapesList,
|
|
56
|
-
...colorsList,
|
|
57
|
-
];
|
|
58
|
-
maxLegendDimensions = calculateLegendsMaxPossibleWidth(chartFormatOptions, tempLegendEntries, "alias");
|
|
59
|
-
iterateOverChartData();
|
|
60
|
-
({
|
|
61
|
-
longestMeasure,
|
|
62
|
-
customYaxisIntervalValue,
|
|
63
|
-
customYaxisMaxValue,
|
|
64
|
-
customYaxisMinValue,
|
|
65
|
-
} = customYscaleLabelFormatting(chartFormatOptions, minMeasure, maxMeasure));
|
|
66
|
-
({
|
|
67
|
-
longestDimension,
|
|
68
|
-
customXaxisIntervalValue,
|
|
69
|
-
customXaxisMaxValue,
|
|
70
|
-
customXaxisMinValue,
|
|
71
|
-
} = customXscaleLabelFormatting(chartFormatOptions, minDimension, maxDimension));
|
|
72
|
-
({
|
|
73
|
-
margins,
|
|
74
|
-
yLabel,
|
|
75
|
-
xLabel,
|
|
76
|
-
yTitle,
|
|
77
|
-
xTitle,
|
|
78
|
-
chartTitleHeight,
|
|
79
|
-
legendMargin,
|
|
80
|
-
innerHeight,
|
|
81
|
-
innerWidth,
|
|
82
|
-
} = marginCalculationForBubbleScatter(width, height, longestMeasure, chartFormatOptions, longestDimension, maxLegendDimensions));
|
|
83
|
-
initSvg(svgRef, width, height, chartFormatOptions); // Initialize SVG with width, height and background color
|
|
84
|
-
chartAreaTagG = initChartArea(svg, margins);
|
|
85
|
-
drawChartTitle(svgRef, chartTitleHeight, width, chartFormatOptions);
|
|
86
|
-
initScale();
|
|
87
|
-
drawXAxis();
|
|
88
|
-
drawYAxis();
|
|
89
|
-
setXaxistitle(formatOptions, false, svg, margins, xLabel, height, xTitle, "Scatter", yLabel, innerWidth, innerHeight);
|
|
90
|
-
yAxistitle(innerHeight, formatOptions, 0, false, svg, margins, yTitle, yLabel);
|
|
91
|
-
drawReferenceLines();
|
|
92
|
-
// initLegendList();
|
|
93
|
-
initCircles();
|
|
94
|
-
drawColors();
|
|
95
|
-
drawShapes();
|
|
96
|
-
setnumberOfBubbles(svg, chartFormatOptions.legends.legendPosition, chartFormatOptions, height, width, margins, innerHeight, xTitle, xLabel, data.length);
|
|
97
|
-
};
|
|
98
|
-
const initCircles = () => {
|
|
99
|
-
try {
|
|
100
|
-
const circles = chartAreaTagG
|
|
101
|
-
.append("g")
|
|
102
|
-
.attr("class", "circles")
|
|
103
|
-
.attr("class", "parentGroup");
|
|
104
|
-
//Lines
|
|
105
|
-
circles
|
|
106
|
-
.append("g")
|
|
107
|
-
.selectAll(".bubbleScatter")
|
|
108
|
-
.data(data)
|
|
109
|
-
.enter()
|
|
110
|
-
.append("g")
|
|
111
|
-
.attr("fill", (d) => d.selectedColor)
|
|
112
|
-
.attr("colorId", (d) => d.legendName.includes("-")
|
|
113
|
-
? d.legendName.split("-")[0].replace(/ /g, "-")
|
|
114
|
-
: d.legendName.replace(/ /g, "-"))
|
|
115
|
-
.attr("shapeId", (d) => d.legendName.includes("-")
|
|
116
|
-
? d.legendName.split("-")[1].replace(/ /g, "-")
|
|
117
|
-
: d.legendName.replace(/ /g, "-"))
|
|
118
|
-
.append("path")
|
|
119
|
-
.attr("class", "path")
|
|
120
|
-
.attr("id", function (d, i) {
|
|
121
|
-
d3.select(this).attr("d", d3
|
|
122
|
-
.symbol()
|
|
123
|
-
.type(getMarkershapes(d.selectedShape))
|
|
124
|
-
.size((d.sizeValue ? d.sizeValue : 10) *
|
|
125
|
-
2 *
|
|
126
|
-
convertStringToNumber(chartFormatOptions.plotArea.scatterSizeIndex)));
|
|
127
|
-
})
|
|
128
|
-
.attr("transform", function (d) {
|
|
129
|
-
return `translate(${xScale(d.dimension)}, ${yScale(d.measure)})`;
|
|
130
|
-
})
|
|
131
|
-
.attr("opacity", chartFormatOptions.plotArea.fillOpacity)
|
|
132
|
-
.style("visibility", (d, i) => d.dimension[0] === 0 ||
|
|
133
|
-
(d.measure === 0 && chartFormatOptions.plotArea.hideZeroValues) ||
|
|
134
|
-
d.dimension < customXaxisMinValue ||
|
|
135
|
-
d.dimension > customXaxisMaxValue ||
|
|
136
|
-
d.measure < customYaxisMinValue ||
|
|
137
|
-
d.measure > customYaxisMaxValue
|
|
138
|
-
? "hidden"
|
|
139
|
-
: "visible")
|
|
140
|
-
.on("mousemove", (event, d) => {
|
|
141
|
-
showTooltipOnMouseMove([
|
|
142
|
-
{
|
|
143
|
-
key: chartFormatOptions.xAxisTitle.xAxisTitleText,
|
|
144
|
-
value: getNumberWithFormatFunction("None", chartFormatOptions.toolTip.toolTipNumberFormat, chartFormatOptions.toolTip.toolTipDecimalPrecision)(d.dimension),
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
key: chartFormatOptions.yAxisTitle.yAxisTitleText,
|
|
148
|
-
value: getNumberWithFormatFunction("None", chartFormatOptions.toolTip.toolTipNumberFormat, chartFormatOptions.toolTip.toolTipDecimalPrecision)(d.measure),
|
|
149
|
-
},
|
|
150
|
-
{ key: "Legend", value: d.legendName },
|
|
151
|
-
// { key: "Calculated Tooltip", value: d.tooltip },
|
|
152
|
-
], chartFormatOptions);
|
|
153
|
-
})
|
|
154
|
-
.on("mouseout", () => {
|
|
155
|
-
hideTooltipOnMouseOut();
|
|
156
|
-
});
|
|
157
|
-
function getMarkershapes(Shape) {
|
|
158
|
-
return Shape == "Square"
|
|
159
|
-
? d3.symbolSquare
|
|
160
|
-
: Shape == "Circle"
|
|
161
|
-
? d3.symbolCircle
|
|
162
|
-
: Shape == "Cross"
|
|
163
|
-
? d3.symbolCross
|
|
164
|
-
: Shape == "Triangle"
|
|
165
|
-
? d3.symbolTriangle
|
|
166
|
-
: Shape == "Star"
|
|
167
|
-
? d3.symbolStar
|
|
168
|
-
: Shape == "Diamond"
|
|
169
|
-
? d3.symbolDiamond
|
|
170
|
-
: Shape == "Wye"
|
|
171
|
-
? d3.symbolWye
|
|
172
|
-
: d3.symbolCircle;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
catch (e) {
|
|
176
|
-
logError(fileName, "initCircles", e);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
const iterateOverChartData = () => {
|
|
180
|
-
try {
|
|
181
|
-
colorsList.forEach((colorObject) => {
|
|
182
|
-
colorsMap.set(colorObject.name, colorObject.color);
|
|
183
|
-
});
|
|
184
|
-
shapesList.forEach((shapeObject) => {
|
|
185
|
-
shapesMap.set(shapeObject.name, shapeObject.markerShape);
|
|
186
|
-
});
|
|
187
|
-
data.forEach((d) => {
|
|
188
|
-
let legendNameArr = d.legendName.split("-");
|
|
189
|
-
d["selectedColor"] = colorsMap.get(legendNameArr[0]) || "#6ba2b8ff";
|
|
190
|
-
d["selectedShape"] = shapesMap.get(legendNameArr[1]) || "Circle";
|
|
191
|
-
if (d.measureName) {
|
|
192
|
-
measuresList.push(d.measure);
|
|
193
|
-
if (d.measure < minMeasure || minMeasure === undefined) {
|
|
194
|
-
minMeasure = d.measure;
|
|
195
|
-
}
|
|
196
|
-
if (d.measure > maxMeasure || maxMeasure === undefined) {
|
|
197
|
-
maxMeasure = d.measure;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (d.dimensionName) {
|
|
201
|
-
dimensionsList.push(d.dimension);
|
|
202
|
-
if (d.dimension < minDimension || minDimension === undefined) {
|
|
203
|
-
minDimension = d.dimension;
|
|
204
|
-
}
|
|
205
|
-
if (d.dimension > maxDimension || maxDimension === undefined) {
|
|
206
|
-
maxDimension = d.dimension;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
catch (e) {
|
|
212
|
-
logError(fileName, "iterateOverChartData", e);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const initScale = () => {
|
|
216
|
-
try {
|
|
217
|
-
let xStartValue = chartFormatOptions.xAxisLabel.xAxisIntervalsVisibility &&
|
|
218
|
-
chartFormatOptions.xAxisLabel.xAxisMinText !== ""
|
|
219
|
-
? parseFloat(chartFormatOptions.xAxisLabel.xAxisMinText)
|
|
220
|
-
: minDimension > 0
|
|
221
|
-
? 0
|
|
222
|
-
: minDimension * 1.1;
|
|
223
|
-
let xEndValue = chartFormatOptions.xAxisLabel.xAxisIntervalsVisibility &&
|
|
224
|
-
chartFormatOptions.xAxisLabel.xAxisMaxText !== ""
|
|
225
|
-
? parseFloat(chartFormatOptions.xAxisLabel.xAxisMaxText)
|
|
226
|
-
: maxDimension * 1.1;
|
|
227
|
-
let yStartValue = chartFormatOptions.yAxisLabel.yAxisIntervalsVisibility &&
|
|
228
|
-
chartFormatOptions.yAxisLabel.yAxisMinText !== ""
|
|
229
|
-
? parseFloat(chartFormatOptions.yAxisLabel.yAxisMinText)
|
|
230
|
-
: minMeasure > 0
|
|
231
|
-
? 0
|
|
232
|
-
: minMeasure * 1.1;
|
|
233
|
-
let yEndValue = chartFormatOptions.yAxisLabel.yAxisIntervalsVisibility &&
|
|
234
|
-
chartFormatOptions.yAxisLabel.yAxisMaxText !== ""
|
|
235
|
-
? parseFloat(chartFormatOptions.yAxisLabel.yAxisMaxText)
|
|
236
|
-
: maxMeasure * 1.1;
|
|
237
|
-
xScale = d3
|
|
238
|
-
.scaleLinear()
|
|
239
|
-
.domain([xStartValue, xEndValue])
|
|
240
|
-
.range([0, innerWidth]);
|
|
241
|
-
yScale = d3
|
|
242
|
-
.scaleLinear()
|
|
243
|
-
.domain([yStartValue, yEndValue])
|
|
244
|
-
.range([innerHeight, 0]);
|
|
245
|
-
}
|
|
246
|
-
catch (e) {
|
|
247
|
-
logError(fileName, "initScale", e);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
const drawXAxis = () => {
|
|
251
|
-
try {
|
|
252
|
-
let { xAxisLabelArray, customTickValue } = responsiveXaxisLabelForNumericValue(maxDimension, minDimension, innerWidth, formatOptions, customXaxisMinValue, customXaxisMaxValue, innerHeight, false);
|
|
253
|
-
const xAxis = d3
|
|
254
|
-
.axisBottom(xScale)
|
|
255
|
-
.tickFormat(getNumberWithFormatFunction(formatOptions.xAxisLabel.xAxisDisplayUnits, formatOptions.xAxisLabel.xAxisNumberFormat, formatOptions.xAxisLabel.xAxisLabelDecimalPrecision ?? "2"))
|
|
256
|
-
.tickSize(chartFormatOptions.plotArea.gridLinesVisibility
|
|
257
|
-
? chartFormatOptions.plotArea.gridLinesVertical
|
|
258
|
-
? chartFormatOptions.xAxisLabel.xAxisPosition === "0"
|
|
259
|
-
? -innerHeight
|
|
260
|
-
: chartFormatOptions.xAxisLabel.xAxisPosition === "1"
|
|
261
|
-
? innerHeight
|
|
262
|
-
: 0
|
|
263
|
-
: 0
|
|
264
|
-
: 0)
|
|
265
|
-
.tickValues(xAxisLabelArray.length > 0 ? xAxisLabelArray : null)
|
|
266
|
-
.ticks(customTickValue)
|
|
267
|
-
.tickSizeOuter(0);
|
|
268
|
-
initXaxis(chartAreaTagG, chartFormatOptions, 0, xLabel, xAxis, innerHeight, innerWidth, margins, yScale);
|
|
269
|
-
}
|
|
270
|
-
catch (e) {
|
|
271
|
-
logError(fileName, "drawXAxis", e);
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
const drawYAxis = () => {
|
|
275
|
-
try {
|
|
276
|
-
let { yAxisLabelArray, customTickValue } = responsiveYaxisLabel(maxMeasure, minMeasure, innerHeight, formatOptions, customYaxisMinValue, customYaxisMaxValue);
|
|
277
|
-
const yAxis = d3
|
|
278
|
-
.axisLeft(yScale)
|
|
279
|
-
.tickFormat(getNumberWithFormatFunction(formatOptions.yAxisLabel.yAxisDisplayUnits, formatOptions.yAxisLabel.yAxisNumberFormat, formatOptions.yAxisLabel.yAxisLabelDecimalPrecision ?? "2"))
|
|
280
|
-
.tickSize(chartFormatOptions.plotArea.gridLinesVisibility
|
|
281
|
-
? chartFormatOptions.plotArea.gridLinesHorizontal
|
|
282
|
-
? -innerWidth
|
|
283
|
-
: 0
|
|
284
|
-
: 0)
|
|
285
|
-
.tickValues(yAxisLabelArray.length > 0 ? yAxisLabelArray : null)
|
|
286
|
-
.ticks(customTickValue)
|
|
287
|
-
.tickSizeOuter(0);
|
|
288
|
-
initYaxis(chartAreaTagG, chartFormatOptions, 0, yLabel, yAxis, innerHeight);
|
|
289
|
-
}
|
|
290
|
-
catch (e) {
|
|
291
|
-
logError(fileName, "drawYAxis", e);
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
const drawReferenceLines = () => {
|
|
295
|
-
try {
|
|
296
|
-
if (chartFormatOptions.plotArea.xCoordinate != referenceLineTypes.None) {
|
|
297
|
-
let xCordinate;
|
|
298
|
-
switch (chartFormatOptions.plotArea.xCoordinate) {
|
|
299
|
-
case referenceLineTypes.Mean:
|
|
300
|
-
xCordinate = d3.mean(data, (d) => d.dimension);
|
|
301
|
-
break;
|
|
302
|
-
case referenceLineTypes.Median:
|
|
303
|
-
xCordinate = d3.median(data, (d) => d.dimension);
|
|
304
|
-
break;
|
|
305
|
-
case referenceLineTypes.Custom:
|
|
306
|
-
xCordinate = convertStringToNumber(chartFormatOptions.plotArea.xscaleposition);
|
|
307
|
-
break;
|
|
308
|
-
}
|
|
309
|
-
chartAreaTagG
|
|
310
|
-
.append("line")
|
|
311
|
-
.attr("x1", xScale(xCordinate))
|
|
312
|
-
.attr("y1", 0)
|
|
313
|
-
.attr("x2", xScale(xCordinate))
|
|
314
|
-
.attr("y2", innerHeight)
|
|
315
|
-
.attr("stroke", chartFormatOptions.plotArea.refLineBorderColor)
|
|
316
|
-
.attr("stroke-width", chartFormatOptions.plotArea.refLineBorderThickness);
|
|
317
|
-
// .attr("stroke-dasharray", chartFormatOptions.plotArea.refLineStyle);
|
|
318
|
-
}
|
|
319
|
-
if (chartFormatOptions.plotArea.yCoordinate != referenceLineTypes.None) {
|
|
320
|
-
let yCordinate;
|
|
321
|
-
switch (chartFormatOptions.plotArea.yCoordinate) {
|
|
322
|
-
case referenceLineTypes.Mean:
|
|
323
|
-
yCordinate = d3.mean(data, (d) => d.measure);
|
|
324
|
-
break;
|
|
325
|
-
case referenceLineTypes.Median:
|
|
326
|
-
yCordinate = d3.median(data, (d) => d.measure);
|
|
327
|
-
break;
|
|
328
|
-
case referenceLineTypes.Custom:
|
|
329
|
-
yCordinate = convertStringToNumber(chartFormatOptions.plotArea.yscaleposition);
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
chartAreaTagG
|
|
333
|
-
.append("line")
|
|
334
|
-
.attr("x1", 0)
|
|
335
|
-
.attr("y1", yScale(yCordinate))
|
|
336
|
-
.attr("x2", innerWidth)
|
|
337
|
-
.attr("y2", yScale(yCordinate))
|
|
338
|
-
.attr("stroke", chartFormatOptions.plotArea.refLineBorderColor)
|
|
339
|
-
.attr("stroke-width", chartFormatOptions.plotArea.refLineBorderThickness);
|
|
340
|
-
// .attr("stroke-dasharray", chartFormatOptions.plotArea.refLineStyle);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
catch (e) {
|
|
344
|
-
logError(fileName, "drawReferenceLines", e);
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
const drawColors = () => {
|
|
348
|
-
try {
|
|
349
|
-
// to set default values for newly added legend props for old saved reports.
|
|
350
|
-
chartFormatOptions.legends.legendAlignment === undefined
|
|
351
|
-
? (chartFormatOptions.legends.legendAlignment = "Top")
|
|
352
|
-
: null;
|
|
353
|
-
chartFormatOptions.legends.legendAlignmentTopBottom === undefined
|
|
354
|
-
? (chartFormatOptions.legends.legendAlignmentTopBottom = "Start")
|
|
355
|
-
: null;
|
|
356
|
-
let position = chartFormatOptions.legends.legendPosition;
|
|
357
|
-
let alignmentLeftRight = chartFormatOptions.legends.legendAlignment;
|
|
358
|
-
let alignmentTopBottom = chartFormatOptions.legends.legendAlignmentTopBottom;
|
|
359
|
-
switch (position) {
|
|
360
|
-
case staticLegendPosition.none:
|
|
361
|
-
break;
|
|
362
|
-
case staticLegendPosition.right:
|
|
363
|
-
colorListWithScroll(colorsList, width - legendMargin - 30, chartTitleHeight + 5, legendMargin + 25, height - chartTitleHeight - 10);
|
|
364
|
-
break;
|
|
365
|
-
case staticLegendPosition.top:
|
|
366
|
-
colorListWithScroll(colorsList, 5, chartTitleHeight + 5, width - 10, 30);
|
|
367
|
-
break;
|
|
368
|
-
case staticLegendPosition.left:
|
|
369
|
-
colorListWithScroll(colorsList, 5, chartTitleHeight + 5, legendMargin + 25, height - chartTitleHeight - 10);
|
|
370
|
-
break;
|
|
371
|
-
case staticLegendPosition.bottom:
|
|
372
|
-
colorListWithScroll(colorsList, 5, height - 35, width - 10, 30);
|
|
373
|
-
break;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
catch (error) {
|
|
377
|
-
logError(fileName, "drawColors", error);
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
const drawShapes = () => {
|
|
381
|
-
try {
|
|
382
|
-
// to set default values for newly added legend props for old saved reports.
|
|
383
|
-
chartFormatOptions.legends.legendAlignment === undefined
|
|
384
|
-
? (chartFormatOptions.legends.legendAlignment =
|
|
385
|
-
verticalLegendAllignment.top)
|
|
386
|
-
: null;
|
|
387
|
-
chartFormatOptions.legends.legendAlignmentTopBottom === undefined
|
|
388
|
-
? (chartFormatOptions.legends.legendAlignmentTopBottom =
|
|
389
|
-
horizontalLegendAllignment.start)
|
|
390
|
-
: null;
|
|
391
|
-
let position = chartFormatOptions.legends.legendPosition;
|
|
392
|
-
if (shapesList.length > 0) {
|
|
393
|
-
switch (position) {
|
|
394
|
-
case staticLegendPosition.none:
|
|
395
|
-
break;
|
|
396
|
-
case staticLegendPosition.right:
|
|
397
|
-
shapeListWithScroll(shapesList, width - legendMargin - 30, height / 2 + 10, legendMargin + 25, height - chartTitleHeight - 10);
|
|
398
|
-
break;
|
|
399
|
-
case staticLegendPosition.top:
|
|
400
|
-
shapeListWithScroll(shapesList, width / 2 + 5, chartTitleHeight + 5, width - 10, 30);
|
|
401
|
-
break;
|
|
402
|
-
case staticLegendPosition.left:
|
|
403
|
-
shapeListWithScroll(shapesList, 5, height / 2 + 10, legendMargin + 25, height - chartTitleHeight - 10);
|
|
404
|
-
break;
|
|
405
|
-
case staticLegendPosition.bottom:
|
|
406
|
-
shapeListWithScroll(shapesList, width / 2 + 5, height - 35, width - 10, 30);
|
|
407
|
-
break;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
catch (error) {
|
|
412
|
-
logError(fileName, "drawShapes", error);
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
const colorListWithScroll = (ColorList, x, y, width, height) => {
|
|
416
|
-
try {
|
|
417
|
-
let legendPosition = chartFormatOptions.legends.legendPosition;
|
|
418
|
-
let fontStyle = chartFormatOptions.legends.legendFontStyle;
|
|
419
|
-
let object = svg
|
|
420
|
-
.append("foreignObject")
|
|
421
|
-
.attr("visibility", chartFormatOptions.legends.legendVisibility ? "visible" : "hidden")
|
|
422
|
-
.attr("x", x)
|
|
423
|
-
.attr("y", y)
|
|
424
|
-
.attr("width", width)
|
|
425
|
-
.attr("height", height)
|
|
426
|
-
.style("user-select", "none");
|
|
427
|
-
let widthPercentage = (legendPosition == staticLegendPosition.top ||
|
|
428
|
-
legendPosition == staticLegendPosition.bottom) &&
|
|
429
|
-
shapesList.length > 0
|
|
430
|
-
? "50%"
|
|
431
|
-
: "100%";
|
|
432
|
-
var div = object
|
|
433
|
-
.append("xhtml:div")
|
|
434
|
-
.style("width", widthPercentage)
|
|
435
|
-
.style("display", "flex")
|
|
436
|
-
.style("height", legendPosition == staticLegendPosition.top ||
|
|
437
|
-
legendPosition == staticLegendPosition.bottom
|
|
438
|
-
? height - 1 + "px"
|
|
439
|
-
: "calc(50% - 5px)")
|
|
440
|
-
.style("border", chartFormatOptions.legends.legendBorder
|
|
441
|
-
? `${chartFormatOptions.legends.legendBorderThickness +
|
|
442
|
-
"px" +
|
|
443
|
-
" solid" +
|
|
444
|
-
chartFormatOptions.legends.legendBorderColor}`
|
|
445
|
-
: "none")
|
|
446
|
-
.append("div")
|
|
447
|
-
.attr("id", "colorsObject" + chartId)
|
|
448
|
-
.style("width", "100%")
|
|
449
|
-
.attr("class", "scrollbar")
|
|
450
|
-
.style("display", "flex")
|
|
451
|
-
.style("overflow", "auto")
|
|
452
|
-
.style("justify-content", legendPosition == staticLegendPosition.top ||
|
|
453
|
-
legendPosition == staticLegendPosition.bottom
|
|
454
|
-
? chartFormatOptions.legends.legendAlignmentTopBottom ==
|
|
455
|
-
horizontalLegendAllignment.start
|
|
456
|
-
? "flex-Start"
|
|
457
|
-
: chartFormatOptions.legends.legendAlignmentTopBottom ==
|
|
458
|
-
horizontalLegendAllignment.middle
|
|
459
|
-
? "center"
|
|
460
|
-
: "flex-end"
|
|
461
|
-
: chartFormatOptions.legends.legendAlignment ==
|
|
462
|
-
verticalLegendAllignment.top
|
|
463
|
-
? "flex-Start"
|
|
464
|
-
: chartFormatOptions.legends.legendAlignment ==
|
|
465
|
-
verticalLegendAllignment.middle
|
|
466
|
-
? "center"
|
|
467
|
-
: "flex-end")
|
|
468
|
-
.style("flex-direction", legendPosition == staticLegendPosition.top ||
|
|
469
|
-
legendPosition == staticLegendPosition.bottom
|
|
470
|
-
? "row"
|
|
471
|
-
: "column")
|
|
472
|
-
.style("flex-wrap", "nowrap")
|
|
473
|
-
.style("padding-left", "3px");
|
|
474
|
-
ColorList.forEach((d, i) => {
|
|
475
|
-
let innerdiv = div
|
|
476
|
-
.append("div")
|
|
477
|
-
.style("display", "inline-flex")
|
|
478
|
-
.style("justify-content", "flex-start")
|
|
479
|
-
.style("align-items", "center")
|
|
480
|
-
.style("margin", "3px 0px")
|
|
481
|
-
.style("width", "fit-content")
|
|
482
|
-
.style("flex-wrap", "nowrap")
|
|
483
|
-
.style("white-space", "nowrap")
|
|
484
|
-
.style("font-size", chartFormatOptions.legends.legendFontSize + "px")
|
|
485
|
-
.style("font-family", chartFormatOptions.legends.legendFontFamily)
|
|
486
|
-
//added below code to provide hover effect functionality
|
|
487
|
-
.on("mousemove", function (d) {
|
|
488
|
-
svg
|
|
489
|
-
.selectAll(".parentGroup")
|
|
490
|
-
.classed("highlight", false)
|
|
491
|
-
.classed("unhighlight", true);
|
|
492
|
-
svg
|
|
493
|
-
.selectAll('[colorId="' +
|
|
494
|
-
getJQuerySelector(this.textContent.replace(/ /g, "-")) +
|
|
495
|
-
'"]')
|
|
496
|
-
.classed("highlight", true)
|
|
497
|
-
.classed("unhighlight", false);
|
|
498
|
-
})
|
|
499
|
-
.on("mouseout", function (d) {
|
|
500
|
-
svg
|
|
501
|
-
.selectAll(".parentGroup")
|
|
502
|
-
.classed("highlight", false)
|
|
503
|
-
.classed("unhighlight", false);
|
|
504
|
-
svg
|
|
505
|
-
.selectAll('[colorId="' +
|
|
506
|
-
getJQuerySelector(this.textContent.replace(/ /g, "-")) +
|
|
507
|
-
'"]')
|
|
508
|
-
.classed("highlight", false)
|
|
509
|
-
.classed("unhighlight", false);
|
|
510
|
-
});
|
|
511
|
-
/* hover effect code end */
|
|
512
|
-
if (legendPosition == staticLegendPosition.bottom ||
|
|
513
|
-
legendPosition == staticLegendPosition.top)
|
|
514
|
-
innerdiv.style("margin-right", "16px").style("white-space", "nowrap");
|
|
515
|
-
innerdiv
|
|
516
|
-
.append("div")
|
|
517
|
-
.style("height", "10px")
|
|
518
|
-
.style("width", "10px")
|
|
519
|
-
.style("background", d.color)
|
|
520
|
-
.style("border-radius", "1px");
|
|
521
|
-
let legendColor = chartFormatOptions.legends.legendColorMode == "1"
|
|
522
|
-
? d.color
|
|
523
|
-
? d.color
|
|
524
|
-
: "#000000"
|
|
525
|
-
: chartFormatOptions.legends.legendSelectedUnicolor;
|
|
526
|
-
innerdiv
|
|
527
|
-
.append("div")
|
|
528
|
-
.style("margin-left", "5px")
|
|
529
|
-
.style("color", legendColor)
|
|
530
|
-
.attr("title", d.name)
|
|
531
|
-
.style("font-size", chartFormatOptions.legends.legendFontSize + "px")
|
|
532
|
-
.style("font-family", chartFormatOptions.legends.legendFontFamily)
|
|
533
|
-
.style("font-style", fontStyle.includes(fontStyleOptions.italic)
|
|
534
|
-
? fontStyleOptions.italic
|
|
535
|
-
: "")
|
|
536
|
-
.style("text-decoration", fontStyle.includes(fontStyleOptions.underline)
|
|
537
|
-
? fontStyleOptions.underline
|
|
538
|
-
: "")
|
|
539
|
-
.style("font-weight", fontStyle.includes(fontStyleOptions.bold)
|
|
540
|
-
? fontStyleOptions.bold
|
|
541
|
-
: "")
|
|
542
|
-
.style("white-space", "nowrap")
|
|
543
|
-
.html(d.name);
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
catch (e) {
|
|
547
|
-
logError(fileName, "colorListWithScroll", e);
|
|
548
|
-
}
|
|
549
|
-
};
|
|
550
|
-
const shapeListWithScroll = (ShapeList, x, y, width, height) => {
|
|
551
|
-
try {
|
|
552
|
-
let legendPosition = chartFormatOptions.legends.legendPosition;
|
|
553
|
-
let fontStyle = chartFormatOptions.legends.legendFontStyle;
|
|
554
|
-
let object = svg
|
|
555
|
-
.append("foreignObject")
|
|
556
|
-
.attr("visibility", chartFormatOptions.legends.legendVisibility ? "visible" : "hidden")
|
|
557
|
-
.attr("x", x)
|
|
558
|
-
.attr("y", y)
|
|
559
|
-
.attr("width", width)
|
|
560
|
-
.attr("height", height)
|
|
561
|
-
.style("user-select", "none");
|
|
562
|
-
let widthPercentage = chartFormatOptions.legends.legendPosition == staticLegendPosition.top ||
|
|
563
|
-
chartFormatOptions.legends.legendPosition == staticLegendPosition.bottom
|
|
564
|
-
? "calc(50% - 5px)"
|
|
565
|
-
: "calc(100%)";
|
|
566
|
-
var div = object
|
|
567
|
-
.append("xhtml:div")
|
|
568
|
-
.style("width", widthPercentage)
|
|
569
|
-
.style("display", "flex")
|
|
570
|
-
.style("height", legendPosition == staticLegendPosition.top ||
|
|
571
|
-
legendPosition == staticLegendPosition.bottom
|
|
572
|
-
? height - 1 + "px"
|
|
573
|
-
: "50%")
|
|
574
|
-
.style("padding", "2px")
|
|
575
|
-
.style("position", "absolute")
|
|
576
|
-
.style("border", chartFormatOptions.legends.legendBorder
|
|
577
|
-
? `${chartFormatOptions.legends.legendBorderThickness +
|
|
578
|
-
"px" +
|
|
579
|
-
" solid" +
|
|
580
|
-
chartFormatOptions.legends.legendBorderColor}`
|
|
581
|
-
: "none")
|
|
582
|
-
.append("div")
|
|
583
|
-
// .style("min-width", "150px")
|
|
584
|
-
.attr("id", "shapesObject" + chartId)
|
|
585
|
-
.style("width", "100%")
|
|
586
|
-
.attr("class", "scrollbar")
|
|
587
|
-
.style("overflow", "auto")
|
|
588
|
-
.style("display", "flex")
|
|
589
|
-
.style("justify-content", legendPosition == staticLegendPosition.top ||
|
|
590
|
-
legendPosition == staticLegendPosition.bottom
|
|
591
|
-
? chartFormatOptions.legends.legendAlignmentTopBottom ==
|
|
592
|
-
horizontalLegendAllignment.start
|
|
593
|
-
? "flex-Start"
|
|
594
|
-
: chartFormatOptions.legends.legendAlignmentTopBottom ==
|
|
595
|
-
horizontalLegendAllignment.middle
|
|
596
|
-
? "center"
|
|
597
|
-
: "flex-end"
|
|
598
|
-
: chartFormatOptions.legends.legendAlignment ==
|
|
599
|
-
verticalLegendAllignment.top
|
|
600
|
-
? "flex-Start"
|
|
601
|
-
: chartFormatOptions.legends.legendAlignment ==
|
|
602
|
-
verticalLegendAllignment.middle
|
|
603
|
-
? "center"
|
|
604
|
-
: "flex-end")
|
|
605
|
-
.style("flex-direction", legendPosition == staticLegendPosition.top ||
|
|
606
|
-
legendPosition == staticLegendPosition.bottom
|
|
607
|
-
? "row"
|
|
608
|
-
: "column")
|
|
609
|
-
.style("flex-wrap", "nowrap")
|
|
610
|
-
.style("padding-left", "3px");
|
|
611
|
-
ShapeList.forEach((d, i) => {
|
|
612
|
-
let innerdiv = div
|
|
613
|
-
.append("div")
|
|
614
|
-
.style("width", "fit-content")
|
|
615
|
-
.style("display", "inline-flex")
|
|
616
|
-
.style("justify-content", "flex-start")
|
|
617
|
-
.style("align-items", "center")
|
|
618
|
-
.style("margin", "3px 0px")
|
|
619
|
-
.style("flex-wrap", "nowrap")
|
|
620
|
-
.style("white-space", "nowrap")
|
|
621
|
-
//added below code to provide hover effect functionality
|
|
622
|
-
.on("mousemove", function (d) {
|
|
623
|
-
if (chartFormatOptions.legends.onHoverEffect) {
|
|
624
|
-
svg
|
|
625
|
-
.selectAll(".parentGroup")
|
|
626
|
-
.classed("highlight", false)
|
|
627
|
-
.classed("unhighlight", true);
|
|
628
|
-
svg
|
|
629
|
-
.selectAll('[shapeId="' +
|
|
630
|
-
getJQuerySelector(this.textContent.replace(/ /g, "-")) +
|
|
631
|
-
'"]')
|
|
632
|
-
.classed("highlight", true)
|
|
633
|
-
.classed("unhighlight", false);
|
|
634
|
-
}
|
|
635
|
-
})
|
|
636
|
-
.on("mouseout", function (d) {
|
|
637
|
-
if (chartFormatOptions.legends.onHoverEffect) {
|
|
638
|
-
svg
|
|
639
|
-
.selectAll(".parentGroup")
|
|
640
|
-
.classed("highlight", false)
|
|
641
|
-
.classed("unhighlight", false);
|
|
642
|
-
svg
|
|
643
|
-
.selectAll('[shapeId="' +
|
|
644
|
-
getJQuerySelector(this.textContent.replace(/ /g, "-")) +
|
|
645
|
-
'"]')
|
|
646
|
-
.classed("highlight", false)
|
|
647
|
-
.classed("unhighlight", false);
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
/* hover effect code end */
|
|
651
|
-
if (legendPosition == staticLegendPosition.top ||
|
|
652
|
-
legendPosition == staticLegendPosition.bottom)
|
|
653
|
-
innerdiv.style("margin-right", "16px").style("white-space", "nowrap");
|
|
654
|
-
// this function is used to give different shapes to different shapeList entries.
|
|
655
|
-
shapesForScatterPlot(innerdiv, d.markerShape);
|
|
656
|
-
let legendColor = chartFormatOptions.legends.legendColorMode == "1"
|
|
657
|
-
? "#000000"
|
|
658
|
-
: chartFormatOptions.legends.legendSelectedUnicolor;
|
|
659
|
-
innerdiv
|
|
660
|
-
.append("div")
|
|
661
|
-
.style("margin-left", "5px")
|
|
662
|
-
.style("color", legendColor)
|
|
663
|
-
.attr("title", d.name)
|
|
664
|
-
.style("font-size", chartFormatOptions.legends.legendFontSize + "px")
|
|
665
|
-
.style("font-family", chartFormatOptions.legends.legendFontFamily)
|
|
666
|
-
.style("font-style", fontStyle.includes(fontStyleOptions.italic)
|
|
667
|
-
? fontStyleOptions.italic
|
|
668
|
-
: "")
|
|
669
|
-
.style("text-decoration", fontStyle.includes(fontStyleOptions.underline)
|
|
670
|
-
? fontStyleOptions.underline
|
|
671
|
-
: "")
|
|
672
|
-
.style("font-weight", fontStyle.includes(fontStyleOptions.bold)
|
|
673
|
-
? fontStyleOptions.bold
|
|
674
|
-
: "")
|
|
675
|
-
.style("white-space", "nowrap")
|
|
676
|
-
.html(d.name);
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
catch (e) {
|
|
680
|
-
logError(fileName, "shapeListWithScroll", e);
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
const shapesForScatterPlot = (innerdiv, shapes) => {
|
|
684
|
-
try {
|
|
685
|
-
shapes = shapes.toLowerCase();
|
|
686
|
-
switch (shapes) {
|
|
687
|
-
case "circle":
|
|
688
|
-
case "none":
|
|
689
|
-
innerdiv
|
|
690
|
-
.append("svg")
|
|
691
|
-
.attr("height", "10px")
|
|
692
|
-
.attr("width", "10px")
|
|
693
|
-
.append("circle")
|
|
694
|
-
.attr("cx", "5px")
|
|
695
|
-
.attr("cy", "5px")
|
|
696
|
-
.attr("r", "5px")
|
|
697
|
-
.style("fill", "black");
|
|
698
|
-
break;
|
|
699
|
-
case "square":
|
|
700
|
-
innerdiv
|
|
701
|
-
.append("div")
|
|
702
|
-
.style("height", "10px")
|
|
703
|
-
.style("width", "10px")
|
|
704
|
-
.style("background", "black")
|
|
705
|
-
.style("border-radius", "1px");
|
|
706
|
-
break;
|
|
707
|
-
case "triangle":
|
|
708
|
-
innerdiv
|
|
709
|
-
.append("div")
|
|
710
|
-
.style("border-left", "6px solid transparent")
|
|
711
|
-
.style("border-right", "6px solid transparent")
|
|
712
|
-
.style("border-bottom", "10px solid black");
|
|
713
|
-
break;
|
|
714
|
-
case "cross":
|
|
715
|
-
innerdiv
|
|
716
|
-
.append("div")
|
|
717
|
-
.style("height", "4px")
|
|
718
|
-
.style("width", "10px")
|
|
719
|
-
.style("background", "black")
|
|
720
|
-
.style("border-radius", "1px")
|
|
721
|
-
.append("div")
|
|
722
|
-
.style("height", "10px")
|
|
723
|
-
.style("width", "4px")
|
|
724
|
-
.style("background", "black")
|
|
725
|
-
.style("border-radius", "1px")
|
|
726
|
-
.style("position", "relative")
|
|
727
|
-
.style("top", "-3px")
|
|
728
|
-
.style("left", "3px");
|
|
729
|
-
break;
|
|
730
|
-
case "diamond":
|
|
731
|
-
innerdiv
|
|
732
|
-
.append("div")
|
|
733
|
-
.style("height", "10px")
|
|
734
|
-
.style("width", "10px")
|
|
735
|
-
.style("background", "black")
|
|
736
|
-
.style("border-radius", "1px")
|
|
737
|
-
.style("transform", "rotate(45deg)");
|
|
738
|
-
break;
|
|
739
|
-
case "star":
|
|
740
|
-
innerdiv
|
|
741
|
-
.append("div")
|
|
742
|
-
.style("border-left", "6px solid transparent")
|
|
743
|
-
.style("border-right", "6px solid transparent")
|
|
744
|
-
.style("border-bottom", "10px solid black")
|
|
745
|
-
.style("position", "relative")
|
|
746
|
-
.style("top", "-2px")
|
|
747
|
-
.style("transform", "rotate(0deg)")
|
|
748
|
-
.append("div")
|
|
749
|
-
.style("border-left", "6px solid transparent")
|
|
750
|
-
.style("border-right", "6px solid transparent")
|
|
751
|
-
.style("border-top", "10px solid black")
|
|
752
|
-
.style("position", "absolute")
|
|
753
|
-
.style("top", "2px")
|
|
754
|
-
.style("left", "-5.5px")
|
|
755
|
-
.style("transform", "rotate(360deg)");
|
|
756
|
-
break;
|
|
757
|
-
case "wye":
|
|
758
|
-
innerdiv
|
|
759
|
-
.append("div")
|
|
760
|
-
.style("height", "6.5px")
|
|
761
|
-
.style("width", "3px")
|
|
762
|
-
.style("background", "black")
|
|
763
|
-
.append("div")
|
|
764
|
-
.style("height", "5px")
|
|
765
|
-
.style("width", "3px")
|
|
766
|
-
.style("background", "black")
|
|
767
|
-
.style("transform", "rotate(-55deg)")
|
|
768
|
-
.style("position", "relative")
|
|
769
|
-
.style("top", "-2px")
|
|
770
|
-
.style("left", "-2px")
|
|
771
|
-
.append("div")
|
|
772
|
-
.style("height", "5px")
|
|
773
|
-
.style("width", "3px")
|
|
774
|
-
.style("background", "black")
|
|
775
|
-
.style("transform", "rotate(108deg)")
|
|
776
|
-
.style("position", "relative")
|
|
777
|
-
.style("top", "3px")
|
|
778
|
-
.style("left", "2px");
|
|
779
|
-
break;
|
|
780
|
-
default:
|
|
781
|
-
break;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
catch (error) {
|
|
785
|
-
logError(fileName, "shapesForScatterPlot", error);
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
const getJQuerySelector = (strSeletor = "") => {
|
|
789
|
-
try {
|
|
790
|
-
return strSeletor.replace(/(#|;|&|,|\.|\+|\*|~|'|:|"|!|\^|\$|\[|\]|\(|\)|=|<|>|\||\/)/g, "\\$1");
|
|
791
|
-
}
|
|
792
|
-
catch (error) {
|
|
793
|
-
logError(fileName, "getJQuerySelector", error);
|
|
794
|
-
}
|
|
795
|
-
};
|
|
796
|
-
// return (
|
|
797
|
-
// <div style={{ width: "100%", height: "100%" }}>
|
|
798
|
-
// <svg
|
|
799
|
-
// className="chartSVG"
|
|
800
|
-
// style={{ width: "100%", height: "100%" }}
|
|
801
|
-
// ref={svgRef}
|
|
802
|
-
// ></svg>
|
|
803
|
-
// </div>
|
|
804
|
-
// );
|
|
805
|
-
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%" } })] }));
|
|
806
|
-
};
|
|
807
|
-
export default ScatterChart;
|