Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Callback, new tip position & more parameters.. #9

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

madeindjs
Copy link

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 madeindjs changed the title Develop Add Callback, new tip position & more parameters.. Sep 30, 2016
onMouseOut: function(circle, tip){console.log("you mouse out :"+tip.text())}
});

TimeKnots.draw("#timeline1_1", kurbickFilms, {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, thanks for your PR!

I'm curious why this timeknot does not make the tip dissapear, when moving the pointer out?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need this feature to include a timeline in my CV. It look better in my CV's design :)

@@ -72,8 +82,7 @@
{name:"Watch a movie", date: "2012-09-28T20:16:00"},
{name:"Go to sleep", date: "2012-09-28T23:00:00"}
];
TimeKnots.draw("#timeline2", mySchedule, {horizontalLayout: false, color: "#669", height: 450, width:200, showLabels: true, labelFormat:"%H:%M"});

TimeKnots.draw("#timeline2", mySchedule, {horizontalLayout: false, colorTimeline: "#669", height: 450, width:200, showLabels: true, labelFormat:"%H:%M"});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also curious why this timeknow seem to move the tip to (0,0) when dissapearing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's seem a bug... I don't know why it appear. For me, on IE11 it appear average 1/10 times..

@madeindjs
Copy link
Author

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

@pchaganti
Copy link

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

thanks!

@madeindjs
Copy link
Author

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

@pchaganti
Copy link

@madeinjs Found them. Thx!

@phil-kt
Copy link

phil-kt commented Feb 26, 2017

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants