Question

I'm using the new RGraph beta release, and I can't figure out why this pie chart disappears when you click elsewhere on the page. Here is a screen cast of it happening: http://screencast.com/t/zPRhMqnCKk8.

self.pieChart = new RGraph.Pie('pie_'+self.id,progress)
  .Set('shadow', true)
  .Set('shadow.color', '#aaa')
  .Set('labels',[]) // No labels
  .Set('centerx', 50)
  .Set('center50', Math.round(h/2))
  .Set('radius',Math.round(h/2)-5)
  .Set('key',labels)
  .Set('key.position.gutter.boxed',false)
  .Set('key.position.graph.boxed',false)
  .Set('key.position.x',w-140)
  .Set('key.position.y',5)
  .Set('key.color.shape','circle')
  .Set('text.size',8)
  .Set('text.color','#555')
  .Draw();

I have other charts on the page, and none of them do this. Maybe there is a way to disable click event listeners via Set()?

UPDATE

Richard, the author of RGraph, explained the issue perfectly in his comment. After removing RGraph.common.dynamic.js, my issue was resolved. However, if you need to use dynamic features, this solution may not work for you.

Was it helpful?

Solution

Looks like the Pie chart is being removed from the RGraph ObjectRegistry - which is where objects are held so that they can be redrawn when necessary.

If you don't use dynamic feature you could try excluding RGraph.common.dynamic.js and redraws won't happen when the page is clicked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top