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

bugfix/11727-log-axis-precission #12000

Merged
merged 2 commits into from Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/parts/Axis.js
Expand Up @@ -3948,8 +3948,8 @@ H.extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {
// The correctFloat cures #934, float errors on full tens. But it
// was too aggressive for #4360 because of conversion back to lin,
// therefore use precision 15.
axis.min = correctFloat(axis.log2lin(axis.min), 15);
axis.max = correctFloat(axis.log2lin(axis.max), 15);
axis.min = correctFloat(axis.log2lin(axis.min), 16);
axis.max = correctFloat(axis.log2lin(axis.max), 16);
}
// handle zoomed range
if (axis.range && defined(axis.max)) {
Expand Down
24 changes: 19 additions & 5 deletions samples/unit-tests/axis/extremes/demo.js
Expand Up @@ -67,11 +67,13 @@ QUnit.test('Log axis extremes, issue #934', function (assert) {
series: [{
data: [
10000,
8900]
8900
]
}, {
data: [
8600,
7700]
7700
]
}]
});

Expand All @@ -90,8 +92,7 @@ QUnit.test('Log axis extremes, issue #934', function (assert) {

});


QUnit.test('Log axis extremes, issue #4360', function (assert) {
QUnit.test('Log axis extremes and precision', function (assert) {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
Expand Down Expand Up @@ -123,7 +124,20 @@ QUnit.test('Log axis extremes, issue #4360', function (assert) {
assert.strictEqual(
chart.yAxis[0].ticks[chart.yAxis[0].tickPositions[0]].label.textStr,
'30',
'Label is 30'
'Label should be exactly 30 (#4360)'
);

chart.update({
series: [{
data: [650]
}]
}, true, true);

assert.strictEqual(
chart.yAxis[0].ticks[chart.yAxis[0].tickPositions[0]].label.textStr,
'650',
'Single value logarithmic yAxis should show the same ' +
'tick label as the points value (#11727)'
);
});

Expand Down
4 changes: 2 additions & 2 deletions ts/parts/Axis.ts
Expand Up @@ -5072,8 +5072,8 @@ H.extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */{
// The correctFloat cures #934, float errors on full tens. But it
// was too aggressive for #4360 because of conversion back to lin,
// therefore use precision 15.
axis.min = correctFloat(axis.log2lin(axis.min as any), 15);
axis.max = correctFloat(axis.log2lin(axis.max as any), 15);
axis.min = correctFloat(axis.log2lin(axis.min as any), 16);
axis.max = correctFloat(axis.log2lin(axis.max as any), 16);
}

// handle zoomed range
Expand Down