PageSourceSearch

https://www.ledevoluy.com/app/dist/ledevoluy-tourisme/addons/woody…/es-modules/Series/Scatter/ScatterSeries.js

js ledevoluy.com collected 2026-09-24 23:13:58 UTC 3,143 bytes, 110 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 ScatterSeriesDefaults from './ScatterSeriesDefaults.js';
12import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
13const { column: ColumnSeries, line: LineSeries } = SeriesRegistry.seriesTypes;
14import U from '../../Core/Utilities.js';
15const { addEvent, extend, merge } = U;
16/* *
17 *
18 *  Class
19 *
20 * */
21/**
22 * Scatter series type.
23 *
24 * @private
25 */
26class ScatterSeries extends LineSeries {
27    /* *
28     *
29     *  Functions
30     *
31     * */
32    /* eslint-disable valid-jsdoc */
33    /**
34     * Optionally add the jitter effect.
35     * @private
36     */
37    applyJitter() {
38        const series = this, jitter = this.options.jitter, len = this.points.length;
39        /**
40         * Return a repeatable, pseudo-random number based on an integer
41         * seed.
42         * @private
43         */
44        function unrandom(seed) {
45            const rand = Math.sin(seed) * 10000;
46            return rand - Math.floor(rand);
47        }
48        if (jitter) {
49            this.points.forEach(function (point, i) {
50                ['x', 'y'].forEach(function (dim, j) {
51                    if (jitter[dim] && !point.isNull) {
52                        const plotProp = `plot${dim.toUpperCase()}`, axis = series[`${dim}Axis`], translatedJitter = jitter[dim] *
53                            axis.transA;
54                        if (axis && !axis.logarithmic) {
55                            // Identify the outer bounds of the jitter range
56                            const min = Math.max(0, (point[plotProp] || 0) - translatedJitter), max = Math.min(axis.len, (point[plotProp] || 0) + translatedJitter);
57                            // Find a random position within this range
58                            point[plotProp] = min +
59                                (max - min) * unrandom(i + j * len);
60                            // Update clientX for the tooltip k-d-tree
61                            if (dim === 'x') {
62                                point.clientX = point.plotX;
63                            }
64                        }
65                    }
66                });
67            });
68        }
69    }
70    /**
71     * @private
72     */
73    drawGraph() {
74        if (this.options.lineWidth) {
75            super.drawGraph();
76        }
77        else if (this.graph) {
78            this.graph = this.graph.destroy();
79        }
80    }
81}
82/* *
83 *
84 *  Static Properties
85 *
86 * */
87ScatterSeries.defaultOptions = merge(LineSeries.defaultOptions, ScatterSeriesDefaults);
88extend(ScatterSeries.prototype, {
89    drawTracker: ColumnSeries.prototype.drawTracker,
90    sorted: false,
91    requireSorting: false,
92    noSharedTooltip: true,
93    trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup']
94});
95/* *
96 *
97 *  Events
98 *
99 * */
100/* eslint-disable no-invalid-this */
101addEvent(ScatterSeries, 'afterTranslate', function () {
102    this.applyJitter();
103});
104SeriesRegistry.registerSeriesType('scatter', ScatterSeries);
105/* *
106 *
107 *  Default Export
108 *
109 * */
110export default ScatterSeries;

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.