All files / plot/ctor/lib defaults.js

20.41% Statements 39/191
100% Branches 1/1
0% Functions 0/1
20.41% Lines 39/191

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 1921x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                                                                                                                                                                                                                                                                                                                 1x 1x 1x 1x 1x  
/**
* @license Apache-2.0
*
* Copyright (c) 2018 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.
*/
 
'use strict';
 
// MODULES //
 
var isNodeREPL = require( '@stdlib/assert/is-node-repl' );
var isDefined = require( './accessors/is_defined.js' );
 
 
// MAIN //
 
/**
* Returns default options.
*
* @private
* @returns {Object} default options
*/
function defaults() {
	var isREPL;
	var o;

	isREPL = isNodeREPL();
	o = {};

	// Boolean indicating whether to re-render on a change event:
	o.autoRender = false;

	// Boolean indicating whether to generate an updated view on a render event:
	o.autoView = false;

	// Data colors:
	o.colors = 'category10';

	// Plot description:
	o.description = '';

	// Plot engine:
	o.engine = 'svg';

	// Plot height:
	o.height = 400; // px

	// Accessor indicating whether a datum is defined:
	o.isDefined = isDefined;

	// Data labels:
	o.labels = [];

	// Data line opacity:
	o.lineOpacity = 0.9; // [0,1]

	// Data line style(s):
	o.lineStyle = '-';

	// Data line width(s):
	o.lineWidth = 2; // px

	// FIXME: padding props depend on orientation (may require using `null` to flag)

	// Bottom padding:
	o.paddingBottom = 80; // px

	// Left padding:
	o.paddingLeft = 90; // px

	// Right padding:
	o.paddingRight = 20; // px

	// Top padding:
	o.paddingTop = 80; // px

	// Render format:
	o.renderFormat = 'vdom';

	// Data symbols:
	o.symbols = 'none';

	// Symbols opacity:
	o.symbolsOpacity = 0.9; // [0,1]

	// Symbols size:
	o.symbolsSize = 6; // px

	// Plot title:
	o.title = '';

	// Plot viewer:
	if ( isREPL ) {
		o.viewer = 'window';
	} else {
		o.viewer = 'none';
	}
	// Plot width:
	o.width = 400; // px

	// x-values:
	o.x = [];

	// x-axis orientation:
	o.xAxisOrient = 'bottom';

	// x-axis label:
	o.xLabel = 'x';

	// Maximum value of x-axis domain:
	o.xMax = null;

	// Minimum value of x-axis domain:
	o.xMin = null;

	// Number of x-axis tick marks:
	o.xNumTicks = 5;

	// Boolean indicating whether to render a rug plot along the x-axis:
	o.xRug = false;

	// x-axis rug orientation:
	o.xRugOrient = 'bottom';

	// x-axis rug opacity:
	o.xRugOpacity = 0.1; // [0,1]

	// x-axis rug tick (tassel) size:
	o.xRugSize = 6; // px

	// x-axis scale:
	o.xScale = 'linear';

	// x-axis tick format:
	o.xTickFormat = null;

	// y-values:
	o.y = [];

	// y-axis orientation:
	o.yAxisOrient = 'left';

	// y-axis label:
	o.yLabel = 'y';

	// Maximum value of y-axis domain:
	o.yMax = null;

	// Minimum value of y-axis domain:
	o.yMin = null;

	// Number of y-axis tick marks:
	o.yNumTicks = 5;

	// Boolean indicating whether to render a rug plot along the y-axis:
	o.yRug = false;

	// y-axis rug orientation:
	o.yRugOrient = 'left';

	// y-axis rug opacity:
	o.yRugOpacity = 0.1; // [0,1]

	// y-axis rug tick (tassel) size:
	o.yRugSize = 6; // px

	// y-axis scale:
	o.yScale = 'linear';

	// y-axis tick format:
	o.yTickFormat = null;

	return o;
}
 
 
// EXPORTS //
 
module.exports = defaults;