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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix/20166-columns-gridLines-and-pointPlacement #20414

Closed
Closed
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
5 changes: 5 additions & 0 deletions samples/unit-tests/axis/pointplacement/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ QUnit.test('Axis pointPlacement', assert => {
'No padded ticks'
);

assert.strictEqual(
axis.ticks[-1], undefined,
'No tick at -1 when pointPlacement is set for cartesian series'
);

controller.pan([200, 60], [400, 60]);

const rangeBefore = axis.max - axis.min;
Expand Down
14 changes: 9 additions & 5 deletions ts/Core/Axis/Axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -981,15 +981,13 @@ class Axis {
cHeight = (old && chart.oldChartHeight) || chart.chartHeight,
cWidth = (old && chart.oldChartWidth) || chart.chartWidth,
transB = axis.transB;

let translatedValue = options.translatedValue,
force = options.force,
x1: number,
y1: number,
x2: number,
y2: number,
skip: boolean;

// eslint-disable-next-line valid-jsdoc
/**
* Check if x is between a and b. If not, either move to a/b
Expand Down Expand Up @@ -1030,9 +1028,16 @@ class Axis {

x1 = x2 = Math.round(translatedValue + transB);
y1 = y2 = Math.round(cHeight - translatedValue - transB);
if (!isNumber(translatedValue)) { // No min or max

if (
!axis.horiz ?
(y1 < axisTop || y1 > axisTop + axis.height) :
(x1 < axisLeft || x1 > axisLeft + axis.width) ||
// #7175, don't force it when path is invalid
!isNumber(translatedValue)
) {
skip = true;
force = false; // #7175, don't force it when path is invalid
force = false;
} else if (axis.horiz) {
y1 = axisTop;
y2 = cHeight - axis.bottom;
Expand Down Expand Up @@ -3943,7 +3948,6 @@ class Axis {
}
ticks[-1].render(-1);
}

}

// Alternate grid color
Expand Down
7 changes: 6 additions & 1 deletion ts/Core/Axis/Color/ColorAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ class ColorAxis extends Axis implements AxisLike {
if (userOptions.dataClasses) {
axis.initDataClasses(userOptions);
}

if (userOptions.title) {
merge(axis.options.title, userOptions.title);
}

axis.initStops();

// Override original axis properties
Expand Down Expand Up @@ -280,7 +285,6 @@ class ColorAxis extends Axis implements AxisLike {
// Forced options
{
showEmpty: false,
title: null,
visible: this.chart.options.legend.enabled &&
userOptions.visible !== false
}
Expand Down Expand Up @@ -327,6 +331,7 @@ class ColorAxis extends Axis implements AxisLike {
*/
public getOffset(): void {
const axis = this;
const renderer = axis.chart.renderer;
const group = axis.legendItem?.group;
const sideOffset = axis.chart.axisOffset[axis.side];

Expand Down
2 changes: 1 addition & 1 deletion ts/Core/Axis/Color/ColorAxisDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import { Palette } from '../../Color/Palettes.js';
* categories, crosshair, dateTimeLabelFormats, left,
* lineWidth, linkedTo, maxZoom, minRange, minTickInterval,
* offset, opposite, pane, plotBands, plotLines,
* reversedStacks, scrollbar, showEmpty, title, top,
* reversedStacks, scrollbar, showEmpty, top,
* zoomEnabled
* @product highcharts highstock highmaps
* @type {*|Array<*>}
Expand Down