Count axes are linear with whole-number or one-decimal tick labels from one shared builder
The EEG quality chart's count axis was typed as a category axis, which put 0 on the right; every count and value axis now takes its type and tick format from valueAxis: linear, whole numbers for counts (one step when the range is narrow), one decimal otherwise, with Plotly choosing the number of ticks.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { banded } from '../gobernanza/figures';
|
||||
import { wholeNumberAxis } from '../indicadores/figures';
|
||||
import { valueAxis } from '../indicadores/figures';
|
||||
import { Figure, PALETTE } from '../plot';
|
||||
import { Metric, Pair, Site, Study, TeaStep, zoneLabel } from './tea-data';
|
||||
|
||||
@@ -252,10 +252,7 @@ export function ageNorm(rows: Centile[], metric: Metric, age: number): Figure {
|
||||
xaxis: { title: { text: 'Edad (meses)' } },
|
||||
yaxis: {
|
||||
title: { text: metric.unit ?? 'Valor' },
|
||||
...wholeNumberAxis([
|
||||
metric.value,
|
||||
...rows.flatMap(({ p5, median, p95 }) => [p5, median, p95]),
|
||||
]),
|
||||
...valueAxis([metric.value, ...rows.flatMap(({ p5, median, p95 }) => [p5, median, p95])]),
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -333,7 +330,7 @@ export function zBars(eeg: Study): SingleTrace {
|
||||
layout: {
|
||||
xaxis: {
|
||||
title: { text: 'Puntuación z' },
|
||||
...wholeNumberAxis([-limit, limit]),
|
||||
...valueAxis([-limit, limit]),
|
||||
range: [-limit, limit],
|
||||
},
|
||||
yaxis: { autorange: 'reversed', automargin: true },
|
||||
@@ -394,7 +391,7 @@ export function probabilityCurve(
|
||||
data,
|
||||
layout: {
|
||||
xaxis: { title: { text: 'Puntuación z' } },
|
||||
yaxis: { title: { text: 'Probabilidad (%)' }, ...wholeNumberAxis([0, 100]), range: [0, 100] },
|
||||
yaxis: { title: { text: 'Probabilidad (%)' }, ...valueAxis([0, 100]), range: [0, 100] },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user