Skip to content

Commit

Permalink
Centered padding for D3FC heatmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed May 26, 2019
1 parent 1a1e02c commit 3e5f5f1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
8 changes: 1 addition & 7 deletions docs/static/js/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ styleElement.innerText = `
box-shadow: none !important;
overflow: visible !important;
--plugin--box-shadow: 0 5px 5px rgba(0,0,0,0.2);
--d3fc-gradient-full: linear-gradient(#4d342f 0%, #e4521b 22.5%, #feeb65 42.5%, #f0f0f0 50%, #dcedc8 57.5%, #42b3d5 67.5%, #1a237e 100%) !important;
--d3fc-gradient-positive: linear-gradient(#222222 0%, #1a237e 35%, #42b3d5 70%, #dcedc8 100%) !important;
--d3fc-gradient-negative: linear-gradient(#feeb65 0%, #e4521b 35%, #4d342f 70%, #222222 100%) !important;
--highcharts-heatmap-gradient-full: linear-gradient(#feeb65 0%, #e4521b 22.5%, #4d342f 42.5%, #222222 50%, #1a237e 57.5%, #42b3d5 67.5%, #dcedc8 100%) !important;
--highcharts-heatmap-gradient-positive: linear-gradient(#222222 0%, #1a237e 35%, #42b3d5 70%, #dcedc8 100%) !important;
--highcharts-heatmap-gradient-negative: linear-gradient(#feeb65 0%, #e4521b 35%, #4d342f 70%, #222222 100%) !important;
}`;

document.head.appendChild(styleElement);
Expand Down Expand Up @@ -100,7 +94,7 @@ function select(id) {
"row-pivots": ["name", "client"],
"column-pivots": [],
columns: ["bid", "chg"],
aggregates: {bid: "avg", chg: "low", name: "last"},
aggregates: {bid: "sum", chg: "low", name: "last"},
sort: [["name", "desc"], ["chg", "desc"]]
},
"#enhance": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
import * as d3 from "d3";

export default (width, height) => {
const padding = 30;
const treemapLayout = d3
.treemap()
.size([width - padding, height - padding])
.size([width, height])
.paddingInner(d => 1 + 2 * d.height);

treemapLayout.tile(d3.treemapBinary);
Expand Down
7 changes: 3 additions & 4 deletions packages/perspective-viewer-d3fc/src/less/chart.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
overflow: hidden;

&.d3_heatmap {
padding-right: 105px;
padding-right: 120px;
}

&.d3_sunburst {
Expand Down Expand Up @@ -64,8 +64,7 @@
}

&.d3_treemap {
padding: 0;
padding-right: 105px;
padding-right: 120px;

& .treemap-container {
position: relative;
Expand All @@ -90,7 +89,7 @@
}

& .treerect {
stroke: var(--d3fc-axis--lines, white);
stroke: var(--d3fc-treedata-axis--lines, var(--d3fc-axis--lines, white));
fill: var(--d3fc-series, rgba(31, 119, 180, 0.5));
&:hover {
cursor: pointer;
Expand Down
2 changes: 2 additions & 0 deletions packages/perspective-viewer/src/themes/material.less
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,6 @@ perspective-viewer {
--hypergrid-header--font-size: 12px;
--hypergrid--font-family: "Open Sans";
--hypergrid-header--font-family: "Open Sans";

--d3fc-treedata-axis--lines: none;
}

0 comments on commit 3e5f5f1

Please sign in to comment.