Skip to content

Commit 6c9a54d

Browse files
committed
Add xScale property
1 parent 8f53a04 commit 6c9a54d

File tree

3 files changed

+95
-1
lines changed
  • lib/node_modules/@stdlib/plot/components/svg/rects/lib/props

3 files changed

+95
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2018 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+
/**
22+
* Returns the x-scale function.
23+
*
24+
* @private
25+
* @returns {Function} scale function
26+
*/
27+
function get() {
28+
/* eslint-disable no-invalid-this */
29+
return this._xScale;
30+
}
31+
32+
33+
// EXPORTS //
34+
35+
module.exports = get;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2018 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 logger = require( 'debug' );
24+
var isFunction = require( '@stdlib/assert/is-function' );
25+
26+
27+
// VARIABLES //
28+
29+
var debug = logger( 'rects:set:xscale' );
30+
31+
32+
// MAIN //
33+
34+
/**
35+
* Sets the x-scale function.
36+
*
37+
* @private
38+
* @param {Function} fcn - scale
39+
* @throws {TypeError} must be a function
40+
*/
41+
function set( fcn ) {
42+
/* eslint-disable no-invalid-this */
43+
if ( !isFunction( fcn ) ) {
44+
throw new TypeError( 'invalid value. `xScale` must be a function. Value: `' + fcn + '.`' );
45+
}
46+
if ( fcn !== this._xScale ) {
47+
debug( 'Current value: %s.', this._xScale );
48+
49+
this._xScale = fcn;
50+
debug( 'New Value: %s.', this._xScale );
51+
52+
this.emit( 'change' );
53+
}
54+
}
55+
56+
57+
// EXPORTS //
58+
59+
module.exports = set;

lib/node_modules/@stdlib/plot/components/svg/rects/lib/props/y-pos/get.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var logger = require( 'debug' );
2525

2626
// VARIABLES //
2727

28-
var debug = logger( 'rects:ypos' );
28+
var debug = logger( 'rects:y-pos' );
2929

3030

3131
// MAIN //

0 commit comments

Comments
 (0)