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

Fix #38: Trend diagram: Correct x-axis decade labels for decades 1900 and before #176

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

janiemi
Copy link
Contributor

@janiemi janiemi commented May 26, 2021

Changes

Fix issue #38:

  • Render correct x-axis decade labels in the trend diagram for decades 1900 and before by using the existing fixed time.ceil (Rickshaw.Fixtures.Time.ceil) function with special handling of decades.
  • Amend time.ceil to work correctly for decades 1800 and before.

Previous, incorrect behaviour

Previously, labels for decades 1900 and before were incorrectly shifted back by one (1890 instead of 1900 and so on), probably resulting from Rickshaw's approximate handling of leap years that assumes that each year has 365.25 days. (The years 1900, 1800 and 1700 were not leap years.)

Tests

I have tested the change only interactively on a Korp 9 test instance of the Language Bank of Finland. As far as I can see, the labels are now correct:
screenshot_Korp_9_fixed_trend_diagram_decades

However, as the fixed time.ceil had been there since commit b917cc39 but not used, I’m wondering if your reason not to use it might also apply to this fix, too. I haven’t noticed any unwanted side-effects, though.

Other comments

The comments and commented-out code around the change might not be relevant any longer, but I only removed (or moved) those that I was fairly convinced of. If you find my comments in the code too verbose, unnecessary or deficient, please tell me.

The commit message is rather different in style from your commit messages, so if you find it too verbose or pedantic, please tell me.

And if you’d prefer a different kind of a pull request description, please also tell me that, as I hope this is not the last pull request I’ll be creating for Korp.

results.js: view.GraphResults.renderGraph:
- Render correct x-axis decade labels in the trend diagram for decades
  1900 and before by passing to Rickshaw.Graph.Axis.Time constructor the
  existing fixed time.ceil function with special handling of decades.
  (Previously, labels for decades 1900 and before were shifted back by
  one (1890 instead of 1900 and so on), probably resulting from
  Rickshaw's approximate handling of leap years.)
- Modify the fixed time.ceil to work for decades 1800 and before.
@majsan
Copy link
Member

majsan commented Jun 22, 2021

Tested and merged! Really great to get this fixed. Sorry it took so long.

@janiemi
Copy link
Contributor Author

janiemi commented Jun 22, 2021

Great; thanks!

@janiemi janiemi deleted the fix-38-trend-diagram-decade-labels branch June 22, 2021 17:12
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.

2 participants