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 for Logarithmic Scale Tick Bug for values of 0 #4688

Closed
wants to merge 2 commits into from

Conversation

roicos
Copy link
Contributor

@roicos roicos commented Aug 23, 2017

Fix for iss#3917 and iss#2966.
The minNotZero value is based on fontSize now (like recomended here) (i closed the previous pr because of too many conflicts).

range = helpers.log10(max) - Math.floor(helpers.log10(me.minNotZero));
var fontSize = helpers.getValueOrDefault(tickOpts.fontSize, Chart.defaults.global.defaultFontSize);
var diff = fontSize;
innerDimension -= diff;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does subtracting diff work when the axis is horizontal and the labels are rotated less than 90 degrees?

Copy link
Contributor Author

@roicos roicos Sep 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen-1

Horizontal chart looks like this (values: 0.01, 4, 0, 63, 10, 0.5)

@jcopperfield
Copy link
Contributor

jcopperfield commented Oct 30, 2017

The proposed fix for doesn't work for charts without 0, as can be seen in the attached chart.

Problems
v2.7

  • doesn't correctly render: horizontal with min:0 (regular and reversed)
  • in case the significand digit of minNotZero is 1 or 2;
    however the value itself has more significand digits,
    the first tick is displayed outside the chart area or on top of the 0-tick.

The pull request

  • doesn't correctly display charts without zero values
  • adds space for all log-lines up to 1, which the generators.logarithmic doesn't create.

Proposed fix
fix_for_logarithmic_scale_tick_bug_for_values_of_0.patch
.patch files aren't allowed in upload, so it's renamed as .txt

Example
Test for all bar plot possibilities (vertical/horizontal, with/without min: 0, default/reversed)
https://codepen.io/anon/pen/zPYMWz

chartjs-logarithmic-bar

@benmccann
Copy link
Contributor

A fix for this was implemented in #4913

@benmccann benmccann closed this Nov 12, 2017
@simonbrunel simonbrunel removed this from the Version 2.8 milestone Nov 26, 2017
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

5 participants