Skip to content

Commit

Permalink
Add margin prop
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Aug 23, 2018
1 parent 8e84276 commit fe5cf6d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions superset/assets/src/visualizations/treemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,24 @@ const propTypes = {
data: PropTypes.arrayOf(nodeType),
width: PropTypes.number,
height: PropTypes.number,
numberFormat: PropTypes.string,
colorScheme: PropTypes.string,
margin: PropTypes.shape({
top: PropTypes.number,
right: PropTypes.number,
bottom: PropTypes.number,
left: PropTypes.number,
}),
numberFormat: PropTypes.string,
treemapRatio: PropTypes.number,
};

const DEFAULT_MARGIN = {
top: 0,
right: 0,
bottom: 0,
left: 0,
};

/* Modified from http://bl.ocks.org/ganeshv/6a8e9ada3ab7f2d88022 */
function treemap(element, props) {
PropTypes.checkPropTypes(propTypes, props, 'prop', 'Treemap');
Expand All @@ -43,6 +56,7 @@ function treemap(element, props) {
data,
width,
height,
margin = DEFAULT_MARGIN,
numberFormat,
colorScheme,
treemapRatio,
Expand All @@ -51,12 +65,6 @@ function treemap(element, props) {
const formatNumber = d3.format(numberFormat);

function draw(data, eltWidth, eltHeight) {
const margin = {
top: 0,
right: 0,
bottom: 0,
left: 0,
};
const navBarHeight = 36;
const navBarTitleSize = navBarHeight / 3;
const navBarBuffer = 10;
Expand Down

0 comments on commit fe5cf6d

Please sign in to comment.