Skip to content

itemSet is not defined for graph2D

This issue was introduced in https://github.com/almende/vis/commit/a32a7f77f33ecf500edf19fa529b068c88253259.

<!doctype html>
<html lang="us">
<body>
    <head>
        <script type='text/javascript'  src="./vis.js"></script>
        <link href="vis.css" rel="stylesheet" type="text/css" />
   
        <div id="visualization"></div>
<script type="text/javascript">
    var container = document.getElementById('visualization');
  var items = [
    {x: '2014-06-11', y: 10},
    {x: '2014-06-12', y: 25},
    {x: '2014-06-13', y: 30},
    {x: '2014-06-14', y: 10},
    {x: '2014-06-15', y: 15},
    {x: '2014-06-16', y: 30}
  ];

  var dataset = new vis.DataSet(items);
  var options = {
    start: '2014-06-10',
    end: '2014-06-18'
  };
  var graph2d = new vis.Graph2d(container, dataset, options);
</script>
</body>
</html>

Causes

Uncaught TypeError: Cannot read property 'initialItemSetDrawn' of undefined

Related code

this.on('_change', function (properties) {
    if (me.itemSet.initialItemSetDrawn && properties && properties.queue == true) {
      me._redraw()
    } else {
      me._origRedraw();
    }
  }); 

The graph2D component uses this code too, but has no me.itemSet.