diff --git a/src/ChartInternal/internals/clip.ts b/src/ChartInternal/internals/clip.ts index 2ca9ac5f9..a7d11653a 100644 --- a/src/ChartInternal/internals/clip.ts +++ b/src/ChartInternal/internals/clip.ts @@ -57,13 +57,13 @@ export default { const isRotated = config.axis_rotated; const left = Math.max(30, margin.left) - (isRotated ? 0 : 20); - const x = isRotated ? -(1 + left) : -(left - 1); - const y = -Math.max(15, margin.top); - const w = isRotated ? margin.left + 20 : width + 10 + left; - // less than 20 is not enough to show the axis label 'outer' without legend const h = (isRotated ? (margin.top + height) + 10 : margin.bottom) + 20; + const x = isRotated ? -(1 + left) : -(left - 1); + const y = -Math.max(15, margin.bottom); + const w = isRotated ? margin.left + 20 : width + 10 + left; + node .attr("x", x) .attr("y", y) diff --git a/src/config/Options/axis/x.ts b/src/config/Options/axis/x.ts index b2a90db03..4f2b12ea0 100644 --- a/src/config/Options/axis/x.ts +++ b/src/config/Options/axis/x.ts @@ -46,6 +46,7 @@ export default { * - **log** type: * - the x values specified by [`data.x`](#.data%25E2%2580%25A4x)(or by any equivalent option), must be exclusively-positive. * - x axis min value should be >= 0. + * - for 'category' type, `data.xs` option isn't supported. * * @name axis․x․type * @memberof Options diff --git a/test/internals/title-spec.ts b/test/internals/title-spec.ts index 6eaea313a..fcdd6e75a 100644 --- a/test/internals/title-spec.ts +++ b/test/internals/title-spec.ts @@ -96,6 +96,14 @@ describe("TITLE", () => { args.title.padding.top + height + args.title.padding.bottom ); }); + + it("check x axis 's height", () => { + const {internal: {state}, $: {svg}} = chart; + const xClipPath = svg.select(`#${state.clip.idXAxis} rect`).node(); + + expect(Math.abs(+xClipPath.getAttribute("y"))).to.be.below(100); + + }); }); describe("and position left", () => {