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

Proposal only! Fix voronoi tooltips to show all siblings for duplicates #798

Closed
wants to merge 5 commits into from

Conversation

portante
Copy link
Contributor

This is a proposal for a fix. It solves the voronoi problem of duplicate points by eliminating them, but saving the duplicates as siblings that are also displayed in the tooltip. This should solve problems like #330 once and for all.

For now, we only do that for lineCharts.

Please ignore the two debugging commits, and the base change to lines.js.

When using voronoi points for tooltips on any chart relying on a scatter
chart underneath, collapse points to unique values that D3 accepts
(basically, points are considered duplicates with 1e-6 of each other).
But instead of hiding the values considered duplicates, show them all in
the same toolip.

FIXME: this is only implemented for lineChart, still need to amend this
commit with changes to the others that use scatter underneath.
@portante
Copy link
Contributor Author

@liquidpele, @robinfhu, what do you guys think?

Perhaps too much mechanism?

@portante portante added the Fix label Feb 17, 2015
@portante portante self-assigned this Feb 17, 2015
@@ -54,6 +54,13 @@ nv.models.lineChart = function() {
y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
content = tooltip(e.series.key, x, y, e, chart);

if (e.sibs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rename it e.siblings

@robinfhu
Copy link
Contributor

One thing I like is that this didn't really add much code, it was more of a refactor. The change should be transparent to end users...most people shouldn't notice any differences. The difference is that there is now a 'siblings' data property available for the tooltips.

This should be tested pretty thoroughly too.

Nice work.

@@ -54,6 +54,13 @@ nv.models.lineChart = function() {
y = yAxis.tickFormat()(lines.y()(e.point, e.pointIndex)),
content = tooltip(e.series.key, x, y, e, chart);

if (e.sibs) {
for (var i = 0; i < e.sibs.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good place to use "for in" instead of having to use the length property, this also makes it able to handle objects if you wanted to switch to that later.

@liquidpele
Copy link
Contributor

So from what I can tell, it looks like the issue this solves is that the tooltips would only return data about a single point if there were multiple points in the same location?

@robinfhu
Copy link
Contributor

This PR still looks incomplete, is it in progress?

@portante
Copy link
Contributor Author

@robinfhu, yes, just behind on a number of other things at work.

@portante
Copy link
Contributor Author

portante commented Apr 8, 2015

@robinfhu, @liquidpele, just getting back to this, probably too late for 1.8.1.

portante added a commit to portante/pbench that referenced this pull request Dec 11, 2015
Instead of just eliminating points, calculate a full set of statistics
for each series, and then sort them by their average values, picking the
top 20. We stop considering any series for the graph once we find one
whose average is less than the threshold.

We also stop using the Voronoi objects for tool tips since NVD3 has a
bug which causes an exception in D3 (see:
novus/nvd3#798).

Change-Id: I8f232bdd7f8024706220c9fa87fa460ab61209e8
ndokos pushed a commit to ndokos/pbench that referenced this pull request Dec 11, 2015
Instead of just eliminating points, calculate a full set of statistics
for each series, and then sort them by their average values, picking the
top 20. We stop considering any series for the graph once we find one
whose average is less than the threshold.

We also stop using the Voronoi objects for tool tips since NVD3 has a
bug which causes an exception in D3 (see:
novus/nvd3#798).

Change-Id: I8f232bdd7f8024706220c9fa87fa460ab61209e8
portante added a commit to portante/pbench that referenced this pull request Dec 23, 2015
Instead of just eliminating points, calculate a full set of statistics
for each series, and then sort them by their average values, picking the
top 20. We stop considering any series for the graph once we find one
whose average is less than the threshold.

We also stop using the Voronoi objects for tool tips since NVD3 has a
bug which causes an exception in D3 (see:
novus/nvd3#798).

Change-Id: I8f232bdd7f8024706220c9fa87fa460ab61209e8
portante added a commit to portante/pbench that referenced this pull request Dec 23, 2015
Instead of just eliminating points, calculate a full set of statistics
for each series, and then sort them by their average values, picking the
top 20. We stop considering any series for the graph once we find one
whose average is less than the threshold.

We also stop using the Voronoi objects for tool tips since NVD3 has a
bug which causes an exception in D3 (see:
novus/nvd3#798).

Change-Id: I8f232bdd7f8024706220c9fa87fa460ab61209e8
@liquidpele liquidpele closed this Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants