This is a follow-up to #1321942: Tool tips are not displayed

As I continue to hack into the Highcharts module, I've gotten a much better understanding of a lot of the code, but one of the bugs that continues to elude me is the inability to set the tooltip formatter. I've been changing a lot of the code, but even before I altered anything around the tooltip formatter, my Firebug console was picking up an error in the Highcharts source JS code: "D.call is not a function" every time I hovered over the data points on my graphs.

I looked in there, blindly changed D.call on line 41 of "sites/all/libraries/highcharts/js/highcharts.js " to d.call, and now see the tooltip hovering over each bar when I mouseover. Unfortunately, the only thing that displays is [object Object], and not the value of each data point.

Hours of Google-searching and trying to hard-code in values has gotten me nowhere, and I've not been able to change the text in the tooltip whatsoever. It may perhaps be related to this thread but I'm not sure.

Comments

somimi’s picture

StatusFileSize
new28.55 KB

Here is a screenshot of what I'm referring to:

stovak’s picture

haven't gotten to tooltips yet. I will make sure they're functional before version 1.0.

somimi’s picture

Thanks for the reply, and thanks for your work on this module. Yeah, I think it may have something to do with drupal_add_js putting quotes around everything and turning the formatter function into a string.

somimi’s picture

StatusFileSize
new120.41 KB

Oh, nevermind, I got the tooltip formatter to work! I commented out this code in views_highcharts.theme.inc:

  //$highcharts_config->tooltip->formatter = 'eval(function() {
	//return ' . $options['format']['tooltip_formatter'] . '; 
	//})';

and changed "d.call" back to "D.call" in the highcharts.js file.

pvhee’s picture

#4 works for me as well.

This module is nice work, but needs quite some work & cleanup to get all of it working. I'll look into submitting a series of patches.

scottrigby’s picture

This is resolved a little differently (for full highcharts API flexibility) in #1507800: Views-independent Highcharts API.

@stovak, if you agree on the approach there, we could mark this as duplicate and handle the tasks on that issue.

scottrigby’s picture

^ Specifically we solved this by explicitly adding the highchart options object methods separately, which couldn't be passed through Drupal.settings. Check out the bottom of highcharts_render() in http://drupal.org/sandbox/scottrigby/1507774. The tooltip is the only example added atm, as a proof-of-concept - and it works well without modifying anything else.

Zet123’s picture

I am using 7.x-1.0-alpha6, but I cannot seem to get the tooltip working. I get the following error: D.call is not a function. I did try out the solutions outlined above. Help please!!!

rolkos’s picture

I also have some problems with OG + UUID. After I installed uuid (because of highcharts), some OG views handlers just disappeared, I noticed that, OG relationship are broken and for example I can't use (group) OG group: OG membership.

Another thing is uuid_tokens it's also broken.

So for now at least for me uuid should be avoided if it’s possible.

Regardless UUID troubles, hightcharts is great module and I'm really grateful for it.

Thanks!

Scryver’s picture

Does it still work when you change the function, so it is not the default? Because to me it seems that the whole $formatter piece of code doesn't do anything.

scottrigby’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Needs review

Anyone interested may want to help test the 7.x-2.x branch, where this issue has been resolved. The new API there has been tested including tooltip), but the Views integration in that branch has not been thoroughly tested yet.

scottrigby’s picture

I think @stovak's comment in #1561694-5: Highcharts views theme functions and templates was meant for this issue:

We're currently re-writing the core configuration of this module to make it more responsive and object-oriented. We'll have a solution for the tooltip formatter soon. One that makes sense and is consistant with drupal standards.
We're looking at a config stack that isn't based on loading a JSON file. Hope to have it committed soon.
-tom

In any case that will happen in the 2.x branch.

scottrigby’s picture

Title: Tooltip formatter only yields [object Object] » Tooltip formatter

Clarifying title to prevent further duplicates (like #1528822: Tool Tip Formatter and #1564910: Tooltip formatter doesn't seem to be implemented).

Scryver’s picture

Again a really cool module. We actively use it and I just updated the site to the new 2.x branch. (check out ClimbCheck ). But now I would like to edit (not append) the tooltip. Is this possible through a hack, temporary?

stovak’s picture

So with my new config module, my idea is to add the formatting function by adding a Drupal.behavior with one function then reference the behavior in the new config class. Long story short, yes, the hack is temporary.

-tom

jeremymcminn’s picture

#4 did work previously, but now when I comment it out it causes my browser to crash as soon as I hover over the chart. I'm not even sure how to troublehsoot that.

dshields’s picture

I found this browser crash issue in Chrome, but found the solution to be adding

$highcharts_config->tooltip->useHTML = true;

...to views_highcharts.theme.inc, right above the lines that are commented out.

Something like this:

     $highcharts_config->tooltip->useHTML = true;
//  $highcharts_config->tooltip->formatter = 'eval(function() {
//  return ' . $options['format']['tooltip_formatter'] . ';
//}  )';

Hope that helps.

I still can't figure out how to actually edit the tooltip format, though.

jeremymcminn’s picture

Thanks for that, was wondering why it was crashing - Intersting that no solution has been found for editing the format of the tooltips though

scottrigby’s picture

Status: Needs review » Postponed (maintainer needs more info)

@dshields What version of highcharts module are you using? the 7.x-2.x branch does not have the eval() code in it:
http://drupalcode.org/project/highcharts.git/blob/refs/heads/7.x-2.x:/hi...
Please test this branch and let us know if you still run into issues, or need any help implementing the tooltip.

@jeremymcminn you can edit the tooltip.

See #7 above, which became the 7.x-2.x branch in #1507800: Views-independent Highcharts API

There are some more niceties we've been working on that still need to be pushed, and will probably do that soon.

We should also #1542336: Add version information to the project page to avoid confusion about branches…

jeremymcminn’s picture

Hi Scott

Thanks for that, will test these out and let you know

Jeremy

dshields’s picture

Thanks for the help. While I think the project I was working on has wrapped up, I'd really like to be able to draw on this module in the future so I'll continue to test.

So far, I"m running into the same issue as #1547090: Autoload files

larskleiner’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: Code » API
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new631 bytes

How about removing any tooltip code from 7.x-1.x until it's ready?

We've evaluated 7.x-2.x but want to stick with 7.x-1.x for the time being. I'm re-tagging this issue as 7.x-1.x because it hasn't been fixed for this branch.

Tooltips support is not essential for us but we need to get rid of the following error.

Strict warning: Creating default object from empty value in template_preprocess_views_highcharts() (line 84 of /sites/all/modules/highcharts/theme/views_highcharts.theme.inc).

Commenting out the tooltips-related code in views_highcharts.theme.inc as suggested in #4 fixes this, see attached patch.

larskleiner’s picture

StatusFileSize
new637 bytes

Re-rolled patch to work with git checkout of 7.x-1.x-dev (different then the 7.x-1.x download version, see http://drupal.org/node/1773498).

scottrigby’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

I have just committed a fix to the 7.x-2.x branch for tooltips:

d516a73

Fix tooltips by adding the options methods inline js to the footer. Also genericize this to support other options that expect callback functions, and include a new hook_highcharts_methods_alter() to allow other modules to add to this list

@larskleiner Thanks for the patch for the improperly named 7.x-1.x-dev branch, which needs to be cleaned up (one way or another). But let's follow up on that in the other issue. This issue will focus on fixing the 2.x branch for now.

scottrigby’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sylvain lavielle’s picture

Issue summary: View changes
StatusFileSize
new651 bytes

This bug stills here on the current 7.x-1.0-alpha6 version but none of the previously submitted patches seem to apply correctly on it, so here's the patch for 7.x-1.0-alpha6