PageSourceSearch

https://www.digi.ro/static/js/vendor/chart-js-2.7.2/utils.js?cache=release-2026092412-rls494

js digi.ro collected 2026-09-24 09:53:47 UTC 3,577 bytes, 135 lines download raw bytes

1'use strict';
2
3window.chartColors = {
4    red: 'rgb(255, 99, 132)',
5    orange: 'rgb(255, 159, 64)',
6    yellow: 'rgb(255, 205, 86)',
7    green: 'rgb(75, 192, 192)',
8    blue: 'rgb(54, 162, 235)',
9    purple: 'rgb(153, 102, 255)',
10    grey: 'rgb(201, 203, 207)'
11};
12
13(function(global) {
14    var Months = [
15        'January',
16        'February',
17        'March',
18        'April',
19        'May',
20        'June',
21        'July',
22        'August',
23        'September',
24        'October',
25        'November',
26        'December'
27    ];
28
29    var COLORS = [
30        '#4dc9f6',
31        '#f67019',
32        '#f53794',
33        '#537bc4',
34        '#acc236',
35        '#166a8f',
36        '#00a950',
37        '#58595b',
38        '#8549ba'
39    ];
40
41    var Samples = global.Samples || (global.Samples = {});
42    var Color = global.Color;
43
44    Samples.utils = {
45        // Adapted from http://indiegamr.com/generate-repeatable-random-numbers-in-js/
46        srand: function(seed) {
47            this._seed = seed;
48        },
49
50        rand: function(min, max) {
51            var seed = this._seed;
52            min = min === undefined ? 0 : min;
53            max = max === undefined ? 1 : max;
54            this._seed = (seed * 9301 + 49297) % 233280;
55            return min + (this._seed / 233280) * (max - min);
56        },
57
58        numbers: function(config) {
59            var cfg = config || {};
60            var min = cfg.min || 0;
61            var max = cfg.max || 1;
62            var from = cfg.from || [];
63            var count = cfg.count || 8;
64            var decimals = cfg.decimals || 8;
65            var continuity = cfg.continuity || 1;
66            var dfactor = Math.pow(10, decimals) || 0;
67            var data = [];
68            var i, value;
69
70            for (i = 0; i < count; ++i) {
71                value = (from[i] || 0) + this.rand(min, max);
72                if (this.rand() <= continuity) {
73                    data.push(Math.round(dfactor * value) / dfactor);
74                } else {
75                    data.push(null);
76                }
77            }
78
79            return data;
80        },
81
82        labels: function(config) {
83            var cfg = config || {};
84            var min = cfg.min || 0;
85            var max = cfg.max || 100;
86            var count = cfg.count || 8;
87            var step = (max - min) / count;
88            var decimals = cfg.decimals || 8;
89            var dfactor = Math.pow(10, decimals) || 0;
90            var prefix = cfg.prefix || '';
91            var values = [];
92            var i;
93
94            for (i = min; i < max; i += step) {
95                values.push(prefix + Math.round(dfactor * i) / dfactor);
96            }
97
98            return values;
99        },
100
101        months: function(config) {
102            var cfg = config || {};
103            var count = cfg.count || 12;
104            var section = cfg.section;
105            var values = [];
106            var i, value;
107
108            for (i = 0; i < count; ++i) {
109                value = Months[Math.ceil(i) % 12];
110                values.push(value.substring(0, section));
111            }
112
113            return values;
114        },
115
116        color: function(index) {
117            return COLORS[index % COLORS.length];
118        },
119
120        transparentize: function(color, opacity) {
121            var alpha = opacity === undefined ? 0.5 : 1 - opacity;
122            return Color(color).alpha(alpha).rgbString();
123        }
124    };
125
126    // DEPRECATED
127    window.randomScalingFactor = function() {
128        return Math.round(Samples.utils.rand(-100, 100));
129    };
130
131    // INITIALIZATION
132
133    Samples.utils.srand(Date.now());
134
135}(this));

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.