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

This fixes #2599 #2600

Closed
wants to merge 2 commits into from
Closed

This fixes #2599 #2600

wants to merge 2 commits into from

Conversation

haschu
Copy link
Contributor

@haschu haschu commented May 19, 2016

This hides the next to the last tick, since the last tick is always shown.

Before:
bildschirmfoto 2016-05-19 um 14 00 42

After:
bildschirmfoto 2016-05-19 um 14 01 03

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 75.747% when pulling 967f4cb on haschu:fix/2599 into ecb7ce1 on chartjs:master.

@etimberg
Copy link
Member

I feel like this might be risky. hence the failing tests. I'm not sure the right way to handle this is to always remove the 2nd last tick. I can think of scenarios where this would lead to a large gap

@haschu
Copy link
Contributor Author

haschu commented May 19, 2016

Yeah, I had the same concerns, but I didn't found a case where this would actually lead to a really large gap.
Could you post a fiddle with an example scenario maybe?

@haschu
Copy link
Contributor Author

haschu commented May 19, 2016

Okay, I see...
How about an option like showLastTick: false instead? Not really an elegant solution - but for now it would at least give users, who come across the same problem, a way to workaround.

@etimberg
Copy link
Member

@haschu I was actually thinking about something like showLastTick: false that could apply to all scales (numerical scales have the same problem as time scales during zoom and pan). I was thinking that rather than a boolean, the option should be an enum so that we can add more options later.

@haschu
Copy link
Contributor Author

haschu commented May 19, 2016

So, If you also consider an option like that, I'd like to come up with a solution very soon, since I need a workaround for project.

Could you give a tiny example of what you were thinking exactly? There aren't any enum options so far, so we would need a global constants object, like:

lastTick: Chart.enums.lastTick.showAlways

Wouldn't a "normal" object be more consistent to the other options?:

lastTick: {
    showAlways: false,
    anotherOption: true,
}

@etimberg
Copy link
Member

@haschu I was thinking something like the enum you suggested. I'll let other chime in and see what they prefer. @zachpanz88 @tannerlinsley @derekperkins @simonbrunel

@haschu
Copy link
Contributor Author

haschu commented May 19, 2016

Okay.
I got a working solution with a simple boolean option running, for both numerical scales and time scales.
Depending on what the others prefer, I'll do some changes and then commit it.

@ankane
Copy link
Contributor

ankane commented Jun 3, 2016

My vote would be to exclude the last tick in this situation, to keep the labels equally spaced.

screen shot 2016-06-03 at 2 31 19 am

Also, thanks for this awesome library!

@fulldecent
Copy link
Contributor

Can you please rebase and squash?

@panzarino
Copy link
Contributor

Also, could you please fix the conflicts that have to be resolved?

@haschu
Copy link
Contributor Author

haschu commented Jun 28, 2016

Sure! I try to fix everything over the week.

@tannerlinsley
Copy link
Contributor

This would be great. Nice work!
On Tue, Jun 28, 2016 at 11:34 AM haschu [email protected] wrote:

Sure! I try to fix everything over the week.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2600 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AFUmCR-uFn92fyXwq15HZElmvhKOp4RZks5qQVsGgaJpZM4IiMrY
.

@ianks
Copy link
Contributor

ianks commented Sep 16, 2016

@haschu this change would be amazing... any chance you are going to finish this or should i try?

@haschu
Copy link
Contributor Author

haschu commented Sep 17, 2016

Oh sorry, I totally forgot that issue. I'm going to fix it as soon as I got some time :-).

@krukid
Copy link

krukid commented Oct 27, 2016

Still a problem :(

@krukid
Copy link

krukid commented Oct 27, 2016

Tried to hide the next to the last tick with the following config:

ticks: {
  maxRotation: 0,
  callback: function(value, index, ticks) {
    if (index <= 2 || index !== ticks.length - 2) {
      return String(value);
    }
  },
},

It kinda fixed the overlapping of the last tick, but then I resized the chart back and forth and noticed other ticks get overlapped too by some 10 pixels :(

@krukid
Copy link

krukid commented Oct 28, 2016

so what I did was change my time scale to linear scale, which works coz all my data has an equal time step, and provided a custom renderer for ticks with fixed format. no more overlaps.

@markterrill
Copy link

Hi, any movement? It's still a nasty bug that makes it look terrible!

@etimberg
Copy link
Member

Closing as out of date

@etimberg etimberg closed this Feb 11, 2017
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.

10 participants