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
|
File without changes
|
|
File without changes
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export var actualChartTypes;
|
|
2
|
-
(function (actualChartTypes) {
|
|
3
|
-
actualChartTypes["waterfall"] = "Waterfall";
|
|
4
|
-
actualChartTypes["lineWithMarker"] = "LineWithMarker";
|
|
5
|
-
actualChartTypes["stackLine"] = "StackLine";
|
|
6
|
-
actualChartTypes["stackLine100"] = "100StackLine";
|
|
7
|
-
actualChartTypes["line"] = "Line";
|
|
8
|
-
actualChartTypes["bar"] = "Bar";
|
|
9
|
-
actualChartTypes["stackColumn"] = "StackColumn";
|
|
10
|
-
actualChartTypes["area"] = "Area";
|
|
11
|
-
actualChartTypes["pie"] = "Pie";
|
|
12
|
-
actualChartTypes["sankey"] = "Sankey";
|
|
13
|
-
actualChartTypes["sunburst"] = "Sunburst";
|
|
14
|
-
actualChartTypes["horizontalBar"] = "HorizontalBar";
|
|
15
|
-
actualChartTypes["stackArea"] = "StackArea";
|
|
16
|
-
actualChartTypes["stackArea100"] = "100StackArea";
|
|
17
|
-
actualChartTypes["treeMap"] = "TreeMap";
|
|
18
|
-
actualChartTypes["stackBar"] = "StackBar";
|
|
19
|
-
actualChartTypes["stackColumn100"] = "100StackColumn";
|
|
20
|
-
actualChartTypes["stackBar100"] = "100StackBar";
|
|
21
|
-
actualChartTypes["scatterPlot"] = "ScatterPlot";
|
|
22
|
-
actualChartTypes["customColumnChart"] = "CustomColumnChart";
|
|
23
|
-
actualChartTypes["customBarChart"] = "CustomBarChart";
|
|
24
|
-
actualChartTypes["histogram"] = "Histogram";
|
|
25
|
-
actualChartTypes["columnHistogram"] = "ColumnHistogram";
|
|
26
|
-
actualChartTypes["barHistogram"] = "BarHistogram";
|
|
27
|
-
actualChartTypes["column"] = "Column";
|
|
28
|
-
actualChartTypes["miscellaneous"] = "Miscellaneous";
|
|
29
|
-
actualChartTypes["custom"] = "Custom";
|
|
30
|
-
actualChartTypes["collapsableTree"] = "CollapsableTree";
|
|
31
|
-
actualChartTypes["maps"] = "Maps";
|
|
32
|
-
actualChartTypes["tornadoChart"] = "Tornado";
|
|
33
|
-
actualChartTypes["pieOfPie"] = "PieOfPie";
|
|
34
|
-
actualChartTypes["wordCloud"] = "WordCloud";
|
|
35
|
-
actualChartTypes["boxPlot"] = "BoxPlot";
|
|
36
|
-
actualChartTypes["bubblePlot"] = "BubblePlot";
|
|
37
|
-
actualChartTypes["vennDiagramChart"] = "VennDiagramChart";
|
|
38
|
-
actualChartTypes["speedometerChart"] = "SpeedometerChart";
|
|
39
|
-
actualChartTypes["layeredColumnChart"] = "LayeredColumnChart";
|
|
40
|
-
actualChartTypes["layeredBarChart"] = "LayeredBarChart";
|
|
41
|
-
actualChartTypes["organizationalChart"] = "OrganizationalChart";
|
|
42
|
-
actualChartTypes["pyramidChart"] = "PyramidChart";
|
|
43
|
-
actualChartTypes["scaleBreakStackedColumnChart"] = "ScaleBreakStackedColumnChart";
|
|
44
|
-
actualChartTypes["progressChart"] = "ProgressChart";
|
|
45
|
-
actualChartTypes["radialBarChart"] = "RadialBarChart";
|
|
46
|
-
})(actualChartTypes || (actualChartTypes = {}));
|
|
47
|
-
;
|
|
48
|
-
;
|
|
49
|
-
;
|
|
@@ -1,486 +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 * as d3Annotation from "d3-svg-annotation";
|
|
5
|
-
import { useEffect, useRef } from "react";
|
|
6
|
-
import { logError } from "../../../../Services/ErrorLog";
|
|
7
|
-
import { drawLegends, hideTooltipOnMouseOut, showTooltipOnMouseMove } from "../../Core/CommonFunctions";
|
|
8
|
-
import { addDataTable, customYscaleLabelFormatting, dataTablePreCalculation, drawSeriesLabels, firstFunctionBeforeRender, getNumberWithFormat, initChartArea, initPlotArea, initSvg, initXaxis, initYaxis, initYaxisRight, commonAnnotations, marginCalculation, prepareDataForSeriesLabel, responsiveSecondaryYaxisLabel, responsiveXaxisLabel, responsiveYaxisLabel, setChartTitle, setDateFormats, setXaxistitle, yAxistitle, yAxistitleRight } from "../ChartsWithAxisFunctions";
|
|
9
|
-
import { actualChartTypes, } from "../ChartsWithAxisTypes.types";
|
|
10
|
-
import { legendShape } from "../../Core/Common.types";
|
|
11
|
-
const ColumnChart = ({ title, width, height, data, yAxisObj, xAxisObj, chartId, formatOptions, }) => {
|
|
12
|
-
// adding variables as per requirement
|
|
13
|
-
let columnWidth = 0; // coz line chartO
|
|
14
|
-
const chartType = actualChartTypes.column;
|
|
15
|
-
const svgRef = useRef();
|
|
16
|
-
const seriesData = data;
|
|
17
|
-
const barChart = false;
|
|
18
|
-
let isSecondaryAxisDrawn = false;
|
|
19
|
-
const isNormalizedChart = false;
|
|
20
|
-
let isPrimaryAxisDrawn = true;
|
|
21
|
-
let customYaxisMinValue = parseFloat(formatOptions.yAxisLabel.yAxisMinText);
|
|
22
|
-
let customYaxisMaxValue = parseFloat(formatOptions.yAxisLabel.yAxisMaxText);
|
|
23
|
-
let secondaryCustomYaxisMinValue = parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisMinText);
|
|
24
|
-
let secondaryCustomYaxisMaxValue = parseFloat(formatOptions.secondaryYAxisLabel.secondaryYAxisMaxText);
|
|
25
|
-
let margin;
|
|
26
|
-
let yLabel;
|
|
27
|
-
let xLabel;
|
|
28
|
-
let yTitle;
|
|
29
|
-
let xTitle;
|
|
30
|
-
let dimensionHeightWidthArray;
|
|
31
|
-
let chartTitleHeight;
|
|
32
|
-
let secondaryAxisTitleWidth;
|
|
33
|
-
let legendMargin;
|
|
34
|
-
let secondaryYLabel;
|
|
35
|
-
let maxNumberForPrimaryAxis;
|
|
36
|
-
let maxNumberForSecondaryAxis;
|
|
37
|
-
let innerWidth;
|
|
38
|
-
let innerHeight;
|
|
39
|
-
let dataTable;
|
|
40
|
-
let dataTableHeight;
|
|
41
|
-
let svg;
|
|
42
|
-
let gTag;
|
|
43
|
-
let yScaleLeft;
|
|
44
|
-
let yScaleRight;
|
|
45
|
-
let xScale;
|
|
46
|
-
let xScaleForLegends;
|
|
47
|
-
let seriesLabels;
|
|
48
|
-
let calculatedRange;
|
|
49
|
-
let seriesLabelWidth;
|
|
50
|
-
let yAxisLeft;
|
|
51
|
-
let xAxis;
|
|
52
|
-
let yAxisRight;
|
|
53
|
-
let filteredDimension;
|
|
54
|
-
let filteredData;
|
|
55
|
-
let scrollPosition = 0;
|
|
56
|
-
const visibleBars = 2;
|
|
57
|
-
let chartJSON = {
|
|
58
|
-
dimensionList: [],
|
|
59
|
-
chartType: chartType,
|
|
60
|
-
chartData: [],
|
|
61
|
-
formatOptions: formatOptions,
|
|
62
|
-
legendList: [],
|
|
63
|
-
secondaryAxisDrawn: false,
|
|
64
|
-
yMaxLeft: 0,
|
|
65
|
-
yMaxRight: 0,
|
|
66
|
-
yMinLeft: 0,
|
|
67
|
-
yMinRight: 0,
|
|
68
|
-
hideZeroValues: false,
|
|
69
|
-
formattedDimensionListMap: new Map(),
|
|
70
|
-
};
|
|
71
|
-
//#region UseEffect
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
try {
|
|
74
|
-
createColumnChart();
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
logError("Columnchart", "createColumnChart", error);
|
|
78
|
-
}
|
|
79
|
-
}, [formatOptions]);
|
|
80
|
-
//#endregion
|
|
81
|
-
const createColumnChart = () => {
|
|
82
|
-
({ formatOptions, svg, width, height } = firstFunctionBeforeRender(svgRef, formatOptions));
|
|
83
|
-
preProcessChartData(); // preaparing data related to chart creation
|
|
84
|
-
// Applies custom Y-axis label formatting and calculates the necessary margin based on axis extremes.
|
|
85
|
-
({ maxNumberForPrimaryAxis, maxNumberForSecondaryAxis } = customYscaleLabelFormatting(
|
|
86
|
-
// for calculating primary/secondary axis max number so that we can calculate margin accordinglt
|
|
87
|
-
formatOptions, chartJSON.yMinLeft, chartJSON.yMaxLeft, chartJSON.yMinRight, chartJSON.yMaxRight));
|
|
88
|
-
({
|
|
89
|
-
margin,
|
|
90
|
-
yLabel,
|
|
91
|
-
xLabel,
|
|
92
|
-
yTitle,
|
|
93
|
-
xTitle,
|
|
94
|
-
dimensionHeightWidthArray,
|
|
95
|
-
chartTitleHeight,
|
|
96
|
-
secondaryAxisTitleWidth,
|
|
97
|
-
legendMargin,
|
|
98
|
-
secondaryYLabel,
|
|
99
|
-
} = marginCalculation(
|
|
100
|
-
// for all margin related calculations
|
|
101
|
-
width, height, maxNumberForPrimaryAxis, maxNumberForSecondaryAxis, chartJSON.yMaxLeft, formatOptions, chartJSON.legendList, chartJSON.dimensionList, chartJSON.yMaxRight, isSecondaryAxisDrawn, isNormalizedChart));
|
|
102
|
-
setSVGContainer(margin); // for innerWidth/height static width/height
|
|
103
|
-
({ dataTable, dataTableHeight } = dataTablePreCalculation(
|
|
104
|
-
// calculations for data tables
|
|
105
|
-
formatOptions, yLabel, yTitle, seriesData, chartJSON.dimensionList));
|
|
106
|
-
initSvg(
|
|
107
|
-
// for svg creation
|
|
108
|
-
svg, width, height, formatOptions);
|
|
109
|
-
gTag = initChartArea(svg, margin); // creating chart area
|
|
110
|
-
initPlotArea(gTag, formatOptions, dataTableHeight, innerWidth, innerHeight, chartType);
|
|
111
|
-
initScale();
|
|
112
|
-
initAxis();
|
|
113
|
-
initYaxis(gTag, formatOptions, dataTableHeight, yLabel, yAxisLeft, innerHeight);
|
|
114
|
-
initYaxisRight(gTag, formatOptions, dataTableHeight, secondaryYLabel, yAxisRight, innerHeight, innerWidth);
|
|
115
|
-
horizontalScrollBar(seriesData, height, svg, margin, innerWidth);
|
|
116
|
-
if (formatOptions.dataTableProperties &&
|
|
117
|
-
formatOptions.dataTableProperties.dataTable) {
|
|
118
|
-
if (formatOptions.xAxisLabel.xAxisPosition != "1")
|
|
119
|
-
formatOptions.xAxisLabel.xAxisLabelVisibility = false;
|
|
120
|
-
addDataTable(formatOptions.plotArea.fitChart, svg, gTag, dataTable, columnWidth, yScaleLeft, xScale, xScaleForLegends, undefined, undefined, dataTableHeight, chartType, formatOptions, yLabel, yTitle, chartJSON.dimensionList, innerWidth, calculatedRange, chartJSON.formattedDimensionListMap, chartId, margin, innerHeight);
|
|
121
|
-
}
|
|
122
|
-
setXaxistitle(formatOptions, barChart, svg, margin, xLabel, height, xTitle, chartJSON.chartType, yLabel, innerWidth, innerHeight);
|
|
123
|
-
yAxistitle(innerHeight, formatOptions, dataTableHeight, barChart, svg, margin, yTitle, yLabel);
|
|
124
|
-
yAxistitleRight(svg, isSecondaryAxisDrawn, margin, formatOptions, dataTableHeight, innerHeight, innerWidth, secondaryYLabel, secondaryAxisTitleWidth); // to be added later
|
|
125
|
-
setChartTitle(svg, formatOptions, width, chartTitleHeight);
|
|
126
|
-
drawLegends(height, svg, dimensionHeightWidthArray, chartTitleHeight, width, legendMargin, formatOptions, seriesData, chartId, legendShape.rectangle);
|
|
127
|
-
};
|
|
128
|
-
const preProcessChartData = () => {
|
|
129
|
-
const allChartData = [];
|
|
130
|
-
const legendList = [];
|
|
131
|
-
const dimensionSet = new Set();
|
|
132
|
-
let formatedDimesionList = [];
|
|
133
|
-
let yMaxLeft = -Infinity;
|
|
134
|
-
let yMinLeft = Infinity;
|
|
135
|
-
let yMaxRight = -Infinity;
|
|
136
|
-
let yMinRight = Infinity;
|
|
137
|
-
seriesData.forEach((series) => {
|
|
138
|
-
legendList.push(series.legend);
|
|
139
|
-
series.data.forEach((point) => {
|
|
140
|
-
allChartData.push(point);
|
|
141
|
-
dimensionSet.add(point.dimension);
|
|
142
|
-
if (series.properties.axis === "Secondary") {
|
|
143
|
-
isSecondaryAxisDrawn = true;
|
|
144
|
-
yMaxRight = Math.max(yMaxRight, point.value);
|
|
145
|
-
yMinRight = Math.min(yMinRight, point.value);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
yMaxLeft = Math.max(yMaxLeft, point.value);
|
|
149
|
-
yMinLeft = Math.min(yMinLeft, point.value);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
chartJSON.chartData = allChartData;
|
|
154
|
-
chartJSON.legendList = legendList;
|
|
155
|
-
chartJSON.dimensionList = Array.from(dimensionSet);
|
|
156
|
-
chartJSON.yMaxLeft = yMaxLeft;
|
|
157
|
-
chartJSON.yMinLeft = yMinLeft;
|
|
158
|
-
chartJSON.yMaxRight = yMaxRight;
|
|
159
|
-
chartJSON.yMinRight = yMinRight;
|
|
160
|
-
// Apply formatted dimensions
|
|
161
|
-
let xAxisObject = xAxisObj[0];
|
|
162
|
-
formatedDimesionList =
|
|
163
|
-
(xAxisObject.groupBy == "NA" || xAxisObject.groupBy == undefined) &&
|
|
164
|
-
xAxisObject.dataType === "DATE"
|
|
165
|
-
? setDateFormats(formatOptions.xAxisLabel.xAxisNumberFormat, chartJSON.dimensionList).map((d) => d[0])
|
|
166
|
-
: chartJSON.dimensionList;
|
|
167
|
-
chartJSON.dimensionList.forEach((dim, i) => {
|
|
168
|
-
chartJSON.formattedDimensionListMap.set(dim, formatedDimesionList[i]);
|
|
169
|
-
});
|
|
170
|
-
filteredData = JSON.parse(JSON.stringify(seriesData));
|
|
171
|
-
if (!formatOptions.plotArea.fitChart) {
|
|
172
|
-
filteredDimension = chartJSON.dimensionList.slice(scrollPosition, scrollPosition + visibleBars);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
filteredDimension = chartJSON.dimensionList;
|
|
176
|
-
}
|
|
177
|
-
if (formatOptions.plotArea.hideZeroValues) {
|
|
178
|
-
chartJSON.hideZeroValues = true;
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
const initScale = () => {
|
|
182
|
-
// rounding the ymin & ymax
|
|
183
|
-
let yAxisLabelArray = responsiveYaxisLabel(customYaxisMaxValue ? customYaxisMaxValue : chartJSON.yMaxLeft, chartJSON.yMinLeft, innerHeight, formatOptions, chartJSON, customYaxisMinValue, customYaxisMaxValue).yAxisLabelArray;
|
|
184
|
-
chartJSON.yMaxLeft = yAxisLabelArray[yAxisLabelArray.length - 1];
|
|
185
|
-
chartJSON.yMinLeft = yAxisLabelArray[0];
|
|
186
|
-
if (isPrimaryAxisDrawn) {
|
|
187
|
-
yScaleLeft = d3
|
|
188
|
-
.scaleLinear()
|
|
189
|
-
.domain([
|
|
190
|
-
customYaxisMinValue !== undefined &&
|
|
191
|
-
!Number.isNaN(customYaxisMinValue)
|
|
192
|
-
? customYaxisMinValue
|
|
193
|
-
: chartJSON.yMinLeft < 0
|
|
194
|
-
? chartJSON.yMinLeft * 1.1
|
|
195
|
-
: chartJSON.yMinLeft * 0.9,
|
|
196
|
-
chartJSON.yMaxLeft <= 0
|
|
197
|
-
? 0
|
|
198
|
-
: customYaxisMaxValue !== undefined &&
|
|
199
|
-
!Number.isNaN(customYaxisMaxValue)
|
|
200
|
-
? customYaxisMaxValue
|
|
201
|
-
: chartJSON.yMaxLeft * 1.1,
|
|
202
|
-
])
|
|
203
|
-
.range([
|
|
204
|
-
dataTableHeight > 0 ? innerHeight - dataTableHeight : innerHeight,
|
|
205
|
-
0,
|
|
206
|
-
]);
|
|
207
|
-
}
|
|
208
|
-
if (isSecondaryAxisDrawn) {
|
|
209
|
-
yScaleRight = d3
|
|
210
|
-
.scaleLinear()
|
|
211
|
-
.domain([
|
|
212
|
-
chartJSON.yMinRight >= 0
|
|
213
|
-
? (secondaryCustomYaxisMinValue ||
|
|
214
|
-
secondaryCustomYaxisMinValue == 0) &&
|
|
215
|
-
!Number.isNaN(secondaryCustomYaxisMinValue)
|
|
216
|
-
? secondaryCustomYaxisMinValue
|
|
217
|
-
: 0
|
|
218
|
-
: (secondaryCustomYaxisMinValue ||
|
|
219
|
-
secondaryCustomYaxisMinValue == 0) &&
|
|
220
|
-
!Number.isNaN(secondaryCustomYaxisMinValue)
|
|
221
|
-
? secondaryCustomYaxisMinValue
|
|
222
|
-
: chartJSON.yMinRight * 1.1,
|
|
223
|
-
chartJSON.yMaxRight <= 0
|
|
224
|
-
? secondaryCustomYaxisMaxValue
|
|
225
|
-
? secondaryCustomYaxisMaxValue
|
|
226
|
-
: 0
|
|
227
|
-
: secondaryCustomYaxisMaxValue
|
|
228
|
-
? secondaryCustomYaxisMaxValue
|
|
229
|
-
: chartJSON.yMaxRight * 1.1,
|
|
230
|
-
])
|
|
231
|
-
.range([
|
|
232
|
-
dataTableHeight > 0 ? innerHeight - dataTableHeight : innerHeight,
|
|
233
|
-
0,
|
|
234
|
-
]);
|
|
235
|
-
}
|
|
236
|
-
calculatedRange = [0, innerWidth];
|
|
237
|
-
if (formatOptions.seriesLabel.seriesLabelVisibility) {
|
|
238
|
-
let labelObj = prepareDataForSeriesLabel(innerWidth, yScaleLeft, formatOptions, filteredData, yScaleRight, isSecondaryAxisDrawn);
|
|
239
|
-
seriesLabels = labelObj.labelArray;
|
|
240
|
-
formatOptions.seriesLabel.seriesLabelPosition == "Right" &&
|
|
241
|
-
(seriesLabelWidth = labelObj.heightWidth[0]);
|
|
242
|
-
formatOptions.seriesLabel.seriesLabelPosition == "Right"
|
|
243
|
-
? (calculatedRange = [0, innerWidth - labelObj.heightWidth[0]])
|
|
244
|
-
: (calculatedRange = [labelObj.heightWidth[0], innerWidth]);
|
|
245
|
-
}
|
|
246
|
-
getXScale();
|
|
247
|
-
};
|
|
248
|
-
const getXScale = () => {
|
|
249
|
-
columnWidth =
|
|
250
|
-
(0.51 + (0.61 * (100 - parseFloat(formatOptions.plotArea.plotAreaGapWidth))) / 100) *
|
|
251
|
-
(innerWidth / filteredDimension.length);
|
|
252
|
-
xScaleForLegends = d3.scaleBand()
|
|
253
|
-
// .domain(barLegendList.map((d) => d.legend))
|
|
254
|
-
.domain(chartJSON.legendList)
|
|
255
|
-
.range([0, columnWidth])
|
|
256
|
-
.paddingInner(chartJSON.legendList.length > 1
|
|
257
|
-
? (0.3 * parseFloat(formatOptions.plotArea.plotAreaSeriesWidth)) / 100
|
|
258
|
-
: 0);
|
|
259
|
-
xScale = d3
|
|
260
|
-
.scalePoint()
|
|
261
|
-
.domain(filteredDimension)
|
|
262
|
-
.range(calculatedRange)
|
|
263
|
-
.padding(0.5);
|
|
264
|
-
};
|
|
265
|
-
const initAxis = () => {
|
|
266
|
-
getXAxis();
|
|
267
|
-
if (isPrimaryAxisDrawn) {
|
|
268
|
-
yAxisLeft = d3
|
|
269
|
-
.axisLeft(yScaleLeft)
|
|
270
|
-
.tickFormat((d) => getNumberWithFormat(d, formatOptions.yAxisLabel.yAxisDisplayUnits, formatOptions.yAxisLabel.yAxisNumberFormat, formatOptions.yAxisLabel.yAxisLabelDecimalPrecision))
|
|
271
|
-
.tickSize(formatOptions.plotArea.gridLinesVisibility
|
|
272
|
-
? formatOptions.plotArea.gridLinesHorizontal
|
|
273
|
-
? -innerWidth + (seriesLabelWidth ? seriesLabelWidth : 0)
|
|
274
|
-
: 0
|
|
275
|
-
: 0)
|
|
276
|
-
.tickValues(responsiveYaxisLabel(customYaxisMaxValue ? customYaxisMaxValue : chartJSON.yMaxLeft, chartJSON.yMinLeft, innerHeight, formatOptions, chartJSON, customYaxisMinValue, customYaxisMaxValue).yAxisLabelArray)
|
|
277
|
-
.ticks(responsiveYaxisLabel(customYaxisMaxValue ? customYaxisMaxValue : chartJSON.yMaxLeft, chartJSON.yMinLeft, innerHeight, formatOptions, chartJSON, customYaxisMinValue, customYaxisMaxValue).customTickValue ??
|
|
278
|
-
(dataTableHeight > 0
|
|
279
|
-
? (innerHeight - dataTableHeight) / 30
|
|
280
|
-
: innerHeight / 30))
|
|
281
|
-
.tickSizeOuter(0);
|
|
282
|
-
}
|
|
283
|
-
if (isSecondaryAxisDrawn) {
|
|
284
|
-
yAxisRight = d3
|
|
285
|
-
.axisRight(yScaleRight)
|
|
286
|
-
.tickFormat((d) => getNumberWithFormat(d, formatOptions.secondaryYAxisLabel.secondaryYAxisDisplayUnits, formatOptions.secondaryYAxisLabel.secondaryYAxisNumberFormat, formatOptions.secondaryYAxisLabel
|
|
287
|
-
.secondaryYAxisLabelDecimalPrecision))
|
|
288
|
-
.tickValues(responsiveSecondaryYaxisLabel(secondaryCustomYaxisMaxValue
|
|
289
|
-
? secondaryCustomYaxisMaxValue
|
|
290
|
-
: chartJSON.yMaxRight, chartJSON.yMinRight, formatOptions, chartJSON).secondaryYAxisLabelArray)
|
|
291
|
-
.ticks(responsiveSecondaryYaxisLabel(secondaryCustomYaxisMaxValue
|
|
292
|
-
? secondaryCustomYaxisMaxValue
|
|
293
|
-
: chartJSON.yMaxRight, chartJSON.yMinRight, formatOptions, chartJSON).secondaryCustomTickValue ?? innerHeight / 30)
|
|
294
|
-
.tickSize(formatOptions.plotArea.gridLinesVisibility
|
|
295
|
-
? formatOptions.plotArea.gridLinesHorizontal
|
|
296
|
-
? -innerWidth
|
|
297
|
-
: 0
|
|
298
|
-
: 0)
|
|
299
|
-
.tickSizeOuter(0);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
const getXAxis = () => {
|
|
303
|
-
xAxis = d3
|
|
304
|
-
.axisBottom(xScale)
|
|
305
|
-
.tickSize(formatOptions.plotArea.gridLinesVisibility
|
|
306
|
-
? formatOptions.plotArea.gridLinesVeritcal
|
|
307
|
-
? formatOptions.plotArea.gridLinesVeritcal
|
|
308
|
-
? -(dataTableHeight > 0
|
|
309
|
-
? innerHeight - dataTableHeight
|
|
310
|
-
: innerHeight)
|
|
311
|
-
: parseFloat(formatOptions.plotArea.ticksHeight) *
|
|
312
|
-
((dataTableHeight > 0
|
|
313
|
-
? innerHeight - dataTableHeight
|
|
314
|
-
: innerHeight) /
|
|
315
|
-
100) *
|
|
316
|
-
(formatOptions.xAxisLabel.xAxisPosition == "1" ? 1 : -1)
|
|
317
|
-
: 0
|
|
318
|
-
: 0)
|
|
319
|
-
.tickSizeOuter(0)
|
|
320
|
-
.tickValues(responsiveXaxisLabel(filteredDimension, innerWidth));
|
|
321
|
-
};
|
|
322
|
-
const getChartType = (lineData) => {
|
|
323
|
-
lineData.forEach((lData) => {
|
|
324
|
-
lData.data.forEach((cData) => {
|
|
325
|
-
cData.hideZero = lData.properties.hideZeroValues;
|
|
326
|
-
cData.axis = lData.properties.axis;
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
// Bind dummy data to ensure a single group is created
|
|
330
|
-
lineData.forEach((data) => {
|
|
331
|
-
// Step 1: Outer group for the whole chart
|
|
332
|
-
let column = gTag.selectAll(".parentGroup")
|
|
333
|
-
.data([data], d => d.legend); // use key so exit works
|
|
334
|
-
column = column
|
|
335
|
-
.enter()
|
|
336
|
-
.append("g")
|
|
337
|
-
.attr("class", `column parentGroup`)
|
|
338
|
-
.merge(column);
|
|
339
|
-
// Step 2: JOIN each data point inside the series
|
|
340
|
-
let columnGroups = column
|
|
341
|
-
.selectAll(".column-group")
|
|
342
|
-
.data(data.data, d => d.legend + d.dimension); // key on dimension + legend
|
|
343
|
-
// Step 3: ENTER - one group per bar (optional if you need transform)
|
|
344
|
-
let columnGroupsEnter = columnGroups
|
|
345
|
-
.enter()
|
|
346
|
-
.append("g")
|
|
347
|
-
.attr("class", "column-group")
|
|
348
|
-
.attr("hoverId", (d) => (d.legend.includes("-") ? d.legend.replace("-", "`").split("`")[1].replace(/ /g, "-") : d.legend.replace(/ /g, "-")))
|
|
349
|
-
.attr("transform", d => `translate(${xScale(d.dimension) - columnWidth / 2}, 0)`);
|
|
350
|
-
// ✨ Add this to handle UPDATE:
|
|
351
|
-
columnGroups
|
|
352
|
-
.attr("transform", d => `translate(${xScale(d.dimension) - columnWidth / 2}, 0)`);
|
|
353
|
-
// Merge ENTER + UPDATE
|
|
354
|
-
columnGroupsEnter.merge(columnGroups)
|
|
355
|
-
.attr("transform", d => `translate(${xScale(d.dimension) - columnWidth / 2}, 0)`);
|
|
356
|
-
// Step 4: Draw the rects
|
|
357
|
-
columnGroupsEnter
|
|
358
|
-
.append("rect")
|
|
359
|
-
.attr("x", (d) => xScaleForLegends(d.legend))
|
|
360
|
-
.attr("width", xScaleForLegends.bandwidth())
|
|
361
|
-
.attr("y", (d) => {
|
|
362
|
-
const yScale = data.properties.axis === "Primary" ? yScaleLeft : yScaleRight;
|
|
363
|
-
return d.value > 0 ? yScale(d.value) : yScale(0);
|
|
364
|
-
})
|
|
365
|
-
.attr("height", (d) => {
|
|
366
|
-
const yScale = data.properties.axis === "Primary" ? yScaleLeft : yScaleRight;
|
|
367
|
-
return Math.abs(yScale(d.value) - yScale(0));
|
|
368
|
-
})
|
|
369
|
-
.attr("fill", data.properties.color)
|
|
370
|
-
.attr("stroke-dasharray", (d) => d.stackBorderStyle === 2 ? "5,3" : "0")
|
|
371
|
-
.attr("stroke-width", (d) => `${d.stackBorderWidth}px`)
|
|
372
|
-
.attr("stroke", (d) => data.properties.stackBorderStyle === 0
|
|
373
|
-
? "none"
|
|
374
|
-
: formatOptions.column.stackBorderVisibility
|
|
375
|
-
? data.properties.stackBorderStyle
|
|
376
|
-
: "none")
|
|
377
|
-
.style("clip-path", "inset(0px) fill-box")
|
|
378
|
-
.style("shape-rendering", "crispEdges")
|
|
379
|
-
.attr("visibility", (d) => d.value === 0 && formatOptions.xAxisLabel.hideZeroValues
|
|
380
|
-
? "hidden"
|
|
381
|
-
: "visible")
|
|
382
|
-
.on("mousemove", (event, d) => {
|
|
383
|
-
showTooltipOnMouseMove([
|
|
384
|
-
{
|
|
385
|
-
key: formatOptions.xAxisTitle.xAxisTitleText.includes("~$~")
|
|
386
|
-
? formatOptions.xAxisTitle.xAxisTitleText.split("~$~")[1]
|
|
387
|
-
: formatOptions.xAxisTitle.xAxisTitleText,
|
|
388
|
-
value: chartJSON.formattedDimensionListMap.get(Array.isArray(d.dimension) ? d.dimension[0] : d.dimension),
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
key: formatOptions.yAxisTitle.yAxisTitleText || d.value,
|
|
392
|
-
value: getNumberWithFormat([actualChartTypes.stackLine100, actualChartTypes.stackArea100, ""].includes(chartType)
|
|
393
|
-
? d[1] - d[0]
|
|
394
|
-
: d.value, formatOptions.toolTip.toolTipDisplayUnits, formatOptions.toolTip.toolTipNumberFormat, formatOptions.toolTip.toolTipDecimalPrecision),
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
key: "Legend",
|
|
398
|
-
value: d.legend.includes("~$~") ? d.legend.split("~$~")[1] : d.legend,
|
|
399
|
-
},
|
|
400
|
-
], formatOptions, event);
|
|
401
|
-
})
|
|
402
|
-
.on("mouseout", hideTooltipOnMouseOut);
|
|
403
|
-
// Step 5: EXIT - remove old bars
|
|
404
|
-
columnGroups.exit().remove().each(function (d) {
|
|
405
|
-
console.log("Exiting:", d.dimension, d.legend);
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
};
|
|
409
|
-
const setSVGContainer = (margin) => {
|
|
410
|
-
innerWidth = width - margin.left - margin.right;
|
|
411
|
-
innerHeight = height - margin.bottom - margin.top;
|
|
412
|
-
};
|
|
413
|
-
const horizontalScrollBar = (seriesData, height, svg, margin, innerWidth) => {
|
|
414
|
-
if (!formatOptions.plotArea.fitChart) {
|
|
415
|
-
// Scrollbar parameters
|
|
416
|
-
const scrollMax = seriesData[0].data.length - visibleBars;
|
|
417
|
-
// Scrollbar track & handle
|
|
418
|
-
const scrollbarY = height - 20;
|
|
419
|
-
filteredDimension = chartJSON.dimensionList.slice(scrollPosition, scrollPosition + visibleBars);
|
|
420
|
-
getXScale();
|
|
421
|
-
filteredData = JSON.parse(JSON.stringify(seriesData));
|
|
422
|
-
filteredData.forEach((data, i) => (filteredData[i].data = data.data.filter((d) => filteredDimension.includes(d.dimension))));
|
|
423
|
-
getXAxis();
|
|
424
|
-
svg
|
|
425
|
-
.append("rect")
|
|
426
|
-
.attr("x", margin.left)
|
|
427
|
-
.attr("y", scrollbarY)
|
|
428
|
-
.attr("width", innerWidth)
|
|
429
|
-
.attr("height", 8)
|
|
430
|
-
.attr("fill", "#ddd")
|
|
431
|
-
.attr("rx", 4);
|
|
432
|
-
const handleWidth = (innerWidth * visibleBars) / seriesData.length;
|
|
433
|
-
const handle = svg
|
|
434
|
-
.append("rect")
|
|
435
|
-
.attr("x", margin.left)
|
|
436
|
-
.attr("y", scrollbarY)
|
|
437
|
-
.attr("width", handleWidth)
|
|
438
|
-
.attr("height", 8)
|
|
439
|
-
.attr("fill", "#999")
|
|
440
|
-
.attr("rx", 4)
|
|
441
|
-
.style("cursor", "ew-resize")
|
|
442
|
-
.call(d3.drag().on("drag", (event) => {
|
|
443
|
-
let x = Math.min(Math.max(event.x, margin.left), margin.left + innerWidth - handleWidth);
|
|
444
|
-
handle.attr("x", x);
|
|
445
|
-
scrollPosition = Math.round(((x - margin.left) / (innerWidth - handleWidth)) * scrollMax);
|
|
446
|
-
filteredDimension = chartJSON.dimensionList.slice(scrollPosition, scrollPosition + visibleBars);
|
|
447
|
-
getXScale();
|
|
448
|
-
filteredData = JSON.parse(JSON.stringify(seriesData));
|
|
449
|
-
filteredData.forEach((data, i) => (filteredData[i].data = data.data.filter((d) => filteredDimension.includes(d.dimension))));
|
|
450
|
-
getXAxis();
|
|
451
|
-
drawColumnChart();
|
|
452
|
-
}));
|
|
453
|
-
svg.on("wheel", (event) => {
|
|
454
|
-
event.preventDefault();
|
|
455
|
-
const scrollDelta = Math.abs(event.deltaX) > Math.abs(event.deltaY)
|
|
456
|
-
? event.deltaX
|
|
457
|
-
: event.deltaY;
|
|
458
|
-
scrollPosition += scrollDelta > 0 ? 1 : -1;
|
|
459
|
-
scrollPosition = Math.max(0, Math.min(scrollPosition, scrollMax));
|
|
460
|
-
const x = margin.left +
|
|
461
|
-
((innerWidth - handleWidth) * scrollPosition) / scrollMax;
|
|
462
|
-
handle.attr("x", x);
|
|
463
|
-
getXScale();
|
|
464
|
-
filteredData = JSON.parse(JSON.stringify(seriesData));
|
|
465
|
-
filteredData.forEach((data, i) => (filteredData[i].data = data.data.filter((d) => filteredDimension.includes(d.dimension))));
|
|
466
|
-
getXAxis();
|
|
467
|
-
drawColumnChart();
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
drawColumnChart();
|
|
471
|
-
};
|
|
472
|
-
const drawColumnChart = () => {
|
|
473
|
-
getChartType(filteredData);
|
|
474
|
-
initXaxis(gTag, chartJSON, xLabel, formatOptions, xAxisObj[0], dataTableHeight, yScaleLeft, xAxis, dimensionHeightWidthArray, height, columnWidth, xAxisObj[0].dataType, innerWidth, innerHeight, filteredDimension);
|
|
475
|
-
commonAnnotations(seriesData, xScale, yScaleLeft, yScaleRight, // need to pass secondary axis scale if secondary axis is drawn
|
|
476
|
-
margin, d3Annotation, [], //this.labelExcludeList,
|
|
477
|
-
[], //this.individualLabelColor,
|
|
478
|
-
[], //this.attributes.Id ? formatOptions.plotArea.dataLabelsCoordinates : this.parentReference.objService.tempAnnotationArray
|
|
479
|
-
formatOptions, chartType, height, width, innerWidth, filteredDimension, innerHeight, chartId, svg, xScaleForLegends, columnWidth);
|
|
480
|
-
let newSeriesLabelArray = prepareDataForSeriesLabel(innerWidth, yScaleLeft, formatOptions, filteredData, yScaleRight, isSecondaryAxisDrawn).labelArray;
|
|
481
|
-
// adding series labels ( appending legends at the end of line : by default) in plot area
|
|
482
|
-
drawSeriesLabels(formatOptions, gTag, newSeriesLabelArray);
|
|
483
|
-
};
|
|
484
|
-
return (_jsxs("div", { children: [_jsx("div", { id: "chartTooltipDiv" }), _jsx("svg", { className: "chartSVG", ref: svgRef, id: chartId, width: width, height: height })] }));
|
|
485
|
-
};
|
|
486
|
-
export default ColumnChart;
|