✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

HTML entities and aggregations in Plotly.js

I have data, some of which contain HTML entities, that I want to use in an aggregation. I’ve removed the HTML entities but the data aren’t being aggregated.

Here’s some code to give you a sense of what I’m up to:

var x = [‘this string’, ‘this string’];
var y = [1, 2];

x = x.map(e => new DOMParser().parseFromString(e, ‘text/html’).documentElement.textContent);

var trace = [{
  x: x,
  y: y,
  transforms: [{
    type: ‘aggregate’,
    groups: x,
    aggregations: [{
      target: ‘y’,
      func: ‘sum’,
      enabled: true

Plotly.newPlot(document.getElementById(‘plot’), trace, null);

Any idea why when I plot this I still have two x-axis items, “this string” and “this string” (the “ ” does get removed successfully), with y values 1 and 2, rather than one x-axis item, “this string”, with a y value of 3?