私は現在、jsonファイルの番号と日付(文字列形式)をほろ酔いツールチップに表示しようとしています。
data = [{"dates":["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- 19 "、" 2010-07-20 "、" 2010-07-21 "、" 2010-07-23 "、" 2010-07-24 "、" 2010-07-26 "、" 2010-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、3.83、3.67、3.25、4.0、4.5、3.67、4.33、4.0、4.0、3.0、4.5、4.0、4.0、4.0、4.4、4.0、4.25、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();
data [0] .dates [num]のnumを動的にする必要があります。つまり、表示されているバーにマウスオーバーすると、バーのカウントが取得されます。私の主な目的は、評価と日付を一緒に表示するためのツールチップを取得することです。たとえば、numが1の場合、2010-07-01などが表示されます...
誰かが私の目標を達成するためのいくつかの方法を捨てることができますか?