“工具提示”上的散点图大小 [英] Scatter plot size on "tooltip"

查看:74
本文介绍了“工具提示”上的散点图大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在工具提示上获取散点图的半径(或大小)。

r : function(d) {

       if (d.value != null) {
            var size = datajson[k++]["total"];

            return size;
       }

我已经做了类似的操作。因此,工具提示应显示大小我指着那个泡沫。

I have done something like this..So the tooltip should show the size when i point on that bubble. How to achieve this?

谢谢

推荐答案

您可以添加d对象的大小

You can add the size to the d object

r: function (d) {
    if (d.value != null) {
        var size = datajson[k++]["total"];
        d.size = size;
        return size;
    }
}

并在显示工具提示时将其检索

and retrieve it when you show your tooltip

tooltip: {
    contents: function (d) {
        if (d[0].value != null) {
            return d[0].size;
        }
    }
},

小提琴- http://jsfiddle.net/f0cotcqp/

这篇关于“工具提示”上的散点图大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆