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

Improve the calendar heatmap #4800

Merged
merged 4 commits into from
Apr 13, 2018
Merged

Conversation

mistercrunch
Copy link
Member

  • Improve xAxis ticks, thinner bottom margin
  • Moving utils folder

screen shot 2018-04-10 at 2 19 20 pm

@mistercrunch mistercrunch changed the title Improve xAxis ticks, thinner bottom margin (#4756) Improve the calendar heatmap Apr 10, 2018
@mistercrunch mistercrunch force-pushed the cal_heatmap branch 2 times, most recently from abd4a34 to 43938a2 Compare April 11, 2018 03:47
@codecov-io
Copy link

codecov-io commented Apr 11, 2018

Codecov Report

Merging #4800 into master will increase coverage by 5.62%.
The diff coverage is 41.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4800      +/-   ##
==========================================
+ Coverage   66.69%   72.31%   +5.62%     
==========================================
  Files         164      208      +44     
  Lines        7076    15547    +8471     
  Branches     1203     1204       +1     
==========================================
+ Hits         4719    11243    +6524     
- Misses       2354     4301    +1947     
  Partials        3        3
Impacted Files Coverage Δ
superset/assets/javascripts/modules/colors.js 77.08% <ø> (ø) ⬆️
...rset/assets/javascripts/explore/stores/visTypes.js 70.58% <ø> (ø) ⬆️
...set/assets/javascripts/explore/stores/controls.jsx 38.88% <ø> (ø) ⬆️
superset/viz.py 78.5% <40%> (ø)
superset/assets/javascripts/chart/Chart.jsx 65% <50%> (-0.26%) ⬇️
superset/data/__init__.py 100% <0%> (ø)
superset/models/core.py 86.49% <0%> (ø)
superset/__init__.py 72.07% <0%> (ø)
superset/models/sql_lab.py 98.59% <0%> (ø)
superset/connectors/druid/__init__.py 100% <0%> (ø)
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b043590...b85b5ef. Read the comment docs.

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Love this!

'#80cdc1',
'#018571',
],
purple_white_green: [
Copy link
Member

Choose a reason for hiding this comment

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

I've seen some functions in Python (matplotlib perhaps?) where you can interpolate between colors. It would be cool to have something similar here, if it exists in Javascript (something like this). Imagine:

const brown = '#a6611a';
const white = '#f5f5f5';
const green = '#018571';
...
const brown_white_green: interpolate([brown, white, green], 5),
...

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what is happening here. Code in colors.js uses d3 scalers to do this given these objects.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, #TIL.

isInt: true,
validators: [v.integer],
renderTrigger: true,
default: 2,
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I'd leave this at zero — the round borders look really ugly to me, unless they're full circles. Maybe someone with a better design eye than me can comment on this.

Copy link
Member Author

@mistercrunch mistercrunch Apr 12, 2018

Choose a reason for hiding this comment

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

Agreed, I set cell_radius to 0 just now. This is cell_padding though, think I should set this to 0 as well? There's this annoying ghost black spots that happens in the corners 👻
ghost

Copy link
Member

Choose a reason for hiding this comment

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

Argh, the black spots keep moving! :-P

I think if we reduce to a small value they should go away, no? If not, I'm fine with 0.

Copy link
Member Author

Choose a reason for hiding this comment

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

0 will remove them, changing now

const step = (extents[1] - extents[0]) / (steps - 1);
const colorScale = colorScalerFactory(fd.linear_color_scheme, null, null, extents);

const legend = _.range(steps).map(i => extents[0] + (step * i));
Copy link
Member

Choose a reason for hiding this comment

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

This is more a general comment about our dependencies... some files use jquery, others use underscore. D3 provides a range function, maybe we could use it here and get rid of the underscore dependency at least in this file?

I did that in the multi line viz that I'm working on. I noticed that on the multi deck.gl viz we're using jquery for async requests, but we can use d3.json instead, and get rid of the jquery dependency in those files.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh nice, didn't know d3 had a range function. Definitely should limit the deps in the visualizations as we'll likely break them off as different bundles.

try:
params = json.loads(slc.params or '{}')
params['metrics'] = [params.get('metric')]
del params['metric']
Copy link
Member

Choose a reason for hiding this comment

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

Nitty-nit, you can do this in one line:

params['metrics'] = [params.pop('metric')]

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice. I should have thought of that. Though now without a downgrade script I'd rather just not touch it as I should probably re-test it after changing the code. Will leave as is. BTW I think our linter isn't setup to check migrations scripts, we should probably change that.

@mistercrunch mistercrunch merged commit 6fd4ff4 into apache:master Apr 13, 2018
@mistercrunch mistercrunch deleted the cal_heatmap branch April 13, 2018 00:16
@@ -0,0 +1,22 @@
"""empty message
Copy link
Member

Choose a reason for hiding this comment

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

@mistercrunch was this file accidentally added?

michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
* Improve xAxis ticks, thinner bottom margin (apache#4756)

* Improve xAxis ticks, thinner bottom margin

* Moving utils folder

* Add isTruthy

* Addressing comments

* Set cell_padding to 0

* merging db migrations
timifasubaa pushed a commit to timifasubaa/incubator-superset that referenced this pull request May 31, 2018
* Improve xAxis ticks, thinner bottom margin (apache#4756)

* Improve xAxis ticks, thinner bottom margin

* Moving utils folder

* Add isTruthy

* Addressing comments

* Set cell_padding to 0

* merging db migrations
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* Improve xAxis ticks, thinner bottom margin (apache#4756)

* Improve xAxis ticks, thinner bottom margin

* Moving utils folder

* Add isTruthy

* Addressing comments

* Set cell_padding to 0

* merging db migrations
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.25.0 labels Feb 27, 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.25.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants