Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取Protovis Sparkbar的当前计数_Javascript_Jquery_Protovis_Jquery Tooltip_Tipsy - Fatal编程技术网

Javascript 获取Protovis Sparkbar的当前计数

Javascript 获取Protovis Sparkbar的当前计数,javascript,jquery,protovis,jquery-tooltip,tipsy,Javascript,Jquery,Protovis,Jquery Tooltip,Tipsy,我目前正在尝试将json文件的编号和日期(字符串格式)显示到tipsy工具提示中 数据={“日期”:[“2010-07-01”,“2010-07-02”,“2010-07-03”,“2010-07-04”,“2010-07-05”,“2010-07-06”,“2010-07-07”,“2010-07-08”,“2010-07-09”,“2010-07-10”,“2010-07-11”,“2010-07-12”,“2010-07-13”,“2010-07-14”,“2010-07-15”,“201

我目前正在尝试将json文件的编号和日期(字符串格式)显示到tipsy工具提示中

数据={“日期”:[“2010-07-01”,“2010-07-02”,“2010-07-03”,“2010-07-04”,“2010-07-05”,“2010-07-06”,“2010-07-07”,“2010-07-08”,“2010-07-09”,“2010-07-10”,“2010-07-11”,“2010-07-12”,“2010-07-13”,“2010-07-14”,“2010-07-15”,“2010-07-17”,“2010-07-18”,“2010-07-07-19”,“2010-07-20”,“2010-07-21”,“2010-07-23”,“2010-07-07-24”,“2010-07-07-27”,“2010-07-28”,“2010-07-29”、“2010-07-30”、“2010-07-31”]、“评级”:[3.29、3.8、4.67、4.17、3.33、4.25、4.0、4.0、4.0、3.83、3.67、3.25、4.0、4.5、3.67、4.33、4.0、4.0、4.0、4.0、4.25、4.0、4.0、4.0、4.0、4.0]

            var w = data[0].ratings.length,
            h = 20;

            var vis = new pv.Panel()
            .width(w)
            .height(h);

            vis.add(pv.Bar)
            .data(data[0].ratings)
            .width(4)
            .left(function() 5 * this.index)
            .height(function(d) Math.round(d))
            .bottom(0)
            // I need the "num" to be dynamic, meaning getting the current count of the                bar position when doing a mouseover.
            .text(function(d) "Date: " +data[0].dates[num] + " Average Rating: "+ d)
            .event("mouseover", pv.Behavior.tipsy({gravity: "s", fade: true }));     

            vis.add(pv.Rule)
            .bottom(12)
            .strokeStyle("red")

            vis.render();
我需要数据[0]中的数值。日期[num]是动态的,这意味着当我在显示的条上进行鼠标悬停时,它将获得条的计数。我的主要目的是获得工具提示以同时显示评级和日期。例如,如果数值为1,它将显示2010-07-01等等


有人能想出一些办法来实现我的目标吗?

你想要
这个索引属性:

data[0].dates[this.index]

请参阅。

您需要
此.index
属性:

data[0].dates[this.index]