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

Numeric tooltips on X are incorrect on horizontal charts #74

Merged
merged 1 commit into from
Jun 22, 2014

Conversation

vitorbaptista
Copy link
Contributor

The problem I'm seeing is that the X numeric tooltips on horizontal charts are incorrect, as in:

horizontal-bars-tooltip-bug

I expected Series 1's X to be 5, and Series 2's X to be 10. The code is:

var values1 = [ [5.34, 2010] ];
var values2 = [ [10.12, 2015] ];

var options = {
  // Set up bars, horizontal equals true, etc. Nothing special.
};

var plotObj = $.plot( $("#bars"),
  [
      { data: values1, label: "Series 1"},
      { data: values2, label: "Series 2"}      
  ],
  options );

If I use the same data, with the same options, just changing horizontal = false and changing the data accordingly (x becomes y, and y becomes x), I get the correct values, as in:

vertical-bars-tooltip-bug

There's a fiddle showing the problem at http://jsfiddle.net/vitorbaptista/WZ5y7/4/

vitorbaptista added a commit to vitorbaptista/flot.tooltip that referenced this pull request Jun 13, 2014
The problem was that we were changing the tooltip value to the tick's label.
The change was to only do that if the tick's label or value (depending if the
axis is in categories mode or not) is equal to the x value. If it's not, we
don't replace it, which will make the correct part of the code (using
tickFormatter) to be ran.

This fixes krzysu#74.
The problem was that we were changing the tooltip value to the tick's label.
The change was to only do that if the tick's label or value (depending if the
axis is in categories mode or not) is equal to the x value. If it's not, we
don't replace it, which will make the correct part of the code (using
tickFormatter) to be ran.

This fixes krzysu#74.
@vitorbaptista
Copy link
Contributor Author

This is the fiddle with this updated code: http://jsfiddle.net/vitorbaptista/FmRk2/1/

vitorbaptista added a commit to ckan/ckanext-basiccharts that referenced this pull request Jun 13, 2014
This was a bug in flot and fixed there. I have sent them a pull request at
krzysu/flot.tooltip#74, which wasn't answered yet.
Whenever they answer (and hopefully accept), we should change this to use their
code.
@krzysu
Copy link
Owner

krzysu commented Jun 16, 2014

Hi, thank you for your pull request, and very sorry for late answer. I will take a look at it as soon as possible and merge it.

@vitorbaptista
Copy link
Contributor Author

@krzysu No problem! Please, let me know if you have any doubts or if there's any way I can help.

krzysu pushed a commit that referenced this pull request Jun 22, 2014
Numeric tooltips on X are incorrect on horizontal charts
@krzysu krzysu merged commit cd526a9 into krzysu:master Jun 22, 2014
krzysu pushed a commit that referenced this pull request Jun 22, 2014
@vitorbaptista vitorbaptista deleted the 74-numeric-tooltips branch June 22, 2014 21:06
@vitorbaptista
Copy link
Contributor Author

Thanks again, @krzysu 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants