Skip to content

Commit

Permalink
fix: fix incorrect annotation when categorical data was missing (#219)
Browse files Browse the repository at this point in the history
When categorical data was missing, the axis showed null labels. This has been corrected.

fix #207
  • Loading branch information
Alex Bäuerle authored Jun 10, 2022
1 parent ebf1b2a commit d5d56e2
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/missing-coordinates/src/axes/AxisAnnotations.svelte
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<script lang="ts">
import AxisAnnotation from "./AxisAnnotation.svelte";
import { drawConfig, data, axisLabelTopOffset } from "../stores";
import { drawConfig, axisLabelTopOffset, axes } from "../stores";
$: annotations = $data.axes.map((value, index) => {
if (value.data.length > 0 && typeof value.data[0] !== "string") {
const numberData = value.data as number[];
return {
show: true,
min: Math.min(...numberData),
max: Math.max(...numberData),
offset: index * $drawConfig.axesSpacing,
};
} else {
$: annotations = $axes.map((axis, index) => {
if (axis.categorical) {
return {
show: false,
min: 0,
max: 0,
offset: index * $drawConfig.axesSpacing,
};
}
return {
show: true,
min: axis.extremes !== undefined ? axis.extremes.min : 0,
max: axis.extremes !== undefined ? axis.extremes.max : 0,
offset: index * $drawConfig.axesSpacing,
};
});
</script>

Expand Down

0 comments on commit d5d56e2

Please # to comment.