PageSourceSearch

https://www.sudtourisme.nc/app/dist/nc-sud-tourism-v2/addons/woody…/Series/Column/ColumnDataLabel.js

js sudtourisme.nc collected 2026-10-02 19:48:09 UTC 3,950 bytes, 106 lines download raw bytes

1/* *
2 *
3 *  (c) 2010-2024 Torstein Honsi
4 *
5 *  License: www.highcharts.com/license
6 *
7 *  !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
8 *
9 * */
10'use strict';
11import DataLabel from '../../Core/Series/DataLabel.js';
12import H from '../../Core/Globals.js';
13const { composed } = H;
14import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
15const { series: Series } = SeriesRegistry;
16import U from '../../Core/Utilities.js';
17const { merge, pick, pushUnique } = U;
18/* *
19 *
20 *  Composition
21 *
22 * */
23var ColumnDataLabel;
24(function (ColumnDataLabel) {
25    /* *
26     *
27     *  Functions
28     *
29     * */
30    /**
31     * Override the basic data label alignment by adjusting for the position of
32     * the column.
33     * @private
34     */
35    function alignDataLabel(point, dataLabel, options, alignTo, isNew) {
36        const inverted = this.chart.inverted, series = point.series, xLen = (series.xAxis ? series.xAxis.len : this.chart.plotSizeX) || 0, yLen = (series.yAxis ? series.yAxis.len : this.chart.plotSizeY) || 0, 
37        // Data label box for alignment
38        dlBox = point.dlBox || point.shapeArgs, below = pick(point.below, // Range series
39        point.plotY >
40            pick(this.translatedThreshold, yLen)), 
41        // Draw it inside the box?
42        inside = pick(options.inside, !!this.options.stacking);
43        // Align to the column itself, or the top of it
44        if (dlBox) { // Area range uses this method but not alignTo
45            alignTo = merge(dlBox);
46            // Check for specific overflow and crop conditions (#13240)
47            if (!(options.overflow === 'allow' && options.crop === false)) {
48                if (alignTo.y < 0) {
49                    alignTo.height += alignTo.y;
50                    alignTo.y = 0;
51                }
52                // If parts of the box overshoots outside the plot area, modify
53                // the box to center the label inside
54                const overshoot = alignTo.y + alignTo.height - yLen;
55                if (overshoot > 0 && overshoot < alignTo.height - 1) {
56                    alignTo.height -= overshoot;
57                }
58            }
59            if (inverted) {
60                alignTo = {
61                    x: yLen - alignTo.y - alignTo.height,
62                    y: xLen - alignTo.x - alignTo.width,
63                    width: alignTo.height,
64                    height: alignTo.width
65                };
66            }
67            // Compute the alignment box
68            if (!inside) {
69                if (inverted) {
70                    alignTo.x += below ? 0 : alignTo.width;
71                    alignTo.width = 0;
72                }
73                else {
74                    alignTo.y += below ? alignTo.height : 0;
75                    alignTo.height = 0;
76                }
77            }
78        }
79        // When alignment is undefined (typically columns and bars), display the
80        // individual point below or above the point depending on the threshold
81        options.align = pick(options.align, !inverted || inside ? 'center' : below ? 'right' : 'left');
82        options.verticalAlign = pick(options.verticalAlign, inverted || inside ? 'middle' : below ? 'top' : 'bottom');
83        // Call the parent method
84        Series.prototype.alignDataLabel.call(this, point, dataLabel, options, alignTo, isNew);
85        // If label was justified and we have contrast, set it:
86        if (options.inside && point.contrastColor) {
87            dataLabel.css({
88                color: point.contrastColor
89            });
90        }
91    }
92    /** @private */
93    function compose(ColumnSeriesClass) {
94        DataLabel.compose(Series);
95        if (pushUnique(composed, 'ColumnDataLabel')) {
96            ColumnSeriesClass.prototype.alignDataLabel = alignDataLabel;
97        }
98    }
99    ColumnDataLabel.compose = compose;
100})(ColumnDataLabel || (ColumnDataLabel = {}));
101/* *
102 *
103 *  Default Export
104 *
105 * */
106export default ColumnDataLabel;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.