Skip to content

Commit

Permalink
🐛 Fix axis alignment when scale domain is 0 to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-m-santos committed Nov 11, 2024
1 parent 767473e commit bf10433
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/lib/src/components/core/lume-axis/lume-axis.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,22 +179,18 @@ const { allOptions } = useOptions<AxisOptions>(
const { showTick } = useSkip(scale, tickRefs, allOptions);
const alignAxisBaseline = computed(
() => isEmpty.value || !scale.value || isScaleEmpty(scale.value)
);
const axisTransform = computed(() => {
// if empty, aligns baseline to the bottom
if (
computedType.value === 'y' &&
isEmpty.value &&
(!scale.value || isScaleEmpty(scale.value))
) {
if (computedType.value === 'y' && alignAxisBaseline.value) {
return `translate(0, ${containerSize.value?.height / 2})`;
}
// if empty, aligns baseline to the left
if (
computedType.value === 'x' &&
isEmpty.value &&
(!scale.value || isScaleEmpty(scale.value))
) {
if (computedType.value === 'x' && alignAxisBaseline.value) {
return `translate(-${containerSize.value?.width / 2}, ${
containerSize.value?.height
})`;
Expand Down

0 comments on commit bf10433

Please sign in to comment.