I'm trying to display two pie chart visualisations on a single page.
Unfortunately only one of them is rendered.
If I comment out one of them then the other one is rendered so each one is rendered fine but not both of them.

When both of them are being rendered then only first one is rendered but only the chart without the legend.
I can see that for loop in line 29 of modules/d3/js/d3.js stops iterating through visualisation ids after rendering first visualisation.

It looks like loop execution is interrupted because of this exception:
TypeError: d3.tileText is not a function

If I comment out a line of code in piechart.js where titleText is used as a function then other exceptions appear:
TypeError: d3.splitString is not a function
TypeError: labelWrapper.selectAll(...).enter is not a function

When I comment out code in piechart.js where these function are called then I'm getting two charts without their legends.

Comments

PawelR’s picture

Issue summary: View changes
PawelR’s picture

Issue summary: View changes
cptroot’s picture

It seems that the page is missing the d3.extend library. d3.extend adds both d3.tileText, and d3.splitString, and should be attached to the page by the d3 module.

Because it didn't, I just want to double check a few things:

  • What version of the d3 module do you have?
  • Are you using d3_views?
  • What version of d3.v3.js are you using?

Hopefully it's either an old issue that can be fixed by updating, or it's a bug with d3_views that is already fixed on master.

alansaviolobo’s picture

I was facing a similar issue (only 1 chart showing per page)
I figured the issue was that both the views were not getting unique ids and hence were not getting rendered.

I fixed the issue by changing line 316 of d3_views_plugin_style_d3.inc to

      'id' => 'view-d3-vis-' . $this->view->name . '-' . $this->view->current_display,
asherry’s picture

The line should currently be:

  'id' => 'view-d3-vis-' . $this->view->dom_id,

and that's line 298. http://cgit.drupalcode.org/d3/tree/modules/d3_views/views/plugins/d3_vie...

Are you both using the latest dev release?

alansaviolobo’s picture

my bad, you are correct. The reason I reported line no 316 is due to the patch submitted here

and yes, I am on the latest dev.

asherry’s picture

So the problem is then that $this->view->dom_id is showing up as null or false?

asherry’s picture

Status: Active » Postponed (maintainer needs more info)
guignonv’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.