Skip to content

Commit c71c9a1

Browse files
committed
Add yRange property
1 parent f75d25a commit c71c9a1

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

lib/node_modules/@stdlib/plot/hist/lib/main.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,28 @@ Object.defineProperty( Histogram.prototype, 'yPos', {
11471147
'get': require( './props/y-pos/get.js' )
11481148
});
11491149

1150+
/**
1151+
* y-axis range.
1152+
*
1153+
* @name yRange
1154+
* @memberof Histogram.prototype
1155+
* @type {NumberArray}
1156+
*
1157+
* @example
1158+
* var hist = new Histogram({
1159+
* 'height': 100,
1160+
* 'paddingTop': 10,
1161+
* 'paddingBottom': 20
1162+
* });
1163+
* var range = hist.yRange;
1164+
* // returns [ 70, 0 ]
1165+
*/
1166+
Object.defineProperty( Histogram.prototype, 'yRange', {
1167+
'configurable': false,
1168+
'enumerable': true,
1169+
'get': require( './props/y-range/get.js' )
1170+
});
1171+
11501172
/**
11511173
* Generates a histogram view.
11521174
*
Lines changed: 35 additions & 0 deletions
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 y-axis range.
23+
*
24+
* @private
25+
* @returns {NumberArray} range
26+
*/
27+
function get() {
28+
/* eslint-disable no-invalid-this */
29+
return [ this.graphHeight, 0 ];
30+
}
31+
32+
33+
// EXPORTS //
34+
35+
module.exports = get;

0 commit comments

Comments
 (0)