timeknots
timeknots copied to clipboard
Add Callback, new tip position & more parameters..
Hello,
I used your library on my personal project. This really helped me but I needed some Knot callbacks. So I fork your project and improve it to fit more to my need. Here improvement
add Knot Callback (as proposed in my last PR)
I simply add basic callback parameters when you draw your TimeKnots
. Bellow a very simple example:
TimeKnots.draw("#timeline1", kurbickFilms, {
dateFormat: "%B %Y", color: "#696", width:500, showLabels: true, labelFormat: "%Y",
onMouseOver: function(circle, tip){console.log("you mouse overed :"+tip.text())},
onMouseOut: function(circle, tip){console.log("you mouse out :"+tip.text())}
});
fixed tip position
In this mode, Tip are continously showed up on the top of the timeline and hover a circle update it. You have only to set tipPosition
parameter to top
.
add more visual parameters
I separate color in categories : Timeline, Tip & Circle. Here parameters
-
colorTimeline
: color used for the Timeline (default:999
) -
colorTip
: color used for text visualization (default:rgba(0,0,0,.5)
) -
backgroundCircle
: Background color of the circle (default:FFF
) -
backgroundTip
: Background color of the tip (default:{0,0,0,.5}
)
Factorize your code
I found many repettions and I foctorize it in function
I hope you'll accept this PR & this work will serve someone!
Why don't you accept my PR? Do you need some modifications?
@madeinjs Do you happen to have an example that shows off the new options in this PR?
thanks!
@pchaganti , I already changed examples placed in example/index.html with new options.
@madeinjs Found them. Thx!
+1