문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top