diff --git a/src/runtime/layout.ts b/src/runtime/layout.ts index 5ad7823d55..515238623d 100644 --- a/src/runtime/layout.ts +++ b/src/runtime/layout.ts @@ -29,11 +29,11 @@ import { } from './coordinate'; export function processAxisZ(components: G2GuideComponentOptions[]) { + const axisX = components.find(({ type }) => type === 'axisX'); + const axisY = components.find(({ type }) => type === 'axisY'); const axisZ = components.find(({ type }) => type === 'axisZ'); - if (axisZ) { - const axisX = components.find(({ type }) => type === 'axisX'); + if (axisX && axisY && axisZ) { axisX.plane = 'xy'; - const axisY = components.find(({ type }) => type === 'axisY'); axisY.plane = 'xy'; axisZ.plane = 'yz'; axisZ.origin = [axisX.bbox.x, axisX.bbox.y, 0]; diff --git a/src/runtime/transform.ts b/src/runtime/transform.ts index 981da8d9df..ad2e0b396e 100644 --- a/src/runtime/transform.ts +++ b/src/runtime/transform.ts @@ -260,8 +260,8 @@ export function addGuideToScale( }; const axisChannels = typeof axis === 'object' - ? Array.from(new Set(['x', 'y', ...Object.keys(axis)])) - : ['x', 'y']; + ? Array.from(new Set(['x', 'y', 'z', ...Object.keys(axis)])) + : ['x', 'y', 'z']; deepMix(mark, { scale: {