【问题标题】:Tooltip is not displayed under current mouse position EXTJS当前鼠标位置EXTJS下不显示工具提示
【发布时间】:2013-09-23 19:00:53
【问题描述】:

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

【问题讨论】:

  • 你能让这个工作吗?

标签: extjs


【解决方案1】:

ExtJS 4.1.3 版本的 sencha 网站上的示例运行良好:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-16
    • 2012-02-01
    相关资源
    最近更新 更多