当前鼠标位置EXTJS下不显示工具提示

时间:2013-09-23 19:00:53

标签: extjs

我尝试从sencha 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'
        }
    }]
});

1 个答案:

答案 0 :(得分:0)

示例在使用ExtJS版本4.1.3的sencha网站上正常工作:

http://docs.sencha.com/extjs/4.1.3/#!/example/charts/Pie.html

请提供有关您使用的sencha ExtJS版本和浏览器详细信息的详细信息,以便有人可以提供帮助。它可能是特定于浏览器的问题。