Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted top margin of heatmap plot to get it working in V2 #1361

Merged
merged 5 commits into from
Oct 25, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion caravel/assets/visualizations/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ require('./heatmap.css');
// https://jsfiddle.net/cyril123/h0reyumq/
function heatmapVis(slice) {
function refresh() {
// Header for panel in explore v2
const header = document.getElementsByClassName('panel-title');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry one more comment, are we sure there will only be one panel-title class on the page? will it be the first one?

const headerHeight = header ? header[0].offsetHeight : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would use getBoundingClientRect here, it has better browser support compared to offsetHeight
https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight

can you confirm that this change doesn't affect the current explore view too much?

const margin = {
top: 10,
top: 20 + headerHeight,
right: 10,
bottom: 35,
left: 35,
Expand Down