Skip to content

Commit

Permalink
fixes missing Treemap share percentages
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Feb 27, 2019
1 parent 1bbf8a6 commit 8856046
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion app/d3plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function findColor(d) {
}

const currentYear = new Date().getFullYear();
const labelPadding = 5;

const axisStyles = {
barConfig: {
Expand Down Expand Up @@ -188,7 +189,7 @@ export default {
labelConfig: {
fontFamily: () => "Pathway Gothic One",
fontSize: () => 13,
padding: 5
padding: labelPadding
},
Line: {
curve: "monotoneX",
Expand All @@ -199,6 +200,23 @@ export default {
Path: {
fillOpacity: 0.75,
strokeOpacity: 0.25
},
Rect: {
labelBounds: (d, i, s) => {
const h = s.height;
const sh = Math.min(17, h * 0.5);
const arr = [
{width: s.width - labelPadding * 2, height: h - sh, x: -s.width / 2 + labelPadding, y: -h / 2 + labelPadding},
{width: s.width - labelPadding * 2, height: sh, x: -s.width / 2 + labelPadding, y: h / 2 - sh}
];
return arr;
},
labelConfig: {
fontFamily: () => "Pathway Gothic One",
fontSize: () => 13,
fontResize: true,
padding: 0
}
}
},
timelineConfig: {
Expand Down

0 comments on commit 8856046

Please sign in to comment.