diff --git a/samples/unit-tests/axis/pointplacement/demo.js b/samples/unit-tests/axis/pointplacement/demo.js index c8b42caa14c..7a76f4ba33b 100644 --- a/samples/unit-tests/axis/pointplacement/demo.js +++ b/samples/unit-tests/axis/pointplacement/demo.js @@ -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; diff --git a/ts/Core/Axis/Axis.ts b/ts/Core/Axis/Axis.ts index 95838547897..c6543468a41 100644 --- a/ts/Core/Axis/Axis.ts +++ b/ts/Core/Axis/Axis.ts @@ -981,7 +981,6 @@ 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, @@ -989,7 +988,6 @@ class Axis { 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 @@ -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; @@ -3943,7 +3948,6 @@ class Axis { } ticks[-1].render(-1); } - } // Alternate grid color diff --git a/ts/Core/Axis/Color/ColorAxis.ts b/ts/Core/Axis/Color/ColorAxis.ts index e8a5c3e1ae0..b0f64ee0750 100644 --- a/ts/Core/Axis/Color/ColorAxis.ts +++ b/ts/Core/Axis/Color/ColorAxis.ts @@ -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 @@ -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 } @@ -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]; diff --git a/ts/Core/Axis/Color/ColorAxisDefaults.ts b/ts/Core/Axis/Color/ColorAxisDefaults.ts index 089949debb1..49852a5c89a 100644 --- a/ts/Core/Axis/Color/ColorAxisDefaults.ts +++ b/ts/Core/Axis/Color/ColorAxisDefaults.ts @@ -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<*>}