diff --git a/src/app/indicadores/figures.ts b/src/app/indicadores/figures.ts index 4b8ae2f..832ed55 100644 --- a/src/app/indicadores/figures.ts +++ b/src/app/indicadores/figures.ts @@ -5,7 +5,12 @@ import type { Catalog, Category, HistoryPanel } from './pages'; const OLIVE = '#A8C243'; const ROSE = '#C24269'; export const SHORT = '.1~f'; -export const percentAxis = { ticksuffix: ' %', tickformat: '.0f', hoverformat: SHORT }; +export const percentAxis = { + type: 'linear' as const, + ticksuffix: ' %', + tickformat: '.0f', + hoverformat: SHORT, +}; const count = (n: number) => n.toLocaleString('es-MX'); const percent = (n: number) => (Math.round(n * 10) / 10).toLocaleString('es-MX'); diff --git a/src/app/plot.ts b/src/app/plot.ts index bd4a226..22f38eb 100644 --- a/src/app/plot.ts +++ b/src/app/plot.ts @@ -23,11 +23,11 @@ const LAYOUT: Partial = { legend: { orientation: 'h', x: 0, xanchor: 'left', y: 1.02, yanchor: 'bottom' }, hoverlabel: { font: { family: 'Roboto, Arial, sans-serif', size: 13 } }, }; -const AXIS = { +const axisDefaults = (): Partial => ({ automargin: true, title: { standoff: 12 }, ticklabelstandoff: 4, -} as Partial; +}); function layoutOf(layout: Partial = {}): Partial { const axes = Object.fromEntries( @@ -36,13 +36,14 @@ function layoutOf(layout: Partial = {}): Partial { .map(([k, v]) => { const axis = (v ?? {}) as Partial; const title = typeof axis.title === 'string' ? { text: axis.title } : axis.title; - return [k, { ...AXIS, ...axis, title: { ...AXIS.title, ...title } }]; + const base = axisDefaults(); + return [k, { ...base, ...axis, title: { ...base.title, ...title } }]; }), ); return { ...LAYOUT, - xaxis: AXIS, - yaxis: AXIS, + xaxis: axisDefaults(), + yaxis: axisDefaults(), ...layout, ...axes, legend: { ...LAYOUT.legend, ...layout.legend },