Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
330 changes: 330 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/padding/ctor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
<!--

@license Apache-2.0

Copyright (c) 2026 The Stdlib Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

# Padding

> [Padding][@stdlib/plot/vega/padding] constructor.

<section class="intro">

The [padding][@stdlib/plot/vega/padding] directive defines the spacing (in pixels) around the main chart group area. It determines the gap between the boundaries of the root visualization area and the inner rendering layout.

</section>

<!-- /.intro -->

<section class="usage">

## Usage

```javascript
var Padding = require( '@stdlib/plot/vega/padding/ctor' );
```

#### Padding( \[options] )

Returns a `Padding` instance.

```javascript
var padding = new Padding();
// returns <Padding>

padding = new Padding({
'left': 80,
'right': 80,
'top': 80,
'bottom': 80
});
// returns <Padding>
```

<!-- <figure class="figure" align="center" label="fig:padding" src="./docs/img/figure_padding.svg" alt="A visualization showing padding margins around the main chart area."> -->

<div class="figure" align="center" data-figure="fig:padding">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding.svg" alt="A visualization showing padding margins around the main chart area.">
<br>
</div>

<!-- </figure> -->

The `options` object has the following properties:

- **bottom**: bottom padding (in pixels). Default: `0`.
- **left**: left padding (in pixels). Default: `0`.
- **right**: right padding (in pixels). Default: `0`.
- **top**: top padding (in pixels). Default: `0`.

* * *

### Methods

<a name="method-to-json"></a>

#### Padding.prototype.toJSON()

Serializes an instance to a JSON representation.

```javascript
var padding = new Padding({
'left': 80,
'right': 80,
'top': 80,
'bottom': 80
});

var json = padding.toJSON();
// returns { 'left': 80, 'right': 80, 'top': 80, 'bottom': 80 }
```

This method is implicitly invoked by `JSON.stringify`.

* * *

### Writable Properties

<a name="prop-top"></a>

#### Padding.prototype.top

Top padding (in pixels).

```javascript
var padding = new Padding({
'left': 80,
'right': 80,
'top': 0,
'bottom': 80
});

var v = padding.top;
// returns 0

padding.top = 100;

v = padding.top;
// returns 100
```

<!-- <figure class="figure" align="center" label="fig:padding_top_0" src="./docs/img/figure_padding_top_0.svg" alt="Padding with top set to 0."> -->

<div class="figure" align="center" data-figure="fig:padding_top_0">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_0.svg" alt="Padding with top set to 0.">
<br>
</div>

<!-- </figure> -->

<!-- <figure class="figure" align="center" label="fig:padding_top_100" src="./docs/img/figure_padding_top_100.svg" alt="Padding with top set to 100."> -->

<div class="figure" align="center" data-figure="fig:padding_top_100">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_top_100.svg" alt="Padding with top set to 100.">
<br>
</div>

<!-- </figure> -->

<a name="prop-bottom"></a>

#### Padding.prototype.bottom

Bottom padding (in pixels).

```javascript
var padding = new Padding({
'left': 80,
'right': 80,
'top': 80,
'bottom': 0
});

var v = padding.bottom;
// returns 0

padding.bottom = 100;

v = padding.bottom;
// returns 100
```

<!-- <figure class="figure" align="center" label="fig:padding_bottom_0" src="./docs/img/figure_padding_bottom_0.svg" alt="Padding with bottom set to 0."> -->

<div class="figure" align="center" data-figure="fig:padding_bottom_0">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_0.svg" alt="Padding with bottom set to 0.">
<br>
</div>

<!-- </figure> -->

<!-- <figure class="figure" align="center" label="fig:padding_bottom_100" src="./docs/img/figure_padding_bottom_100.svg" alt="Padding with bottom set to 100."> -->

<div class="figure" align="center" data-figure="fig:padding_bottom_100">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_bottom_100.svg" alt="Padding with bottom set to 100.">
<br>
</div>

<!-- </figure> -->

<a name="prop-left"></a>

#### Padding.prototype.left

Left padding (in pixels).

```javascript
var padding = new Padding({
'left': 0,
'right': 80,
'top': 80,
'bottom': 80
});

var v = padding.left;
// returns 0

padding.left = 130;

v = padding.left;
// returns 130
```

<!-- <figure class="figure" align="center" label="fig:padding_left_0" src="./docs/img/figure_padding_left_0.svg" alt="Padding with left set to 0."> -->

<div class="figure" align="center" data-figure="fig:padding_left_0">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_0.svg" alt="Padding with left set to 0.">
<br>
</div>

<!-- </figure> -->

<!-- <figure class="figure" align="center" label="fig:padding_left_130" src="./docs/img/figure_padding_left_130.svg" alt="Padding with left set to 130."> -->

<div class="figure" align="center" data-figure="fig:padding_left_130">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_left_130.svg" alt="Padding with left set to 130.">
<br>
</div>

<!-- </figure> -->

<a name="prop-right"></a>

#### Padding.prototype.right

Right padding (in pixels).

```javascript
var padding = new Padding({
'left': 80,
'right': 0,
'top': 80,
'bottom': 80
});

var v = padding.right;
// returns 0

padding.right = 130;

v = padding.right;
// returns 130
```

<!-- <figure class="figure" align="center" label="fig:padding_right_0" src="./docs/img/figure_padding_right_0.svg" alt="Padding with right set to 0."> -->

<div class="figure" align="center" data-figure="fig:padding_right_0">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_0.svg" alt="Padding with right set to 0.">
<br>
</div>

<!-- </figure> -->

<!-- <figure class="figure" align="center" label="fig:padding_right_130" src="./docs/img/figure_padding_right_130.svg" alt="Padding with right set to 130."> -->

<div class="figure" align="center" data-figure="fig:padding_right_130">
<img src="https://cdn.jsdelivr.net/gh/gururaj1512/stdlib@eb64ecc323cbaabf1a0191aea50fcb6ab65e750e/lib/node_modules/@stdlib/plot/vega/padding/ctor/docs/img/figure_padding_right_130.svg" alt="Padding with right set to 130.">
<br>
</div>

<!-- </figure> -->

* * *

### Read-Only Properties

<a name="prop-properties"></a>

#### Padding.prototype.properties

An array of Padding property names.

```javascript
var padding = new Padding();

var props = padding.properties;
// returns [ 'bottom', 'left', 'right', 'top' ]
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

```javascript
var Padding = require( '@stdlib/plot/vega/padding/ctor' );

var padding = new Padding();
console.log( padding.toJSON() );
```

</section>

<!-- /.examples -->

<section class="references">

</section>

<!-- /.references -->

<section class="related">

## See Also

- <span class="package-name">[`@stdlib/plot/vega/builder`][@stdlib/plot/vega/builder]</span><span class="delimiter">: </span><span class="description">Vega visualization builder.</span>

</section>

<!-- /.related -->

<section class="links">

[@stdlib/plot/vega/builder]: https://github.com/stdlib-js/stdlib/tree/refactor/plot/lib/node_modules/%40stdlib/plot/vega/builder

[@stdlib/plot/vega/padding]: https://github.com/stdlib-js/stdlib/tree/refactor/plot/lib/node_modules/%40stdlib/plot/vega/padding/ctor

<!-- <related-links> -->

<!-- </related-links> -->

</section>

<!-- /.links -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading