Extjs 5:工具提示不适用于图表

时间:2015-07-03 08:42:37

标签: extjs extjs5

我正在使用Extjs 5.工具提示不适用于我的图表。我已经读过ext5中的工具提示中存在一些问题。我尝试了所有这些

  1. 提示 - >工具提示
  2. setTitle - > setHtml
  3. 添加'互动'
  4. 以下是它现在的样子。 Image of how it looks right now

    这是我的代码:

           highlight: {
              segment: {
                margin: 20
              }
            },
            tooltip: {
              trackMouse: true,
              width: 'auto',
              interactions: [{
                type: 'itemhighlight'
              }],
              height: 40,
              renderer: function(storeItem, item) {
                //calculate percentage.
                var total = 0;
                var idType = storeItem.get('type');
                chartStore.each(function(rec) {
                    total += rec.get('item1');
                });
                if(storeItem.get('item1') == 0){
                    this.setTitle('');
                }else { 
                    var pct = ((storeItem.get('item1')/total) * 100).toFixed(0);
                    var tipText =  pct + '% (' + storeItem.get('item1') + ' of ' + total + ')<br/>' + storeItem.get('name')
                    this.setHtml(tipText);
    
                }
              }
            },
    

    有没有解决这个问题?

1 个答案:

答案 0 :(得分:0)

我在sencha的论坛中看到了一个问题 https://www.sencha.com/forum/showthread.php?303423-ExtJS-6.0.0-Documentation-bug-Ext.chart.series.Series.tooltip ,你可以试试这个:

tooltip:{ 
  trackMouse:true, 
  width:140, 
  height:28, 
  scope: this, 
  renderer:function(toolTip, storeItem, item){
    toolTip.setHtml(storeItem.get('name')+': '+ storeItem.get('data1')+' views');
  }
}
相关问题