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

New legend position option: "inset" #326

Merged
merged 3 commits into from
Jun 9, 2014

Conversation

pjschreifels
Copy link
Contributor

screen shot 2014-06-05 at 10 16 26 pm

@masayuki0812 masayuki0812 merged commit cf2506d into c3js:master Jun 9, 2014
masayuki0812 added a commit that referenced this pull request Jun 9, 2014
masayuki0812 added a commit that referenced this pull request Jun 9, 2014
@masayuki0812
Copy link
Member

Thank you for this PR. I merged this with some fixes. Thanks!

@pjschreifels
Copy link
Contributor Author

Beautiful. Glad I could contribute.

@pjschreifels pjschreifels deleted the development branch June 22, 2014 20:55
@kcwoodfield
Copy link

What's the implementation look like for this? Is there a class name to hook into with css?

@pjschreifels
Copy link
Contributor Author

Instead of using bottom (the default) or right position for the legend, use "inset". There are a few options for an inset legend; you may anchor it to the "top-left", "top-right", "bottom-left", or "bottom-right". You can also provide a x or y offset, that will move the legend away from the edge of the chart. Finally, you must explicitly set the number of items in the legend, so that it sets the proper vertical size.

For example:

legend: {
    position: "inset",
    inset: {
        anchor: "top-left",
        x: 10
        y: 10
        step: 3
    }
}

The inset legend follows the class conventions of C3 in general, so you may override the styles of the legend as you like.

@Tropicalista
Copy link
Contributor

If step is not specified, the legend get the full height of the chart. Shouldn't step get step number automatically?

@pjschreifels
Copy link
Contributor Author

When I submitted the PR, the step number was being set automatically, but that was changed by masayiuki before it was merged. I'm not sure why.

@masayuki0812
Copy link
Member

I'm sorry. I made a bug. @pjschreifels is right.
Then now this has been fixed. Could you try the latest code? Thanks.

@leo-mck
Copy link

leo-mck commented Oct 31, 2014

This works fine and it looks nice, thank you @pjschreifels and @masayuki0812 . However I think there is still a small bug, when you unload and load again the old legend does not get discarted. Here is a demo (click "update" to see the problem)

masayuki0812 added a commit that referenced this pull request Nov 8, 2014
@masayuki0812
Copy link
Member

@leo-mck Thank you for your reporting. You're right. There was a bug. I think it's been fixed now.

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.

5 participants