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

Set tooltip to show extent of sparkData #3626

Merged

Conversation

michellethomas
Copy link
Contributor

On the tooltip for sparklines in the time table viz we are showing the max and min of the underlying data instead of the data being returned in the chart. So when the user selects a period ratio we are not showing the max and min for the ratio. Updating to calculate the extent on sparkData.

Also, for period ratios the numbers are often long decimals so I rounded them, but not sure how you feel about this, users may want to see more of the ratio.

@coveralls
Copy link

coveralls commented Oct 9, 2017

Coverage Status

Coverage remained the same at 70.065% when pulling a63e5c4 on michellethomas:fix_time_table_spark_tooltip into 64ef8b1 on apache:master.

@michellethomas
Copy link
Contributor Author

@mistercrunch can you take a look?

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

Let's use user-defined formatting instead of rounding

@@ -70,10 +70,10 @@ function viz(slice, payload) {
// Period ratio sparkline
sparkData = [];
for (let i = c.timeRatio; i < data.length; i++) {
sparkData.push(data[i][metric] / data[i - c.timeRatio][metric]);
sparkData.push(d3.round(data[i][metric] / data[i - c.timeRatio][metric], 2));
Copy link
Member

Choose a reason for hiding this comment

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

I feel like we shouldn't round here, instead change the number formatting when assembling the tooltip

}
}
const extent = d3.extent(data, d => d[metric]);
const extent = d3.extent(sparkData);
Copy link
Member

Choose a reason for hiding this comment

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

The line bellow is where we should do the appropriate formatting. The column form for the sparkline already has d3format, it's just a matter of using that configuration here. Right now it's unused but it was there originally for point labels which I then took out because they required large margins. If we ever bring back point labels we'd use the same formatting for both the tooltips and that.

@coveralls
Copy link

coveralls commented Oct 10, 2017

Coverage Status

Coverage increased (+0.004%) to 70.07% when pulling bf3f50c on michellethomas:fix_time_table_spark_tooltip into 64ef8b1 on apache:master.

@mistercrunch mistercrunch merged commit 80eb9c2 into apache:master Oct 10, 2017
eddy-geek added a commit to eddy-geek/incubator-superset that referenced this pull request Oct 15, 2017
…t_box

* remotes/origin/master: (340 commits)
  [New Viz] Partition Diagram (apache#3642)
  Add description for running specific test (apache#3665)
  Making the sort order for metrics pull from fd for time table viz (apache#3661)
  Make columns that return an exception on click unsortable. (apache#3417)
  Adding sort time table (apache#3651)
  added aihello as superset user. (apache#3647)
  Fix apache#3612 - reverse sign in difference calculation (apache#3646)
  Fixing some warnings during tests (apache#3648)
  [Translations] Restored lost French translations (apache#3645)
  [sql lab] fix impersonation + template issue (apache#3644)
  Pin moment.js library since 2.19.0 creates problem (apache#3641)
  [time_table] adding support for URLs / links (apache#3600)
  Set tooltip to show extent of sparkData (apache#3626)
  add explicit message display for 'Fetching Annotation Layer' error (apache#3631)
  [bugfix] Template rendering failed: '_AppCtxGlobals' object has no attribute 'user' (apache#3637)
  fix long title text wrapping in editable-title component (apache#3638)
  [minor] proper tooltip on ControlHeader's instant re-render trigger (apache#3625)
  add annotation option and a linear color map for heatmap viz. (apache#3634)
  [bugfix] empty From date filter NoneType error (apache#3633)
  remove unused imports (apache#3621)
  ...
michellethomas added a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
* Set tooltip to show extent of sparkData

* Using d3format instead of round
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.20.4 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.20.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants