2013-09-23 60 views
0

我尝试从sencha extjs站点运行此示例。饼图被渲染,但工具提示不会在当前鼠标位置下呈现。它呈现在页面的左上角或左下角。有没有人遇到过这个问题,以及如何解决它?当前鼠标位置下不显示工具提示EXTJS

var store = Ext.create('Ext.data.JsonStore', { 
    fields: ['name', 'data'], 
    data: [ 
     { 'name': 'metric one', 'data': 10 }, 
     { 'name': 'metric two', 'data': 7 }, 
     { 'name': 'metric three', 'data': 5 }, 
     { 'name': 'metric four', 'data': 2 }, 
     { 'name': 'metric five', 'data': 27 } 
    ] 
}); 

Ext.create('Ext.chart.Chart', { 
    renderTo: 'chart', 
    width: 500, 
    height: 350, 
    animate: true, 
    store: store, 
    theme: 'Base:gradients', 
    series: [{ 
     type: 'pie', 
     angleField: 'data', 
     showInLegend: true, 
     tips: { 
      trackMouse: true, 
      width: 140, 
      height: 28, 
      renderer: function(storeItem, item) { 
       // calculate and display percentage on hover 
       var total = 0; 
       store.each(function(rec) { 
        total += rec.get('data'); 
       }); 
       this.setTitle(storeItem.get('name') + ': ' + Math.round(storeItem.get('data')/total * 100) + '%'); 
      } 
     }, 
     highlight: { 
      segment: { 
       margin: 20 
      } 
     }, 
     label: { 
      field: 'name', 
      display: 'rotate', 
      contrast: true, 
      font: '18px Arial' 
     } 
    }] 
}); 
+0

你是否能够得到这个工作? – Jayaram

回答

相关问题