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

Added tooltip label to line chart #31

Merged
merged 4 commits into from
Nov 15, 2016
Merged

Conversation

petewalker
Copy link
Contributor

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.

@petewalker
Copy link
Contributor Author

@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) {
Copy link
Member

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?

@petewalker
Copy link
Contributor Author

@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 lineUpdate, so have fixed as part of the PR.

@petewalker
Copy link
Contributor Author

Tagging in issue #7

Copy link
Member

@etimberg etimberg left a 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.

@compwright
Copy link
Collaborator

@etimberg would love to see this get added in soon! I have a project that needs this feature.

@neilmiddleton
Copy link

Is this getting merged @petewalker @etimberg?

@petewalker
Copy link
Contributor Author

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.

Pete Walker added 3 commits November 4, 2016 17:23
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.
@petewalker
Copy link
Contributor Author

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?

@etimberg
Copy link
Member

etimberg commented Nov 4, 2016

@petewalker a plunkr would be great. I'll try and look at this over the weekend 😄

@compwright
Copy link
Collaborator

@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?

@compwright compwright merged commit 9efd067 into chartjs:master Nov 15, 2016
compwright added a commit that referenced this pull request Nov 15, 2016
Labels should track with the line slope, and should not fall out of the edge of the canvas.
@petewalker
Copy link
Contributor Author

Ah, thanks for merging @compwright - I haven't had a moment to sit down and look at this in the last week!

@compwright
Copy link
Collaborator

@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 left, right, top, or bottom positioning on skewed lines. You might be interested in the fix I came up with: 5eb9287

@petewalker
Copy link
Contributor Author

@compwright - Yeah, I saw :) thanks for making those last few tweaks!

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

Successfully merging this pull request may close these issues.

None yet

4 participants