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
266 changes: 266 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,266 @@
<!--

@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 constructor.

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<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>
```

The constructor accepts the following `options`:

- **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`.

```javascript
var padding = new Padding({
'bottom': 10,
'left': 20,
'right': 30,
'top': 40
});
// returns <Padding>

var v = padding.top;
// returns 40
```

* * *

### Writable Properties

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

#### Padding.prototype.bottom

Bottom padding (in pixels). Default: `0`.

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

// Set:
padding.bottom = 10;

// Get:
var v = padding.bottom;
// returns 10
```

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

#### Padding.prototype.left

Left padding (in pixels). Default: `0`.

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

// Set:
padding.left = 10;

// Get:
var v = padding.left;
// returns 10
```

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

#### Padding.prototype.right

Right padding (in pixels). Default: `0`.

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

// Set:
padding.right = 10;

// Get:
var v = padding.right;
// returns 10
```

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

#### Padding.prototype.top

Top padding (in pixels). Default: `0`.

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

// Set:
padding.top = 10;

// Get:
var v = padding.top;
// returns 10
```

* * *

### Read-only Properties

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

#### Padding.prototype.properties

List of enumerable properties.

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

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

* * *

### Methods

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

#### Padding.prototype.toJSON()

Serializes a padding instance to a JSON object.

```javascript
var padding = new Padding({
'top': 10
});

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

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

```javascript
var padding = new Padding({
'top': 10
});

var str = JSON.stringify( padding );
// returns '{"bottom":0,"left":0,"right":0,"top":10}'
```

* * *

### Events

#### 'change'

Emitted whenever a property value changes.

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

padding.on( 'change', onChange );

padding.top = 10;

function onChange( event ) {
console.log( 'Updated property: %s', event.property );
}
```

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

* * *

## Examples

<!-- eslint no-undef: "error" -->

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

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

</section>

<!-- /.examples -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

</section>

<!-- /.links -->
Loading
Loading