pace-chart-lib 1.0.15 → 1.0.18
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/Charts/ChartsWithAxis/AreaFamily/AreaChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +667 -0
- package/dist/Components/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.d.ts +171 -0
- package/dist/Components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/LineFamily/LineChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/LineFamily/StackLineChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.d.ts +92 -0
- package/dist/Components/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.types.d.ts +111 -0
- package/dist/Components/Charts/ChartsWithoutAxis/Maps/Cordinates.d.ts +26 -0
- package/dist/Components/Charts/ChartsWithoutAxis/Maps/Maps.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/BubbleChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/ProgressChart.d.ts +3 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/PyramidChart.d.ts +3 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/RadialBarChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/SankeyChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/ScatterChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/Speedometer.d.ts +3 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/VennChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/OtherCharts/WordCloud.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/PieFamily/DonutChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/PieFamily/PieChart.d.ts +4 -0
- package/dist/Components/Charts/ChartsWithoutAxis/PieFamily/PieFamilyCommonFunctions.d.ts +10 -0
- package/dist/Components/Charts/ChartsWithoutAxis/PieFamily/PieofPieChart.d.ts +3 -0
- package/dist/Components/Charts/ChartsWithoutAxis/PieFamily/TreemapChart.d.ts +3 -0
- package/dist/Components/Charts/Core/Common.types.d.ts +370 -0
- package/dist/Components/Charts/Core/CommonFunctions.d.ts +240 -0
- package/dist/Components/Charts/Core/DefaultChartDataProperties.d.ts +65 -0
- package/dist/Components/Charts/Core/DefaultProperties.types.d.ts +595 -0
- package/dist/Services/ErrorLog.d.ts +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/pace-chart-lib.es.js +109 -141
- package/dist/pace-chart-lib.umd.js +109 -141
- package/package.json +3 -3
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
import * as d3 from "d3";
|
|
2
|
+
import { TSeries } from "../Core/Common.types";
|
|
3
|
+
import { TDefaultChartFormatOptionsType } from "../Core/DefaultProperties.types";
|
|
4
|
+
import { TChartJSON, TMargin } from "./ChartsWithAxisTypes.types";
|
|
5
|
+
/**
|
|
6
|
+
* Dynamically calculates the width and height of a text element rendered with given styles.
|
|
7
|
+
* Optionally supports text rotation and fixed width wrapping.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} content - The text content to measure.
|
|
10
|
+
* @param {number} fontSize - The font size in pixels.
|
|
11
|
+
* @param {string} fontFamily - The font family to apply.
|
|
12
|
+
* @param {number} [rotationDegree] - Optional. Degrees to rotate the text (e.g., 45, 90).
|
|
13
|
+
* @param {number} [fixedWidth] - Optional. Fixed width in pixels to constrain the text and allow wrapping.
|
|
14
|
+
* @returns {[number, number] | [number, number, number, number]}
|
|
15
|
+
* - If no rotation: [width, height].
|
|
16
|
+
* - If rotation is applied: [originalWidth, originalHeight, rotatedWidth, rotatedHeight].
|
|
17
|
+
*/
|
|
18
|
+
export declare function calculateWidthHeightDynamically(content: string, fontSize: string, fontFamily: string, rotationDegree?: number, fixedWidth?: number): number[];
|
|
19
|
+
/**
|
|
20
|
+
* Calculates the Y-axis label width based on the maximum legend length
|
|
21
|
+
* and chart formatting options (specifically for data tables).
|
|
22
|
+
*
|
|
23
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart format options including data table settings.
|
|
24
|
+
* @param {number} maxLegendLength - The maximum length of legend labels.
|
|
25
|
+
* @returns {number} - The computed Y-axis label width in pixels.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getYAxisLabel(formatOptions: TDefaultChartFormatOptionsType, maxLegendLength: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Calculates horizontal margins (left and right) and returns other layout values needed by the caller.
|
|
30
|
+
*
|
|
31
|
+
* Accepts an optional precomputed metrics object to avoid re-computation.
|
|
32
|
+
*
|
|
33
|
+
* @returns {Object} { left: number, right: number, yLabel, yTitle, xLabel, xTitle, dimensionHeightWidthArray, chartTitleHeight, legendMargin, secondaryYLabel, secondaryAxisTitleWidth }
|
|
34
|
+
*/
|
|
35
|
+
export declare function calculateHorizontalMargins(windowWidth: number, windowHeight: number, maxNumberForPrimaryAxis: number, maxNumberForSecondaryAxis: number, yMaxLeft: number, formatOptions: TDefaultChartFormatOptionsType, legendList: string[], dimensionList: string[], yMaxRight: number, isSecondaryAxisDrawn: boolean, isNormalizedChart: boolean, xAxisObject: any, isBarChart?: boolean, precomputedMetrics?: any): {
|
|
36
|
+
left: number;
|
|
37
|
+
right: number;
|
|
38
|
+
yLabel: any;
|
|
39
|
+
yTitle: any;
|
|
40
|
+
xLabel: any;
|
|
41
|
+
xTitle: any;
|
|
42
|
+
dimensionHeightWidthArray: any;
|
|
43
|
+
chartTitleHeight: any;
|
|
44
|
+
legendMargin: any;
|
|
45
|
+
secondaryYLabel: any;
|
|
46
|
+
secondaryAxisTitleWidth: any;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Calculates vertical margins (top and bottom) and returns other layout values needed by the caller.
|
|
50
|
+
*
|
|
51
|
+
* Accepts an optional precomputed metrics object to avoid re-computation.
|
|
52
|
+
*
|
|
53
|
+
* @returns {Object} { top: number, bottom: number, chartTitleHeight, xAxisRelatedMargin, ... }
|
|
54
|
+
*/
|
|
55
|
+
export declare function calculateVerticalMargins(windowWidth: number, windowHeight: number, maxNumberForPrimaryAxis: number, maxNumberForSecondaryAxis: number, yMaxLeft: number, formatOptions: TDefaultChartFormatOptionsType, legendList: string[], dimensionList: string[], yMaxRight: number, isSecondaryAxisDrawn: boolean, isNormalizedChart: boolean, xAxisObject: any, isBarChart?: boolean, precomputedMetrics?: any, isScrollbarVisible?: boolean): {
|
|
56
|
+
top: number;
|
|
57
|
+
bottom: number;
|
|
58
|
+
chartTitleHeight: any;
|
|
59
|
+
xAxisRelatedMargin: any;
|
|
60
|
+
xLabel: any;
|
|
61
|
+
xTitle: any;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Backwards-compatible wrapper that returns the same shape as the original marginCalculation
|
|
65
|
+
* by delegating work to the split horizontal/vertical calculators.
|
|
66
|
+
*
|
|
67
|
+
* Now computes metrics once and passes the precomputed result to both calculators.
|
|
68
|
+
*/
|
|
69
|
+
export declare function marginCalculation(windowWidth: number, windowHeight: number, maxNumberForPrimaryAxis: number, maxNumberForSecondaryAxis: number, yMaxLeft: number, formatOptions: TDefaultChartFormatOptionsType, legendList: string[], dimensionList: string[], yMaxRight: number, isSecondaryAxisDrawn: boolean, isNormalizedChart: boolean, xAxisObject: any, isBarChart?: boolean, chartJSON?: TChartJSON): {
|
|
70
|
+
margin: TMargin;
|
|
71
|
+
yLabel: any;
|
|
72
|
+
xLabel: any;
|
|
73
|
+
yTitle: any;
|
|
74
|
+
xTitle: any;
|
|
75
|
+
dimensionHeightWidthArray: any;
|
|
76
|
+
chartTitleHeight: any;
|
|
77
|
+
legendMargin: any;
|
|
78
|
+
secondaryYLabel: any;
|
|
79
|
+
secondaryAxisTitleWidth: any;
|
|
80
|
+
visibleBars: any;
|
|
81
|
+
columnWidth: any;
|
|
82
|
+
scrollbarVisible: boolean;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Initializes the base SVG and optionally adds a scrollable floating SVG layer
|
|
86
|
+
* depending on the chart's scroll configuration. This setup enables flexible
|
|
87
|
+
* chart rendering for both static and scrollable layouts.
|
|
88
|
+
* @param {any} svg - reference svg
|
|
89
|
+
* @param {any} svgRef - Reference to the base SVG element (e.g., via React ref or DOM ID).
|
|
90
|
+
* @param {number} width - The internal viewBox width of the SVG.
|
|
91
|
+
* @param {number} height - The internal viewBox height of the SVG.
|
|
92
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart configuration options, including layout and colors.
|
|
93
|
+
* @param {boolean} chartsWithXScrollFlag - Flag to indicate if horizontal scrolling is required.
|
|
94
|
+
* @param {boolean} chartsWithYScrollFlag - Flag to indicate if vertical scrolling is required.
|
|
95
|
+
* @param {string} chartId - Unique ID for the chart, used for DOM element targeting.
|
|
96
|
+
* @param {number} totalWidth - Total width of the scrollable area (for floating SVG).
|
|
97
|
+
* @param {number} totalHeight - Total height of the scrollable area (for floating SVG).
|
|
98
|
+
*
|
|
99
|
+
* @returns {void}
|
|
100
|
+
* An object containing references to:
|
|
101
|
+
* - `svg`: the base SVG element.
|
|
102
|
+
*/
|
|
103
|
+
export declare function initSvg(svg: any, width: number, height: number, formatOptions: TDefaultChartFormatOptionsType): void;
|
|
104
|
+
/**
|
|
105
|
+
* all common functions to do before draw chart .
|
|
106
|
+
* @param svgRef - The reference to the SVG element.
|
|
107
|
+
* @param formatOptions - The format options for the chart which may contains some undefined values.
|
|
108
|
+
* @returns { chartFormatOptions: TDefaultChartFormatOptionsType } - The chart format options with defaults applied.
|
|
109
|
+
* @returns { svg: d3.Selection<SVGSVGElement, any, any, any> } - The D3 selection of the SVG element.
|
|
110
|
+
*
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
export declare const firstFunctionBeforeRender: (svgRef: React.MutableRefObject<SVGSVGElement>, chartformatOptions: TDefaultChartFormatOptionsType) => {
|
|
114
|
+
formatOptions: TDefaultChartFormatOptionsType;
|
|
115
|
+
svg: d3.Selection<SVGSVGElement, any, any, any>;
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* adds non defined properties from `defaults` to `target` to avoid further checks for undefined values
|
|
121
|
+
* @param defaults -> Object which contains default properties
|
|
122
|
+
* @param target -> Object which may contain some undefined properties
|
|
123
|
+
* @returns object with all properties from defaults
|
|
124
|
+
*/
|
|
125
|
+
export declare function addUndefinedDefaults(defaults: any, target: any): any;
|
|
126
|
+
/**
|
|
127
|
+
* Applies custom formatting rules to Y-axis values based on user-defined min, max, and interval settings
|
|
128
|
+
* from format options. It determines the maximum number values for both primary and secondary Y-axes
|
|
129
|
+
* to be used for dynamic margin calculations or scale formatting.
|
|
130
|
+
*
|
|
131
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options, including axis settings, number format, intervals, etc.
|
|
132
|
+
* @param {number} YminLeft - The minimum value on the primary (left) Y-axis before applying custom formatting.
|
|
133
|
+
* @param {number} YmaxLeft - The maximum value on the primary (left) Y-axis before applying custom formatting.
|
|
134
|
+
* @param {number} YminRight - The minimum value on the secondary (right) Y-axis before applying custom formatting.
|
|
135
|
+
* @param {number} YmaxRight - The maximum value on the secondary (right) Y-axis before applying custom formatting.
|
|
136
|
+
*
|
|
137
|
+
* @returns {{
|
|
138
|
+
* maxNumberForPrimaryAxis: number,
|
|
139
|
+
* maxNumberForSecondaryAxis: number
|
|
140
|
+
* }} An object containing adjusted max values for primary and secondary Y-axes
|
|
141
|
+
* based on the longer formatted values to aid in layout/margin calculation.
|
|
142
|
+
*/
|
|
143
|
+
export declare function customYscaleLabelFormatting(formatOptions: TDefaultChartFormatOptionsType, YminLeft: number, YmaxLeft: number, YminRight: number, YmaxRight: number): {
|
|
144
|
+
maxNumberForPrimaryAxis: number;
|
|
145
|
+
maxNumberForSecondaryAxis: number;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Generates a list of evenly spaced numeric Y-axis labels based on the data range,
|
|
149
|
+
* pixel space available, and a target label width. Uses a "nice number" rounding algorithm
|
|
150
|
+
* to produce human-friendly intervals.
|
|
151
|
+
*
|
|
152
|
+
* @param {number} dataMin - The minimum data value to display on the Y-axis.
|
|
153
|
+
* @param {number} dataMax - The maximum data value to display on the Y-axis.
|
|
154
|
+
* @param {number} axisLengthPx - The length of the Y-axis in pixels.
|
|
155
|
+
* @param {number} [labelWidthPx=80] - The approximate pixel width allocated per label (optional; defaults to 80).
|
|
156
|
+
*
|
|
157
|
+
* @returns {number[]} An array of numeric values to be used as Y-axis tick labels.
|
|
158
|
+
*/
|
|
159
|
+
export declare function getYaxisLabelList(dataMin: number, dataMax: number, axisLengthPx: number, labelWidthPx?: number): number[];
|
|
160
|
+
/**
|
|
161
|
+
* Formats a numeric value based on display units (e.g., Thousands, Millions),
|
|
162
|
+
* number format (e.g., percent, currency), and decimal precision.
|
|
163
|
+
* Uses D3 formatting under the hood and appends appropriate postfixes.
|
|
164
|
+
*
|
|
165
|
+
* @param {number} measureValue - The raw numeric value to be formatted.
|
|
166
|
+
* @param {string} displayUnits - The display unit for scaling the number (e.g., "None", "Thousands", "Millions", "Billions").
|
|
167
|
+
* @param {string} numberFormat - The number formatting string (e.g., ",.0%", ".2$", ",", etc.).
|
|
168
|
+
* @param {number} decimalPrescision - The number of decimal places to include in the formatted output.
|
|
169
|
+
* @param {boolean} tornadoChart - Whether the chart is a tornadoChart chart (affects formatting).
|
|
170
|
+
*
|
|
171
|
+
* @returns {string} A formatted number string based on the given formatting rules.
|
|
172
|
+
*/
|
|
173
|
+
export declare function getNumberWithFormat(measureValue: number, displayUnits: string, numberFormat: string, decimalPrescision: string, tornadoChart?: boolean): string;
|
|
174
|
+
export declare function getAutoNumberWithFormat(value: any): string;
|
|
175
|
+
/**
|
|
176
|
+
* Calculates the dynamic left or right margin size required to accommodate Y-axis labels,
|
|
177
|
+
* based on the maximum number value, formatting options, and axis type.
|
|
178
|
+
*
|
|
179
|
+
* @param {number} maxNumber - The largest number on the axis, used for formatting.
|
|
180
|
+
* @param {number} yMax - The actual Y-axis maximum value, used as fallback.
|
|
181
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options including label styles and display units.
|
|
182
|
+
* @param {boolean} isSecondaryAxis - A flag indicating whether this is for the secondary Y-axis.
|
|
183
|
+
*
|
|
184
|
+
* @returns {number} The computed pixel width required for the Y-axis labels.
|
|
185
|
+
*/
|
|
186
|
+
export declare function responsiveYaxisMargin(maxNumber: number, yMax: number, formatOptions: TDefaultChartFormatOptionsType, isSecondaryAxis: boolean, isNormalizedChart: boolean): any;
|
|
187
|
+
/**
|
|
188
|
+
* Generates a list of labels for the secondary Y-axis based on custom interval, min, and max values
|
|
189
|
+
* or falls back to an automatic labeling algorithm if custom intervals are not provided.
|
|
190
|
+
* It also limits the number of ticks to avoid rendering issues.
|
|
191
|
+
*
|
|
192
|
+
* @param {number} secondaryYmax - The maximum value on the secondary Y-axis.
|
|
193
|
+
* @param {number} secondaryYmin - The minimum value on the secondary Y-axis.
|
|
194
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options including secondary Y-axis label settings.
|
|
195
|
+
* @param {TChartJSON} chartJSON - Chart data including axis min and max values for fallback calculations.
|
|
196
|
+
*
|
|
197
|
+
* @returns {{
|
|
198
|
+
* secondaryYAxisLabelArray: number[],
|
|
199
|
+
* secondaryCustomTickValue: number | undefined
|
|
200
|
+
* }} An object containing the array of label values for the secondary Y-axis and the calculated custom tick count.
|
|
201
|
+
*/
|
|
202
|
+
export declare function responsiveSecondaryYaxisLabel(secondaryYmax: number, secondaryYmin: number, formatOptions: TDefaultChartFormatOptionsType, chartJSON: TChartJSON): {
|
|
203
|
+
secondaryYAxisLabelArray: any[];
|
|
204
|
+
secondaryCustomTickValue: number;
|
|
205
|
+
autoLabelFlag: boolean;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Initializes the chart area by appending a <g> element to the given SVG element,
|
|
209
|
+
* translated by the specified margins and setting a default font color.
|
|
210
|
+
*
|
|
211
|
+
* @param {any} svg - The D3-selected SVG element to append the chart area group to.
|
|
212
|
+
* @param {TMargin} margin - An object containing the margin values with properties: top, right, bottom, left.
|
|
213
|
+
*
|
|
214
|
+
* @returns {d3.Selection<SVGGElement, unknown, null, undefined> | undefined} The appended <g> element with applied transformations and styles,
|
|
215
|
+
* or undefined if an error occurs.
|
|
216
|
+
*/
|
|
217
|
+
export declare function initChartArea(svg: any, margin: TMargin): any;
|
|
218
|
+
/**
|
|
219
|
+
* Initializes the floating chart area depending on scroll flags and chart fit options.
|
|
220
|
+
* If the chart is not fit and either horizontal or vertical scrolling is enabled,
|
|
221
|
+
* it appends a new <g> element to the floating SVG with the specified margin translation.
|
|
222
|
+
* Otherwise, it returns the existing group element.
|
|
223
|
+
*
|
|
224
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - The chart format options containing plot area settings.
|
|
225
|
+
* @param {TMargin} margin - The margin object with top, right, bottom, left properties.
|
|
226
|
+
* @param {any} svg - The D3-selected SVG element representing the floating SVG container.
|
|
227
|
+
* @param {any} gTag - The existing <g> element to return if no new group is appended.
|
|
228
|
+
* @param {boolean} chartsWithXScrollFlag - Flag indicating if horizontal scrolling is enabled.
|
|
229
|
+
* @param {boolean} chartsWithYScrollFlag - Flag indicating if vertical scrolling is enabled.
|
|
230
|
+
*
|
|
231
|
+
* @returns {any | undefined} The appended <g> element if a new group is created, otherwise the existing group element.
|
|
232
|
+
* Returns undefined if an error occurs.
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* Initializes the plot area by appending a clipPath and a rectangle to the given group element.
|
|
236
|
+
* The clipPath defines the visible plotting region, and the rectangle represents the plot background,
|
|
237
|
+
* styled according to the format options and chart type.
|
|
238
|
+
*
|
|
239
|
+
* @param {any} g - The D3-selected group element (<g>) to append the plot area elements to.
|
|
240
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - The chart formatting options including plot area styles.
|
|
241
|
+
* @param {number} dataTableHeight - The height of the data table, used to adjust plot area height.
|
|
242
|
+
* @param {number} innerWidth - The width of the inner plotting area.
|
|
243
|
+
* @param {number} innerHeight - The height of the inner plotting area.
|
|
244
|
+
* @param {string} chartType - The type of chart to determine if plot area styles apply.
|
|
245
|
+
*
|
|
246
|
+
* @returns {void} Does not return a value.
|
|
247
|
+
*/
|
|
248
|
+
export declare function initPlotArea(g: any, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, innerWidth: number, innerHeight: number, chartType: string): void;
|
|
249
|
+
/**
|
|
250
|
+
* Checks whether two objects overlap vertically based on their y-position and height.
|
|
251
|
+
*
|
|
252
|
+
* @param {object} obj1 - The first object with `yPosition` and `height` properties.
|
|
253
|
+
* @param {number} obj1.yPosition - The vertical start position of the first object.
|
|
254
|
+
* @param {number} obj1.height - The height of the first object.
|
|
255
|
+
* @param {object} obj2 - The second object with `yPosition` and `height` properties.
|
|
256
|
+
* @param {number} obj2.yPosition - The vertical start position of the second object.
|
|
257
|
+
* @param {number} obj2.height - The height of the second object.
|
|
258
|
+
*
|
|
259
|
+
* @returns {boolean} True if the objects vertically overlap; otherwise false.
|
|
260
|
+
*/
|
|
261
|
+
export declare function isVerticallyOverlapping(obj1: any, obj2: any): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Generates an array of Y-axis labels based on provided min, max values,
|
|
264
|
+
* chart dimensions, format options, and optional custom min/max values.
|
|
265
|
+
*
|
|
266
|
+
* @param {number} Ymax - The maximum Y value from data or chart.
|
|
267
|
+
* @param {number} Ymin - The minimum Y value from data or chart.
|
|
268
|
+
* @param {number} innerHeight - The inner height of the chart area in pixels.
|
|
269
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Configuration options for formatting the axis labels.
|
|
270
|
+
* @param {TChartJSON} chartJSON - Chart metadata including Y axis min/max values.
|
|
271
|
+
* @param {number} customYaxisMinValue - Optional custom minimum Y-axis value.
|
|
272
|
+
* @param {number} customYaxisMaxValue - Optional custom maximum Y-axis value.
|
|
273
|
+
* @param {boolean} barChart - Optional flag indicating if the chart is a bar chart.
|
|
274
|
+
* @param {number} innerWidth - The inner width of the chart area in pixels.
|
|
275
|
+
*
|
|
276
|
+
* @returns {{ yAxisLabelArray: number[], customTickValue?: number }} Object containing the array of Y-axis labels and optionally the computed custom tick count.
|
|
277
|
+
*/
|
|
278
|
+
export declare function responsiveYaxisLabel(Ymax: number, Ymin: number, innerHeight: number, formatOptions: TDefaultChartFormatOptionsType, chartJSON: TChartJSON, customYaxisMinValue: number, customYaxisMaxValue: number, barChart?: boolean, innerWidth?: number): {
|
|
279
|
+
yAxisLabelArray: any[];
|
|
280
|
+
customTickValue: any;
|
|
281
|
+
autoLabelFlag: boolean;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Calculates a list of nicely spaced numeric labels for an axis given data range and display constraints.
|
|
285
|
+
*
|
|
286
|
+
* @param {number} dataMin - The minimum data value for the axis.
|
|
287
|
+
* @param {number} dataMax - The maximum data value for the axis.
|
|
288
|
+
* @param {number} axisLengthPx - The pixel length available for the axis.
|
|
289
|
+
* @param {number} [labelWidthPx=80] - The approximate width in pixels allocated per label.
|
|
290
|
+
*
|
|
291
|
+
* @returns {number[]} An array of numeric labels evenly spaced and formatted for display on the axis.
|
|
292
|
+
*/
|
|
293
|
+
export declare function getLabelsFromAlgo(dataMin: number, dataMax: number, axisLengthPx: number, labelWidthPx?: number): number[];
|
|
294
|
+
/**
|
|
295
|
+
* Initializes the Y-axis of a chart within an SVG group, including axis line, ticks, labels, and background.
|
|
296
|
+
*
|
|
297
|
+
* @param {any} gTag - The SVG group element where the Y-axis will be appended.
|
|
298
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options including axis styles and colors.
|
|
299
|
+
* @param {number} dataTableHeight - Height of the data table area below the plot, used to adjust axis height.
|
|
300
|
+
* @param {number} yLabel - Width of the Y-axis label area (used for positioning background rect).
|
|
301
|
+
* @param {any} yAxisLeft - D3 axis generator function for the left Y-axis.
|
|
302
|
+
* @param {number} innerHeight - Inner height of the chart area.
|
|
303
|
+
* @param {any} gTag - Optional floating SVG group for scrolling charts.
|
|
304
|
+
* @param {boolean} chartsWithXScrollFlag - Flag indicating if the chart has horizontal scroll.
|
|
305
|
+
* @param {boolean} chartsWithYScrollFlag - Flag indicating if the chart has vertical scroll.
|
|
306
|
+
*/
|
|
307
|
+
export declare function initYaxis(gTag: any, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, yLabel: number, yAxisLeft: number, innerHeight: number): void;
|
|
308
|
+
/**
|
|
309
|
+
* Initializes the secondary (right) Y-axis of a chart with labels, gridlines, background, and optional floating area.
|
|
310
|
+
*
|
|
311
|
+
* @param {any} gTag - SVG group element where the right Y-axis will be appended.
|
|
312
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options.
|
|
313
|
+
* @param {number} dataTableHeight - Height of the data table below the plot, affects axis height.
|
|
314
|
+
* @param {number} secondaryYLabel - Width of the secondary Y-axis label area.
|
|
315
|
+
* @param {any} yAxisRight - D3 axis generator function for the right Y-axis.
|
|
316
|
+
* @param {number} innerHeight - Inner height of the chart area.
|
|
317
|
+
* @param {number} innerWidth - Inner width of the chart area (needed for floating group transform).
|
|
318
|
+
* @param {any} floatingTagG - Optional floating SVG group for scrollable charts.
|
|
319
|
+
*/
|
|
320
|
+
export declare function initYaxisRight(gTag: any, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, secondaryYLabel: number, yAxisRight: number, innerHeight: number, innerWidth: number): void;
|
|
321
|
+
/**
|
|
322
|
+
* Filters the dimension list to generate a responsive set of X-axis labels
|
|
323
|
+
* based on available width, ensuring labels do not overlap.
|
|
324
|
+
*
|
|
325
|
+
* @param {string[]} dimensionList - Array of all possible dimension labels.
|
|
326
|
+
* @param {number} innerWidth - Available width in pixels for the axis.
|
|
327
|
+
* @returns {string[]} Filtered list of dimension labels for the X-axis.
|
|
328
|
+
*/
|
|
329
|
+
export declare function responsiveXaxisLabel(dimensionList: string[], innerWidth: number): any[];
|
|
330
|
+
/**
|
|
331
|
+
* Initializes and renders the X axis with responsive labels on the chart.
|
|
332
|
+
*
|
|
333
|
+
* @param {any} gTag - The SVG group element to append the X axis to.
|
|
334
|
+
* @param {TChartJSON} chartJSON - The chart configuration and data object.
|
|
335
|
+
* @param {number} xLabel - The height allocated for the X axis labels.
|
|
336
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Formatting options for the chart and axis.
|
|
337
|
+
* @param {IXaxisObject} xAxisObj - Object representing the X axis scale and properties.
|
|
338
|
+
* @param {number} dataTableHeight - Height of the data table (if present) at the bottom of the chart.
|
|
339
|
+
* @param {any} yScaleLeft - Scale function for the Y axis (left).
|
|
340
|
+
* @param {any} Xaxis - D3 axis function for the X axis.
|
|
341
|
+
* @param {number[]} dimensionHeightWidthArray - Array containing dimension widths and heights for label sizing.
|
|
342
|
+
* @param {number} height - Total height of the chart container.
|
|
343
|
+
* @param {number} barWidth - Width of each bar (if bar chart).
|
|
344
|
+
* @param {string} dataType - Data type of the X axis (e.g., "DATE").
|
|
345
|
+
* @param {number} innerWidth - Inner width of the chart area.
|
|
346
|
+
* @param {number} innerHeight - Inner height of the chart area.
|
|
347
|
+
* @param {string[]} filteredDimensionList - Filtered list of dimension labels for the X axis.
|
|
348
|
+
*
|
|
349
|
+
* @returns {any} The updated SVG group element (`gTag`) with the initialized X axis.
|
|
350
|
+
*/
|
|
351
|
+
export declare function initXaxis(gTag: any, chartJSON: TChartJSON, xLabel: number, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, yScaleLeft: any, xAxis: any, dimensionHeightWidthArray: number[], height: number, barWidth: number, isDateType: string, innerWidth: number, innerHeight: number, filteredDimensionList: string[]): any;
|
|
352
|
+
export declare function detectBrowserName(): string;
|
|
353
|
+
/**
|
|
354
|
+
* Formats date dimension marks based on the specified format and datasource.
|
|
355
|
+
*
|
|
356
|
+
* @param {string} format - The desired date format string (e.g., "Month", "YYYY-MM-DD").
|
|
357
|
+
* @param {string[]} dimensionmarks - Array of date dimension marks to format.
|
|
358
|
+
*
|
|
359
|
+
* @returns {string[]|Array} The array of formatted date strings or original dimension marks if no formatting applied.
|
|
360
|
+
*/
|
|
361
|
+
export declare const setDateFormats: (format: string, dimensionmarks: string[]) => string[];
|
|
362
|
+
/**
|
|
363
|
+
* Draws series labels on the chart using SVG foreignObject elements for styled HTML content.
|
|
364
|
+
*
|
|
365
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Configuration options for chart formatting, including series label styles and visibility.
|
|
366
|
+
* @param {any} gTag - D3 selection of the group (`<g>`) element where series labels will be appended.
|
|
367
|
+
* @param {Array<{isVisible: boolean, xPosition: number, yPosition: number, width: number, height: number, seriesValue: string}>} seriesLabels - Array of label data with visibility, position, size, and text.
|
|
368
|
+
*
|
|
369
|
+
* @returns {void}
|
|
370
|
+
*/
|
|
371
|
+
export declare function drawSeriesLabels(formatOptions: TDefaultChartFormatOptionsType, gTag: any, seriesLabels: string[]): void;
|
|
372
|
+
/**
|
|
373
|
+
* Sets the X-axis title on the SVG chart, adjusting visibility, positioning, and styling based on format options and chart type.
|
|
374
|
+
*
|
|
375
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart format options including axis title settings and visibility.
|
|
376
|
+
* @param {boolean} barChart - Flag indicating if the chart is a bar chart.
|
|
377
|
+
* @param {any} svg - D3 selection of the SVG element where the X-axis title will be appended.
|
|
378
|
+
* @param {TMargin} margin - Margin object containing top, left, right, and bottom margins.
|
|
379
|
+
* @param {number} xLabel - Height offset for the X-axis label.
|
|
380
|
+
* @param {number} height - Total height of the SVG/chart container.
|
|
381
|
+
* @param {number} xTitle - Height allocated for the X-axis title element.
|
|
382
|
+
* @param {string} chartType - The type of chart (e.g., "bar", "line", etc.).
|
|
383
|
+
* @param {number} yLabel - Y-axis label offset (used for positioning in some cases).
|
|
384
|
+
* @param {number} innerWidth - Inner width of the static SVG container.
|
|
385
|
+
* @param {number} innerHeight - Height of the inner chart area (excluding margins).
|
|
386
|
+
*
|
|
387
|
+
* @returns {any} The modified SVG selection with the appended X-axis title element.
|
|
388
|
+
*/
|
|
389
|
+
export declare function setXaxistitle(formatOptions: TDefaultChartFormatOptionsType, barChart: boolean, svg: any, margin: TMargin, xLabel: number, height: number, xTitle: number, chartType: string, yLabel: number, innerWidth: number, innerHeight: number): void;
|
|
390
|
+
/**
|
|
391
|
+
* Adds a Y-axis title to the SVG chart, handling visibility, positioning, rotation, and styling based on format options.
|
|
392
|
+
*
|
|
393
|
+
* @param {number} innerHeight - The height of the inner chart area (excluding margins).
|
|
394
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options, including Y-axis title settings.
|
|
395
|
+
* @param {number} dataTableHeight - Height of any data table below the chart, used to adjust positioning.
|
|
396
|
+
* @param {boolean} barChart - Whether the chart is a bar chart.
|
|
397
|
+
* @param {any} svg - D3 selection of the SVG element where the Y-axis title will be appended.
|
|
398
|
+
* @param {TMargin} margin - Margins around the chart.
|
|
399
|
+
* @param {number} yTitle - Height allocated for the Y-axis title element.
|
|
400
|
+
* @param {number} yLabel - Offset for the Y-axis label, used for positioning.
|
|
401
|
+
* @param {number} width - Width allocated for the Y-axis title element.
|
|
402
|
+
*
|
|
403
|
+
* @returns {any} The SVG selection with the appended Y-axis title.
|
|
404
|
+
*/
|
|
405
|
+
export declare function yAxistitle(innerHeight: number, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, barChart: boolean, svg: any, margin: TMargin, yTitle: number, yLabel: number, width?: number, xTitle?: number, xLabel?: number): any;
|
|
406
|
+
/**
|
|
407
|
+
* Adds a Y-axis title on the right side (secondary axis) of the chart,
|
|
408
|
+
* handling visibility, positioning, rotation, and styling based on format options.
|
|
409
|
+
*
|
|
410
|
+
* @param svg - D3 selection of the SVG element to append the title.
|
|
411
|
+
* @param isSecondaryAxisDrawn - Flag to determine if the secondary Y axis is drawn.
|
|
412
|
+
* @param margin - Margins around the chart.
|
|
413
|
+
* @param formatOptions - Chart formatting options, including secondary Y-axis title settings.
|
|
414
|
+
* @param dataTableHeight - Height of any data table below the chart, used to adjust positioning.
|
|
415
|
+
* @param innerHeight - Inner height of the SVG container.
|
|
416
|
+
* @param innerWidth - Inner width of the SVG container.
|
|
417
|
+
* @param secondaryYLabel - Offset for the secondary Y label.
|
|
418
|
+
* @param secondaryAxisTitleWidth - Width allocated for the secondary Y-axis title.
|
|
419
|
+
* @param innerHeight - Inner height for the chart area.
|
|
420
|
+
*/
|
|
421
|
+
export declare function yAxistitleRight(svg: any, isSecondaryAxisDrawn: boolean, margin: TMargin, formatOptions: TDefaultChartFormatOptionsType, dataTableHeight: number, innerHeight: number, innerWidth: number, secondaryYLabel: number, secondaryAxisTitleWidth: number): void;
|
|
422
|
+
/**
|
|
423
|
+
* @param svg - The SVG container to append the chart title to.
|
|
424
|
+
* @param formatOptions - Configuration object containing chart title settings and styles.
|
|
425
|
+
* @param width - The width allocated for the chart title.
|
|
426
|
+
* @param chartTitleHeight - The height allocated for the chart title.
|
|
427
|
+
*
|
|
428
|
+
* @returns The modified SVG element with the appended chart title.
|
|
429
|
+
*/
|
|
430
|
+
export declare function setChartTitle(svg: any, formatOptions: TDefaultChartFormatOptionsType, width: number, chartTitleHeight: number): void;
|
|
431
|
+
/**
|
|
432
|
+
* @param formatOptions - Configuration object containing line chart interpolation and smoothing options.
|
|
433
|
+
*
|
|
434
|
+
* @returns The appropriate D3 curve function based on the interpolation and smoothing settings.
|
|
435
|
+
*/
|
|
436
|
+
export declare function getCurveType(formatOptions: TDefaultChartFormatOptionsType): d3.CurveFactory;
|
|
437
|
+
/**
|
|
438
|
+
* @param {TSeries[]} chartData - Array of data series for the chart.
|
|
439
|
+
* @param {any} xScale - D3 scale function for the X axis.
|
|
440
|
+
* @param {any} yScaleLeft - D3 scale function for the left Y axis.
|
|
441
|
+
* @param {any} yScaleRight - D3 scale function for the right Y axis.
|
|
442
|
+
* @param {TMargin} margin - Margin object defining chart margins.
|
|
443
|
+
* @param {any} d3Annotation - D3 annotation library or object.
|
|
444
|
+
* @param {string[]} labelExcludeList - List of labels to exclude from annotations.
|
|
445
|
+
* @param {any[]} individualLabelColor - Array of colors for individual labels.
|
|
446
|
+
* @param {any[]} oldAnnotationList - List of existing annotations to update or remove.
|
|
447
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Formatting options for the chart.
|
|
448
|
+
* @param {string} chartType - Type of the chart (e.g., "line", "area").
|
|
449
|
+
* @param {number} height - Total height of the SVG container.
|
|
450
|
+
* @param {number} width - Total width of the SVG container.
|
|
451
|
+
* @param {number} innerWidth - Inner width of the chart area.
|
|
452
|
+
* @param {string[]} dimensionList - List of dimensions present in the chart data.
|
|
453
|
+
* @param {number} innerHeight - Inner height of the chart area.
|
|
454
|
+
* @param {string} widgetId - Unique identifier for the widget/chart instance.
|
|
455
|
+
* @param {any} svg - D3 selection of the SVG element to render annotations.
|
|
456
|
+
* @param {any} xScaleForLegends - D3 scale function for the X axis for legends.
|
|
457
|
+
* @param {number} columnWidth - Column width for the chart.
|
|
458
|
+
* @param {boolean} isSensitivityChart - Flag indicating if the chart is a sensitivity chart.
|
|
459
|
+
* @param {boolean} barChart - Flag indicating if the chart is a barChart chart.
|
|
460
|
+
*
|
|
461
|
+
* @return {void} - This function does not return a value; it updates the SVG with annotations.
|
|
462
|
+
*/
|
|
463
|
+
export declare function commonAnnotations(chartData: TSeries[], xScale: any, yScaleLeft: any, yScaleRight: any, margin: TMargin, d3Annotation: any, labelExcludeList: string[], individualLabelColor: any[], oldAnnotationList: any[], formatOptions: TDefaultChartFormatOptionsType, chartType: string, height: number, width: number, innerWidth: number, dimensionList: string[], innerHeight: number, widgetId: string, svg: any, xScaleForLegends?: any, columnWidth?: number, isSensitivityChart?: boolean, barChart?: boolean): void;
|
|
464
|
+
/**
|
|
465
|
+
* @param {Array} chartData - The main data used to render the chart.
|
|
466
|
+
* @param {Function} xscale - D3 scale function for the x-axis.
|
|
467
|
+
* @param {Function} yScaleLeft - D3 scale function for the left y-axis.
|
|
468
|
+
* @param {Function} yScaleRight - D3 scale function for the right y-axis (if dual axis is used).
|
|
469
|
+
* @param {Object} margin - The margin object defining top, right, bottom, left margins.
|
|
470
|
+
* @param {Object} d3Annotation - D3 annotation configuration or plugin.
|
|
471
|
+
* @param {Array} stackColumnData - Data formatted for stacked column charts.
|
|
472
|
+
* @param {Array} stackAreaData - Data formatted for stacked area charts.
|
|
473
|
+
* @param {Array<string>} labelExcludeList - List of label keys to exclude from annotation.
|
|
474
|
+
* @param {Object} individualLabelColor - Map of label names to their individual colors.
|
|
475
|
+
* @param {number} barWidth - The width of individual bars in bar charts.
|
|
476
|
+
* @param {Array<Object>} oldAnnotationList - Previously rendered annotations (if updating or redrawing).
|
|
477
|
+
* @param {Object} formatOptions - Options for number/date formatting.
|
|
478
|
+
* @param {number} height - Total height of the SVG/chart.
|
|
479
|
+
* @param {number} width - Total width of the SVG/chart.
|
|
480
|
+
* @param {number} innerWidth - Width of the chart area (excluding margins).
|
|
481
|
+
* @param {Array<string>} dimensionList - List of dimensions used in the chart (e.g., ['date', 'region']).
|
|
482
|
+
* @param {number} innerHeight - Height of the chart area (excluding margins).
|
|
483
|
+
* @param {string} widgetId - Unique ID for the chart widget.
|
|
484
|
+
* @param {Object} svg - D3-selected SVG element where the chart is rendered.
|
|
485
|
+
* @param {Function} xScaleForLegends - Alternate x-scale used specifically for positioning legends.
|
|
486
|
+
*
|
|
487
|
+
* @return {void} - This function does not return a value; it updates the SVG with annotations.
|
|
488
|
+
*/
|
|
489
|
+
export declare function commonAnnotationsForCustomChart(chartData: TSeries[], xScale: any, yScaleLeft: any, yScaleRight: any, margin: TMargin, d3Annotation: any, stackColumnData: any[], stackAreaData: any[], labelExcludeList: string[], individualLabelColor: any[], columnWidth: number, oldAnnotationList: any[], formatOptions: TDefaultChartFormatOptionsType, height: number, width: number, innerWidth: number, dimensionList: string[], innerHeight: number, widgetId: string, svg: any, xScaleForLegends: any): void;
|
|
490
|
+
/**
|
|
491
|
+
* Pre-calculates data table layout information based on format options and series data.
|
|
492
|
+
*
|
|
493
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options including data table properties.
|
|
494
|
+
* @param {number} yLabel - The width reserved for Y axis labels.
|
|
495
|
+
* @param {number} yTitle - The width reserved for Y axis title.
|
|
496
|
+
* @param {TSeries[]} seriesData - Array of data series for the chart.
|
|
497
|
+
* @param {string[]} dimensionList - List of dimensions to include in the data table.
|
|
498
|
+
*
|
|
499
|
+
* @return {{ dataTable: any[], dataTableHeight: number }} An object containing the data table array and its total calculated height.
|
|
500
|
+
*/
|
|
501
|
+
export declare const dataTablePreCalculation: (formatOptions: TDefaultChartFormatOptionsType, yLabel: number, yTitle: number, seriesData: TSeries[], dimensionList: string[]) => {
|
|
502
|
+
dataTable: any[];
|
|
503
|
+
dataTableHeight: number;
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* Adds a data table to the chart SVG element, rendering legends and values with styling and layout.
|
|
507
|
+
*
|
|
508
|
+
* @param {boolean} isFitChart - Flag indicating if the chart is fitted to the container.
|
|
509
|
+
* @param {any} svg - The root SVG element selection.
|
|
510
|
+
* @param {any} currentTag - The current SVG group (`<g>`) to append elements to.
|
|
511
|
+
* @param {any[]} dataTable - Array of data table objects containing data and properties.
|
|
512
|
+
* @param {number} colWidth - Width of each column in the data table.
|
|
513
|
+
* @param {any} yAxis - Y-axis scale or axis object.
|
|
514
|
+
* @param {any} xAxis - X-axis scale or axis object.
|
|
515
|
+
* @param {any} xScaleForLegends - Additional X-axis scale or axis (possibly duplicate or different).
|
|
516
|
+
* @param {Function} getBarColor - Function to get bar colors.
|
|
517
|
+
* @param {boolean} isColorScaleApplied - Flag indicating if color scaling is applied.
|
|
518
|
+
* @param {number} dataTableHeight - Total height reserved for the data table.
|
|
519
|
+
* @param {string} chartType - Type of chart (e.g., "Line", "stackColumn").
|
|
520
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Formatting options for chart and data table.
|
|
521
|
+
* @param {number} yLabel - Space allocated for y-axis labels.
|
|
522
|
+
* @param {number} yTitle - Space allocated for y-axis title.
|
|
523
|
+
* @param {string[]} dimensionList - List of dimension names used in the chart.
|
|
524
|
+
* @param {number} innerWidth - Inner width of the chart plotting area.
|
|
525
|
+
* @param {number[]} calculatedRange - Range of the data calculated for the axis.
|
|
526
|
+
* @param {any} formatedDimensionMap - Map for formatting dimension labels.
|
|
527
|
+
* @param {string} chartId - Unique identifier for the chart.
|
|
528
|
+
* @param {TMargin} margin - Margins around the chart.
|
|
529
|
+
* @param {number} innerHeight - Inner height of the chart plotting area.
|
|
530
|
+
*
|
|
531
|
+
* @return {void} This function does not return a value.
|
|
532
|
+
*/
|
|
533
|
+
export declare function addDataTable(isFitChart: boolean, svg: any, currentTag: any, dataTable: any[], colWidth: number, yAxis: any, xAxis: any, xScaleForLegends: any, getBarColor: any, isColorScaleApplied: boolean, dataTableHeight: number, chartType: string, formatOptions: TDefaultChartFormatOptionsType, yLabel: number, yTitle: number, dimensionList: string[], innerWidth: number, calculatedRange: number[], formatedDimensionMap: any, chartId: string, margin: TMargin, innerHeight: number): void;
|
|
534
|
+
/**
|
|
535
|
+
* Determines the CSS border style property (width, style, or color) for a data table cell.
|
|
536
|
+
*
|
|
537
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart formatting options containing border settings.
|
|
538
|
+
* @param {number} position - The index position of the current row (legend index).
|
|
539
|
+
* @param {number} currentCellIndex - The index of the current cell (column index).
|
|
540
|
+
* @param {number} totalDimensionCount - Total number of dimensions (columns).
|
|
541
|
+
* @param {number} legendsCount - Total number of legend entries (rows).
|
|
542
|
+
* @param {string} functionType - Type of CSS property to return ("width", "style", or "color").
|
|
543
|
+
* @param {string} [type] - Optional type of border context, e.g. "colHeaders" for column headers.
|
|
544
|
+
*
|
|
545
|
+
* @returns {string} - The CSS value for the requested border property.
|
|
546
|
+
*/
|
|
547
|
+
export declare function getBorderStyle(formatOptions: TDefaultChartFormatOptionsType, position: number, currentCellIndex: number, totalDimensionCount: number, legendsCount: number, functionType: string, type?: string): string;
|
|
548
|
+
/**
|
|
549
|
+
* Processes dimension and series data to generate stacked chart data with totals.
|
|
550
|
+
*
|
|
551
|
+
* @param {string[]} dimensionList - An array of dimension strings; each represents a category or group.
|
|
552
|
+
* @param {TSeries[]} seriesData - An array of series data objects, each containing properties like measures and legend.
|
|
553
|
+
* @param {boolean} isNormalizedChart - Flag indicating whether to normalize the measures by their absolute values.
|
|
554
|
+
*
|
|
555
|
+
* @returns {Array<Record<string, any>>} An array of objects where each object represents stacked data for a dimension,
|
|
556
|
+
* including total sums, absolute totals, and display totals.
|
|
557
|
+
*/
|
|
558
|
+
export declare function getStackedData(dimensionList: string[], seriesData: TSeries[], isNormalizedChart: any): any[];
|
|
559
|
+
/**
|
|
560
|
+
* Prepares data required to render series labels (like legends) on the chart,
|
|
561
|
+
* calculating their position, visibility, width, and height based on chart settings.
|
|
562
|
+
*
|
|
563
|
+
* @param innerWidth - The inner width of the chart (used to position labels on the x-axis).
|
|
564
|
+
* @param yScaleLeft - D3 scale function for the primary (left) y-axis.
|
|
565
|
+
* @param formatOptions - Object containing chart formatting options such as font size, label visibility, and positioning.
|
|
566
|
+
* @param filteredData - The data series array filtered for plotting, each including legend and measurement data.
|
|
567
|
+
* @param yScaleRight - D3 scale function for the secondary (right) y-axis.
|
|
568
|
+
* @param isSecondaryAxisDrawn - Flag indicating if a secondary y-axis is present.
|
|
569
|
+
* @param isStackedChart - (Optional) Flag indicating if the chart is a stacked chart (affects y-position calculation).
|
|
570
|
+
*
|
|
571
|
+
* @returns An object containing:
|
|
572
|
+
* - `labelArray`: Array of objects for each visible label with position and size.
|
|
573
|
+
* - `heightWidth`: Tuple representing the max label width and height for layout purposes.
|
|
574
|
+
*/
|
|
575
|
+
export declare function prepareDataForSeriesLabel(innerWidth: number, yScaleLeft: any, formatOptions: TDefaultChartFormatOptionsType, filteredData: TSeries[], yScaleRight: any, isSecondaryAxisDrawn: boolean, isStackedChart?: boolean): {
|
|
576
|
+
labelArray: any[];
|
|
577
|
+
heightWidth: number[];
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* @param chartData - The dataset used for generating annotations.
|
|
581
|
+
* @param xScale - D3 scale function for the x-axis.
|
|
582
|
+
* @param yScaleLeft - D3 scale function for the left y-axis.
|
|
583
|
+
* @param yScaleRight - D3 scale function for the right y-axis.
|
|
584
|
+
* @param margin - Margin object that defines spacing around the chart.
|
|
585
|
+
* @param d3Annotation - D3 annotation utility used to create annotations.
|
|
586
|
+
* @param labelExcludeList - List of labels to exclude from annotation rendering.
|
|
587
|
+
* @param individualLabelColor - Array defining individual colors for specific labels.
|
|
588
|
+
* @param oldAnnotationList - Previously rendered annotations, possibly used for comparison or re-rendering.
|
|
589
|
+
* @param formatOptions - Object specifying formatting and styling options for annotations.
|
|
590
|
+
* @param chartType - Type of the chart (e.g., "stackline", "line", etc.).
|
|
591
|
+
* @param height - Total height of the chart including margins.
|
|
592
|
+
* @param width - Total width of the chart including margins.
|
|
593
|
+
* @param innerWidth - Width of the drawable chart area (excluding margins).
|
|
594
|
+
* @param dimensionList - List of dimensions used in the chart, relevant for annotation placement.
|
|
595
|
+
* @param innerHeight - Height of the drawable chart area (excluding margins).
|
|
596
|
+
* @param widgetId - Identifier for the widget/chart, possibly used for DOM selection or state management.
|
|
597
|
+
* @param svg - D3 SVG selection where annotations will be drawn.
|
|
598
|
+
* @param dataTableHeight - Height of the associated data table, may affect vertical placement of annotations.barChartbarChart
|
|
599
|
+
* @param barChart - Height of the associated data table, may affect vertical placement of annotations.barChartbarChart
|
|
600
|
+
*
|
|
601
|
+
* @return - void. This function performs side effects by rendering annotations onto the provided SVG element.
|
|
602
|
+
*/
|
|
603
|
+
export declare function stacklineAnnotations(chartData: any[], xScale: any, yScaleLeft: any, yScaleRight: any, margin: TMargin, d3Annotation: any, labelExcludeList: string[], individualLabelColor: any[], oldAnnotationList: any[], formatOptions: TDefaultChartFormatOptionsType, chartType: string, height: number, width: number, innerWidth: number, dimensionList: string[], innerHeight: number, widgetId: string, svg: any, dataTableHeight: number, barChart?: boolean): void;
|
|
604
|
+
/**
|
|
605
|
+
* Initializes the X-axis of a bar chart using provided formatting options and axis configuration.
|
|
606
|
+
*
|
|
607
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Configuration options for formatting the chart (e.g. tick formatting, scale, etc.).
|
|
608
|
+
* @param {any} gTag - The SVG group element where the axis should be appended or updated.
|
|
609
|
+
* @param {number} xLabel - The number of ticks or label count for the X-axis.
|
|
610
|
+
* @param {number} innerHeight - The height of the chart area excluding margins.
|
|
611
|
+
* @param {number} innerWidth - The width of the chart area excluding margins.
|
|
612
|
+
* @param {any} xAxis - The D3 axis object to be used for rendering the X-axis.
|
|
613
|
+
*
|
|
614
|
+
* @returns {void}
|
|
615
|
+
*/
|
|
616
|
+
export declare const initXaxisBar: (formatOptions: TDefaultChartFormatOptionsType, gTag: any, yLabel: number, innerHeight: number, innerWidth: number, xAxisBottom: any) => void;
|
|
617
|
+
/**
|
|
618
|
+
* Initializes the Y-axis for a bar chart, including scales, dimensions, and axis adjustments
|
|
619
|
+
* based on provided formatting and chart configuration options.
|
|
620
|
+
*
|
|
621
|
+
* @param {TDefaultChartFormatOptionsType} formatOptions - Chart format settings including tick formatting, axis labels, etc.
|
|
622
|
+
* @param {*} gTag - The D3 selection or container group element used for appending SVG elements.
|
|
623
|
+
* @param {number} xLabel - X-axis label height or offset.
|
|
624
|
+
* @param {number} innerHeight - Height of the chart's drawable area (excluding margins).
|
|
625
|
+
* @param {number} innerWidth - Width of the chart's drawable area (excluding margins).
|
|
626
|
+
* @param {*} yAxis - The D3 Y-axis generator or group element for rendering the Y-axis.
|
|
627
|
+
* @param {*} xAxisTop - The D3 X-axis generator or group element for the top axis.
|
|
628
|
+
* @param {*} xScaleBottom - D3 scale used for positioning bars on the bottom X-axis.
|
|
629
|
+
* @param {number} yMaxLeft - Maximum Y-axis value on the left side (for scale setting).
|
|
630
|
+
* @param {string[]} dimensionList - List of dimensions used to determine bar grouping or stacking.
|
|
631
|
+
* @param {string} chartType - Type of the chart (e.g., 'bar', 'grouped', 'stacked').
|
|
632
|
+
* @param {*} xAxisObject - Object or group used to control or render the X-axis.
|
|
633
|
+
* @param {number} width - Total chart width including margins.
|
|
634
|
+
* @param {number[]} dimensionHeightWidthArray - Array of calculated dimensions used for layout (e.g., bar widths or heights).
|
|
635
|
+
* @param {number} columnWidth - Width of each bar column.
|
|
636
|
+
*
|
|
637
|
+
* @returns {void} This function does not return a value; it modifies the chart by rendering or adjusting axes.
|
|
638
|
+
*/
|
|
639
|
+
export declare const initYaxisBar: (formatOptions: TDefaultChartFormatOptionsType, gTag: any, xLabel: number, innerHeight: number, innerWidth: number, yAxis: any, xAxisTop: any, xScaleBottom: any, yMaxLeft: number, dimensionList: string[], chartType: string, isDateType: any, width: number, dimensionHeightWidthArray: number[], columnWidth: number) => void;
|
|
640
|
+
export declare const dataLabelsPositionForBarChartFamily: (formatOptions: TDefaultChartFormatOptionsType, xCordinate: number, position: number, xScale: any, minValue: number, prevValue?: number, chartType?: string, isSensitivityChart?: boolean, axis?: string) => any;
|
|
641
|
+
export declare const initXaxisTop: (formatOptions: TDefaultChartFormatOptionsType, gTag: any, xLabelSecondary: number, xAxisTop: any) => void;
|
|
642
|
+
export declare const xAxisTitleTop: (formatOptions: TDefaultChartFormatOptionsType, svg: any, margin: TMargin, isSecondaryAxisDrawn: boolean, xLabelSecondary: number, xTitleSecondary: number) => void;
|
|
643
|
+
export declare const bandWidthFromBar: (gapFraction: any, barWidth: number) => number;
|
|
644
|
+
export declare const barWidthFromBand: (gapFraction: any, bandWidth: number) => number;
|
|
645
|
+
/**
|
|
646
|
+
* Calculate how many bars can be visible without horizontal scroll and the resulting
|
|
647
|
+
* per-bar column width and gap width. This is a pure function that takes required
|
|
648
|
+
* inputs and returns the computed layout values instead of mutating outer-scope variables.
|
|
649
|
+
*
|
|
650
|
+
* @param innerWidth - drawable width of the plot area in pixels
|
|
651
|
+
* @param formatOptions - chart formatting options (used for plotAreaGapWidth)
|
|
652
|
+
* @param chartJSON - chart data/meta (used for number of categories)
|
|
653
|
+
* @param minBarWidthPx - minimum allowed bar width in pixels (default: 25)
|
|
654
|
+
*
|
|
655
|
+
* @returns object containing:
|
|
656
|
+
* - visibleBars: number of bars that can be shown without scrolling
|
|
657
|
+
* - columnWidth: computed width of each bar (px)
|
|
658
|
+
* - gapWidthPx: computed gap width between bars (px)
|
|
659
|
+
* - scrollbarVisible: whether a horizontal scrollbar would be required to see all bars
|
|
660
|
+
*/
|
|
661
|
+
export declare function calculateVisibleBars(innerWidth: number, formatOptions: TDefaultChartFormatOptionsType, chartJSON: TChartJSON): {
|
|
662
|
+
visibleBars: number;
|
|
663
|
+
columnWidth: number;
|
|
664
|
+
scrollbarVisible: boolean;
|
|
665
|
+
};
|
|
666
|
+
export declare const clamp: (v: any, a: any, b: any) => number;
|
|
667
|
+
export declare const horizontalScrollBar: (seriesData: any, height: any, width: any, svg: any, margin: any, innerWidth: any, scrollbarVisible: any, visibleBars: any, chartJSON: any, scrollPosition: any, isStackedChart: any, setAndUpdateChartData: any, isBarChart?: boolean) => void;
|