timeknots icon indicating copy to clipboard operation
timeknots copied to clipboard

Add Callback, new tip position & more parameters..

Open madeindjs opened this issue 8 years ago • 5 comments

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!

madeindjs avatar Sep 30 '16 20:09 madeindjs

Why don't you accept my PR? Do you need some modifications?

madeindjs avatar Nov 18 '16 16:11 madeindjs

@madeinjs Do you happen to have an example that shows off the new options in this PR?

thanks!

pchaganti avatar Dec 17 '16 16:12 pchaganti

@pchaganti , I already changed examples placed in example/index.html with new options.

madeindjs avatar Jan 03 '17 08:01 madeindjs

@madeinjs Found them. Thx!

pchaganti avatar Jan 03 '17 14:01 pchaganti

+1

phil-kt avatar Feb 26 '17 23:02 phil-kt