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

dojox/charting: Canvas renderer not working with Tooltip #306

Open
davidhofmann opened this issue May 15, 2019 · 0 comments
Open

dojox/charting: Canvas renderer not working with Tooltip #306

davidhofmann opened this issue May 15, 2019 · 0 comments

Comments

@davidhofmann
Copy link

davidhofmann commented May 15, 2019

When using one the latest Dojo Toolkit releases (either 1.11, 1.12, 1.14, 1.15 – doesn't matter which one), the canvas based rendering of charts doesn't work with dojox/charting/action2d/Tooltip. It throws an error inside dojo.js, saying e.contains is not a function. The problem seems to arise from dojox/charting/Element.js, inside the cleanGroup method. To be honest, I haven't tested it with other actions so the same problem might occur with them as well.

I've created a JSFiddle which shows the issue:
https://jsfiddle.net/urbandrone/dxog68hk/1/

HTML

<div class="chart"></div>

JavaScript

require([
  'dojox/charting/Chart',
  'dojox/charting/plot2d/Columns',
  'dojox/charting/axis2d/Default',
  'dojox/charting/action2d/Tooltip'
], function (Chart, PlotType, Axis2D, Tooltip) {

  var container = document.querySelector('.chart');
  var data = [10, 20, 30, 20, 50, 40];
  
  var chart = new Chart(container);
  chart.addPlot('default', {
    type: PlotType,
    labels: true,
    labelStyle: 'inside',
    omitLabels: false,
    gap: 10,
    minBarSize: 33,
    maxBarSize: 33
  });
  chart.addAxis('x', { type: Axis2D,	vertical: false });
  chart.addAxis('y', { type: Axis2D, vertical: true });
  chart.addSeries('series a', data);
  
  var tooltip = new Tooltip(chart, 'default');
  
  chart.render();
})

As shown in the JS panel of the fiddle, it uses version 1.12.2 to create a simple chart with tooltips but throws the above mentioned error when the chart is created. Switching the version to 1.10 prevents it from throwing the error, so there must have been a change between 1.10 and 1.11 which causes the problem.

For the application I'm working on I cannot switch back to an older release. However, I also cannot just use the SVG based rendering, because that'll create an awful lot of nodes inside the DOM which massively drops performance in all browsers (all in all, SVG based rendering currently produces ~16.000 nodes while canvas based rendering "only" produces less then 9.500 nodes for the same page) and sometimes causes them to freeze completely.

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

No branches or pull requests

1 participant