Re: TypeError: pv.Behavior.tipsy is not a function

130 views
Skip to first unread message
Message has been deleted

Pedro Alves

unread,
Mar 14, 2011, 1:09:20 PM3/14/11
to prot...@googlegroups.com, kx

> what exactly is stored in tipsy.js?

pv.Behavior.tipsy function :)

On 03/14/2011 04:56 PM, kx wrote:
> Please help. I am trying to work on the tooltip example and is running
> into alot of problems: http://vis.stanford.edu/protovis/ex/tipsy.html.
> I kept receiving the error message: "TypeError: pv.Behavior.tipsy is
> not a function".
>
> I suspect that it is due to the fact that i am missing: "<script
> src="tipsy.js" type="text/javascript"></script>" but what exactly is
> stored in tipsy.js? My code below:
>
> =code=
> <html>
> <head>
> <title>Tooltips</title>
>
> <script type="text/javascript" src="../protovis-r3.2.js"></
> script>
> <script src="../jquery-1.4.2.min.js" type="text/javascript"></
> script>
> <script src="../jquery.tipsy.js" type="text/javascript"></script>
>
> <link href="tipsy.css" type="text/css" rel="stylesheet"/>
> <style type="text/css">
>
> body {
> font: 10px sans-serif;
> }
>
> #fig {
> width: 460px;
> height: 275px;
> }
>
> </style>
> </head>
> <body><div id="center"><div id="fig">
> <script type="text/javascript+protovis">
>
> var data = pv.range(10).map(function(d) { return Math.random() + .
> 1; });
> var antibiotics = ["penicillin", "streptomycin", "neomycin"];
>
>
> /* Sizing and scales. */
> var w = 400,
> h = 250,
> x = pv.Scale.linear(0, 1.1).range(0, w),
> y = pv.Scale.ordinal(pv.range(10)).splitBanded(0, h, 4/5);
>
> /* The root panel. */
> var vis = new pv.Panel()
> .width(w)
> .height(h)
> .bottom(20)
> .left(20)
> .right(40)
> .top(5);
>
> /* The bars. */
> var bar = vis.add(pv.Bar)
> .data(data)
> .top(function() y(this.index))
> .height(y.range().band)
> .left(0)
> .width(x)
> .text(function(d) d.toFixed(1))
> .event("mouseover", pv.Behavior.tipsy({gravity: "w", fade:
> true}));
>
> /* The variable label. */
> bar.anchor("left").add(pv.Label)
> .textMargin(5)
> .textAlign("right")
> .text(function() "ABCDEFGHIJK".charAt(this.index));
>
> /* X-axis ticks. */
> vis.add(pv.Rule)
> .data(x.ticks(5))
> .left(x)
> .strokeStyle(function(d) d ? "rgba(255,255,255,.3)" : "#000")
> .add(pv.Rule)
> .bottom(0)
> .height(5)
> .strokeStyle("#000")
> .anchor("bottom").add(pv.Label)
> .text(x.tickFormat);
>
> vis.render();
>
> </script>
> </div></div></body>
> </html>
>

Reply all
Reply to author
Forward
Message has been deleted
0 new messages