Javascript 如何将tupsy弹出窗口添加到堆叠面积图-protovis

Javascript 如何将tupsy弹出窗口添加到堆叠面积图-protovis,javascript,protovis,Javascript,Protovis,我一直在尝试添加一个弹出窗口,显示我的叠层面积图的每一层中显示的数据类型。以下是我迄今为止所做的工作: 基本上,当我将鼠标悬停在堆叠面积图的任意一层上时,我得到的是弹出窗口中显示的相同类型,我可以看出原因,但我不知道如何使鼠标悬停在该层上时显示一个值,当鼠标悬停在第二层上时显示另一个值 请问有人能帮忙吗 /* y-axis scale is the largest data item scaled to height of the panel */ yScale = pv

我一直在尝试添加一个弹出窗口,显示我的叠层面积图的每一层中显示的数据类型。以下是我迄今为止所做的工作:

基本上,当我将鼠标悬停在堆叠面积图的任意一层上时,我得到的是弹出窗口中显示的相同类型,我可以看出原因,但我不知道如何使鼠标悬停在该层上时显示一个值,当鼠标悬停在第二层上时显示另一个值

请问有人能帮忙吗

    /* y-axis scale is the largest data item scaled to height of the panel */
        yScale = pv.Scale.linear(0, pv.max(data, function (d) {
            var totalValue = 0;
            for (i = 0; i < stackLayers.length; i++) {
                totalValue = totalValue + d[stackLayers[i]];
            }
            return totalValue;
        })).range(0, h),

        colors = pv.Colors.category20().range();


    /* render the area's using the predefined protovis stack layout */
    vis.add(pv.Layout.Stack)
        .layers(stackLayers)
        .values(data)
        .x(function (d) {
            return xScale(d.x);
        })
        .y(function (d, p) {
            return yScale(d[p]);
        })
        .layer.add(pv.Area)
        .interpolate("cardinal")
        .tension(0.97)
        .fillStyle(function (d) {
            return colors[this.parent.index];
        })
        .text(function (d) {
                if(stackLayers[i]== "HAL")
                {return "Dave";}
                else
                {return "Sorry";}
/*              return (stackLayers[i]== "Hal" ? "Dave" : "Sorry");*/
        })
        .event("mouseover", pv.Behavior.tipsy({gravity:"s", fade:true}))
        .anchor("top").add(pv.Line)
        .strokeStyle(function (d) {
            return colors[this.parent.index].darker();
        })
        .interpolate("cardinal")
        .tension(0.97)
        .lineWidth(2);

    /* Y-axis rule. */
    vis.add(pv.Rule)
        .data(yScale.ticks(5))
        .left(0)
        .width(w)
        .bottom(yScale)
        .strokeStyle(function (d) {
            return d ? "rgba(128,128,128,.2)" : "#000";
        })
        .anchor("left").add(pv.Label)
        .text(yScale.tickFormat);
/*y轴比例是按面板高度缩放的最大数据项*/
yScale=pv.Scale.linear(0,pv.max)(数据,函数(d){
var totalValue=0;
对于(i=0;i