Skip to content

Commit

Permalink
fix: hide axisZ when axis disabled (#6246)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver authored May 26, 2024
1 parent 46c4a8b commit b11be1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/runtime/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit b11be1f

Please sign in to comment.