File tree Expand file tree Collapse file tree 26 files changed +1432
-0
lines changed
lib/node_modules/@stdlib/plot/charts/base/ctor Expand file tree Collapse file tree 26 files changed +1432
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ 'use strict' ;
20
+
21
+ var Chart = require ( './../lib' ) ;
22
+
23
+ var chart = new Chart ( {
24
+ 'title' : 'Hello World!'
25
+ } ) ;
26
+ console . log ( chart . toJSON ( ) ) ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable no-invalid-this */
20
+
21
+ 'use strict' ;
22
+
23
+ // MAIN //
24
+
25
+ /**
26
+ * Returns the autosize configuration.
27
+ *
28
+ * @private
29
+ * @returns {Autosize } autosize configuration
30
+ */
31
+ function get ( ) {
32
+ return this . config . autosize ;
33
+ }
34
+
35
+
36
+ // EXPORTS //
37
+
38
+ module . exports = get ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable no-invalid-this */
20
+
21
+ 'use strict' ;
22
+
23
+ // MODULES //
24
+
25
+ var Autosize = require ( '@stdlib/plot/vega/autosize' ) ;
26
+
27
+
28
+ // MAIN //
29
+
30
+ /**
31
+ * Sets the autosize configuration.
32
+ *
33
+ * @private
34
+ * @param {(Object|Autosize) } value - input value
35
+ * @throws {TypeError } must be a valid configuration
36
+ * @returns {void }
37
+ */
38
+ function set ( value ) {
39
+ if ( ! ( value instanceof Autosize ) ) {
40
+ value = new Autosize ( value ) ; // note: this accounts for both vanilla objects and cross-realm instances
41
+ }
42
+ this . config . autosize = value ;
43
+ }
44
+
45
+
46
+ // EXPORTS //
47
+
48
+ module . exports = set ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable no-invalid-this */
20
+
21
+ 'use strict' ;
22
+
23
+ // MAIN //
24
+
25
+ /**
26
+ * Returns the chart background color.
27
+ *
28
+ * @private
29
+ * @returns {string } color
30
+ */
31
+ function get ( ) {
32
+ return this . config . background ;
33
+ }
34
+
35
+
36
+ // EXPORTS //
37
+
38
+ module . exports = get ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable no-invalid-this */
20
+
21
+ 'use strict' ;
22
+
23
+ // MAIN //
24
+
25
+ /**
26
+ * Sets the chart background color.
27
+ *
28
+ * @private
29
+ * @param {string } value - input value
30
+ * @throws {TypeError } must be a string
31
+ * @returns {void }
32
+ */
33
+ function set ( value ) {
34
+ this . config . background = value ;
35
+ }
36
+
37
+
38
+ // EXPORTS //
39
+
40
+ module . exports = set ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ 'use strict' ;
20
+
21
+ // MODULES //
22
+
23
+ var isNodeREPL = require ( '@stdlib/assert/is-node-repl' ) ;
24
+ var Autosize = require ( '@stdlib/plot/vega/autosize' ) ;
25
+
26
+
27
+ // MAIN //
28
+
29
+ /**
30
+ * Returns defaults.
31
+ *
32
+ * @private
33
+ * @returns {Object } defaults
34
+ *
35
+ * @example
36
+ * var obj = defaults();
37
+ * // returns {...}
38
+ */
39
+ function defaults ( ) {
40
+ var isREPL = isNodeREPL ( ) ;
41
+ return {
42
+ // Autosize configuration:
43
+ 'autosize' : new Autosize ( {
44
+ 'type' : 'none' ,
45
+ 'contains' : 'padding'
46
+ } ) ,
47
+
48
+ // Height (in pixels):
49
+ 'height' : 400 ,
50
+
51
+ // Chart viewer:
52
+ 'viewer' : ( isREPL ) ? 'window' : 'stdout' ,
53
+
54
+ // Width (in pixels):
55
+ 'width' : 400
56
+ } ;
57
+ }
58
+
59
+
60
+ // EXPORTS //
61
+
62
+ module . exports = defaults ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable no-invalid-this */
20
+
21
+ 'use strict' ;
22
+
23
+ // MAIN //
24
+
25
+ /**
26
+ * Returns the chart description.
27
+ *
28
+ * @private
29
+ * @returns {string } description
30
+ */
31
+ function get ( ) {
32
+ return this . config . description ;
33
+ }
34
+
35
+
36
+ // EXPORTS //
37
+
38
+ module . exports = get ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable no-invalid-this */
20
+
21
+ 'use strict' ;
22
+
23
+ // MAIN //
24
+
25
+ /**
26
+ * Sets the chart description.
27
+ *
28
+ * @private
29
+ * @param {string } value - input value
30
+ * @throws {TypeError } must be a string
31
+ * @returns {void }
32
+ */
33
+ function set ( value ) {
34
+ this . config . description = value ;
35
+ }
36
+
37
+
38
+ // EXPORTS //
39
+
40
+ module . exports = set ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable no-invalid-this */
20
+
21
+ 'use strict' ;
22
+
23
+ // MAIN //
24
+
25
+ /**
26
+ * Returns the chart height (in pixels).
27
+ *
28
+ * @private
29
+ * @returns {NonNegativeNumber } height
30
+ */
31
+ function get ( ) {
32
+ return this . config . height ;
33
+ }
34
+
35
+
36
+ // EXPORTS //
37
+
38
+ module . exports = get ;
You can’t perform that action at this time.
0 commit comments