Chart Tooltip для линии - PullRequest
0 голосов
/ 09 мая 2019

У меня есть гистограмма с декартовой диаграммой с одной линией.Смотрите код ниже.Иногда линия пересекается с решеткой.Проблема в том, что мне нужна всплывающая подсказка для ряда строк, чтобы иметь приоритет, когда они перекрываются.Другими словами, когда они перекрываются и пользователь наводит курсор на точку, где перекрываются полоса и линия, мне нужно отобразить всплывающую подсказку для линии, а не для полосы.Каждый способ, который я пробовал, всегда показывает всплывающую подсказку.Возможно ли это?

Ext.define('BackOffice.view.report.publicationhealth.Chart', {
  extend: 'Ext.Container',
  alias: 'widget.reportpublicationhealthchart',

items: [
    {
        xtype:'cartesian',
        reference: 'chart',
        bind: {
            store: '{default}'
        },
        axes: [{
            type: 'numeric',
            position: 'left',
            fields: ['publisher_total', 'flip_total', 'cross_total', 
'baseline'],
            title: 'Contracted $',
            grid: {
                odd: {
                    opacity: 1,
                    fill: '#ececec',
                    stroke: '#ccc',
                    'stroke-width': 1
                }
            },
            label: {
                renderer: Ext.util.Format.usMoney
            }
        }, {
            type: 'category',
            position: 'bottom',
            fields: ['edition'],
            title: 'Months',
            label: {
                rotate: {
                    degrees: 270
                }
            }
        }],
        series: [
            {
                type: 'bar',
                axis: 'left',
                gutter: 80,
                xField: 'edition',
                yField: ['publisher_total', 'flip_total', 'cross_total'],
                title: ['Publisher', 'Flip Publisher', 'Cross Sales'],
                stacked: true,
                highlight: {
                    fillStyle: 'yellow'
                },
                tooltip: {
                    trackMouse: true,
                    renderer: function (tooltip, record, item) {
                        var fieldIndex = 
Ext.Array.indexOf(item.series.getYField(), item.field),
                            sales = item.series.getTitle()[fieldIndex];
                        tooltip.setTitle(record.get('edition')+' 
'+sales+' Revenue');
                        fldbase = item.field.replace(/_.*$/g, '_');

tooltip.setHtml(Ext.util.Format.usMoney(record.get(item.field))+' 
('+record.get(fldbase+'count')+' sale'+(record.get(fldbase+'count') != 
1?'s':'')+')');
                    }
                }
            },
            {
                type: 'line',
                xField: 'edition',
                yField: 'baseline',
                title: 'Baseline',
                marker: true,
                tooltip: {
                    trackMouse: true,
                    renderer: function(toolTip, record, ctx){
                        toolTip.setTitle(record.get('edition')+' 
Baseline');

toolTip.setHtml(Ext.util.Format.usMoney(record.get('baseline')));
                    }
                }
            }
        ]
    },
    {
        html: '<div style="text-align: center; font-weight: bold;">* 
Amounts shown above are BOOKED monthly totals, not collected 
revenue</div>'
    }
]
});
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...