(Awesome module!)

I have a chart based on a view in which the label field has some values that contain apostrophes and ampersands.
' and & are showing up in the legend. Is there any way to display the apostrophe or ampersand in the legend?

In my view I tried setting the "rewrite results / strip html tags" to true in order to remove them, but had no impact.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

I have a chart based on a view in which the label field has some values that contain apostrophes and ampersands.

This sounds like a bug. What charting implementation are you using? Google Charts or Highcharts?

quicksketch’s picture

Nevermind, I reproduced this problem by adding an ampersand to one of my content type names and then looking at the example pie chart produced by Views that comes with the module (admin/structure/views/view/charts_demo/edit/pie).

It looks like this has to do with Views encoding the results before they get to the Charts module, I'll see what we can do about this; we may need to manually de-encode the returned HTML.

quicksketch’s picture

Title: HTML encoding in legend? ' and & showing up in legend » HTML encodings (e.g. ' and &) showing up in legend
Category: Support request » Bug report
Status: Active » Fixed
FileSize
762 bytes

I've committed this patch which decodes HTML entities when the labels are coming from a rendered Views field (since it encoded the value previously).

Status: Fixed » Closed (fixed)

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

itsekhmistro’s picture

Thank you @quicksketch

But current patch fixes the issue only for a CHARTS_SINGLE_AXIS type of charts.
It should be applied to other types as well. (issue in the Version 7.x-2.0-rc1)

Please see attached addition.

itsekhmistro’s picture

Status: Closed (fixed) » Active
itsekhmistro’s picture

Version: 7.x-2.0-beta5 » 7.x-2.0-rc1
Pierre.Vriens’s picture

Status: Active » Patch (to be ported)
Parent issue: » #2382151: Charts 7.x-2.0 Release

@itsekhmistro: sorry it took so long to get back on this issue (but I do so now ...). Thank you for this extra patch. Note the status update of this issue (and the parent issue I'm adding). Expect the patch to be applied to the current dev version soon (after I've done some extra QA-testing about it myself).

  • quicksketch committed 38b120e on 8.x-1.x
    Issue #2167563: HTML encodings (e.g. ' and &) showing up in...

  • quicksketch committed 38b120e on 8.x-3.x
    Issue #2167563: HTML encodings (e.g. ' and &) showing up in...
andileco’s picture

Status: Patch (to be ported) » Fixed
andileco’s picture

Status: Fixed » Closed (fixed)