UNPKG

@data-ui/xy-chart

Version:

A package of charts with standard x- and y- axes. https://williaster.github.io/data-ui

22 lines (16 loc) 851 B
"use strict"; exports.__esModule = true; exports.default = getChartDimensions; var _chartUtils = require("./chartUtils"); function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function getChartDimensions(_ref) { var margin = _ref.margin, width = _ref.width, height = _ref.height; var completeMargin = _extends({}, _chartUtils.DEFAULT_CHART_MARGIN, margin); return { margin: completeMargin, innerHeight: Math.max(0, height - completeMargin.top - completeMargin.bottom), innerWidth: Math.max(0, width - completeMargin.left - completeMargin.right) }; }