-
Notifications
You must be signed in to change notification settings - Fork 322
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
Added tooltip label to line chart #31
Conversation
@etimberg any chance you could review? |
// Line Annotation implementation | ||
module.exports = function(Chart) { | ||
var horizontalKeyword = 'horizontal'; | ||
var verticalKeyword = 'vertical'; | ||
|
||
var LineAnnotation = Chart.Element.extend({ | ||
|
||
draw: function(ctx) { | ||
draw: function(ctx, options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the options were added to the _model
property, this would probably work better since they would automatically change during animations. Or is it intended to have these not animate?
1aa085f
to
a841030
Compare
@etimberg Updated as per code review - had to rebase after you merged the last PR. I found that the animations were actually broken completely due to the: var model = obj._model = obj._model || {}; line in |
Tagging in issue #7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Will merge this tonight once I've had a chance to test it out.
@etimberg would love to see this get added in soon! I have a project that needs this feature. |
Is this getting merged @petewalker @etimberg? |
Looks like it needs rebasing following @etimberg's renaming of the plugin. I don't have maintainer privileges, so I can't merge it once I'm done. |
Originally based on chartjs#12. Added an optional Label option to Line Annotation. Updated the documentation to display this. Also added a sample showing how it can work.
Moved rendering calculations to lineUpdate function, also fixed a minor reference bug that prevented animations from working at all.
8406a57
to
6c4520c
Compare
Hey @etimberg - I've rebased to bring this up to date with your changes. Any chance you could review again? Would you like a plunkr? |
@petewalker a plunkr would be great. I'll try and look at this over the weekend 😄 |
@petewalker I've joined the project as a maintainer (thanks @etimberg for the add). Could you provide a plunkr for this change so I can do some testing? |
Labels should track with the line slope, and should not fall out of the edge of the canvas.
Ah, thanks for merging @compwright - I haven't had a moment to sit down and look at this in the last week! |
@petewalker there were some problems with the label getting cut off near the edge of the canvas, and with the label getting off-line when using |
@compwright - Yeah, I saw :) thanks for making those last few tweaks! |
Originally based on #12.
Added an optional Label option to Line Annotation.
Updated the documentation to display this. Also added a sample showing
how it can work.