Skip to content

Conversation

@vera-liu
Copy link
Contributor

@vera-liu vera-liu commented Oct 16, 2016

Problem:
The heatmap in V2 was shifted towards the top margin of slice
container, this was because in v2 slice name header was part of the
container body, while in v1 the header was separately defined in
explore.html template.

Solution:
To get heatmap properly shown in V2, we need to
take into account the height of the slice_name header. Adding to
margin_top will shift the plot in V1 too, but it won't make a big
difference to the look.

Ideally when we renovate slice container in future PR we would defined a
height for slice_name header and take it into account for all
visualization files.

Before (v2):
before5

After (v2):
screen shot 2016-10-15 at 10 07 30 pm

After (v1):
screen shot 2016-10-16 at 11 35 35 am

@ascott

Problem:
The heatmap in V2 was shifted towards the top margin of slice
container, this was because in v2 slice name header was part of the
container body, while in v1 the header was separately defined in
explore.html template.

Solution:
To get heatmap properly shown in V2, we need to
take into account the height of the slice_name header. Adding to
margin_top will shift the plot in V1 too, but it won't make a big
difference to the look.

Ideally when we renovate slice container in future PR we would defined a
height for slice_name header and take it into account for all
visualization files.
width: () => this.chartContainerRef.getBoundingClientRect().width,

height: () => parseInt(this.props.height, 10) - 100,
height: () => parseInt(this.props.height, 10),
Copy link
Contributor Author

@vera-liu vera-liu Oct 16, 2016

Choose a reason for hiding this comment

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

I'm not sure why we do -100 here previously, the heatmap was squashed in y direction with -100 in height.

Copy link

Choose a reason for hiding this comment

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

- 100 here was because the bottom of some charts were being cut off. probably a better way to handle this is in the margin declarations for each chart, or in the component more specifically.

can you check that the other charts are rendered correctly with this change?

@ascott
Copy link

ascott commented Oct 24, 2016

you make a good point here:

Ideally when we renovate slice container in future PR we would defined a
height for slice_name header and take it into account for all
visualization files.

can we handle this in the current <ChartContainer /> component?

@vera-liu
Copy link
Contributor Author

Instead of hardcoding a margin top size, I added header_height in margin_top for heatmap.js @ascott

function refresh() {
// Header for panel in explore v2
const header = document.getElementsByClassName('panel-title');
const headerHeight = header ? header[0].offsetHeight : 0;
Copy link

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?

@vera-liu vera-liu force-pushed the vliu_heatmap_viz_v2 branch from 3c62dd5 to 0b147f7 Compare October 25, 2016 04:16
function heatmapVis(slice) {
function refresh() {
// Header for panel in explore v2
const header = document.getElementsByClassName('panel-title');
Copy link

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?

@vera-liu vera-liu force-pushed the vliu_heatmap_viz_v2 branch from 5d78515 to 82124df Compare October 25, 2016 04:38
@vera-liu vera-liu force-pushed the vliu_heatmap_viz_v2 branch from 82124df to a62d9ad Compare October 25, 2016 04:39
@ascott
Copy link

ascott commented Oct 25, 2016

LGTM 🚢 thanks @vera-liu!

@vera-liu vera-liu merged commit 89df2fc into apache:master Oct 25, 2016
@vera-liu
Copy link
Contributor Author

Good point! Added id to the header of slice in latest commit:)

On Mon, Oct 24, 2016 at 9:32 PM, Alanna Scott [email protected]
wrote:

@ascott commented on this pull request.

In caravel/assets/visualizations/heatmap.js
#1361 (review):

@@ -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');

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


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1361 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AUAafjEY-tLU9VF1ml8O5JWrbwh5P98-ks5q3YZHgaJpZM4KYCuW
.

Best,
Vera

@vera-liu vera-liu deleted the vliu_heatmap_viz_v2 branch November 1, 2016 19:00
@dpgaspar dpgaspar mentioned this pull request Apr 30, 2020
12 tasks
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.12.0 First shipped in 0.12.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.12.0 First shipped in 0.12.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants