简体   繁体   English

折线图组合多个系列的工具提示

[英]Flot chart combined tooltip of multiple series

I have a flot chart with multiple series. 我有一个包含多个系列的图表。 I need to show y-values of all the series together when any point is hovered on for a particular x-value. 当将某个点悬停在特定的x值上时,我需要一起显示所有系列的y值。

I'm using flot.tooltip for showing the tooltip. 我正在使用flot.tooltip来显示工具提示。 Is there any way to combine the y-values of all series like PowerBI does? 有没有办法像PowerBI那样组合所有系列的y值? Or or maybe even trigger the hovers of other points too? 还是什至触发其他点的徘徊?

Here's what I included in my chartOptions: 这是我的chartOptions中包含的内容:

tooltipOpts: {
    content: function (label, x, y) {
        // titile
        var text = "<i>" + vm.areaData[0].data[x][0] + '<br/></i>';
        vm.areaData.forEach(function(series)
        {
            // series_label : value
            text += "<b>" + series.label + ' : ' + series.data[x][1] + "<br/>" + "</b>";
        });
        return text;
    }
}

As the X-axis has common values, I'm using that as title for the tooltip. 由于X轴具有通用值,因此我将其用作工具提示的标题。 vm.areaData has the different series that are on my chart. vm.areaData具有我图表上的不同系列。 I'm iterating through them and creating the tooltip that needs to be displayed. 我正在遍历它们并创建需要显示的工具提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM