Fix: Y Axis Chart Width
This commit is contained in:
@@ -2,7 +2,7 @@ import { Box, CircularProgress, Alert } from '@mui/material';
|
||||
import type { CotizacionBolsa } from '../models/mercadoModels';
|
||||
import { useApiData } from '../hooks/useApiData';
|
||||
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
|
||||
import { formatFullDateTime, formatCurrency2Decimal } from '../utils/formatters';
|
||||
import { formatFullDateTime, formatCurrency2Decimal, formatCurrency } from '../utils/formatters';
|
||||
|
||||
interface HistoricalChartWidgetProps {
|
||||
ticker: string;
|
||||
@@ -46,7 +46,7 @@ export const HistoricalChartWidget = ({ ticker, mercado, dias }: HistoricalChart
|
||||
// 2. Formateador de ticks para el eje Y más robusto
|
||||
const yAxisTickFormatter = (tick: number) => {
|
||||
// Usamos el formateador de moneda
|
||||
return `$${formatCurrency2Decimal(tick)}`;
|
||||
return `$${formatCurrency(tick)}`;
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -57,7 +57,7 @@ export const HistoricalChartWidget = ({ ticker, mercado, dias }: HistoricalChart
|
||||
<YAxis
|
||||
domain={[domainMin, domainMax]}
|
||||
tickFormatter={yAxisTickFormatter}
|
||||
width={80} // Damos un poco más de espacio para números grandes
|
||||
width={75} // Damos un poco más de espacio para números grandes
|
||||
/>
|
||||
<Tooltip
|
||||
formatter={(value: number) => [`$${formatCurrency2Decimal(value)}`, 'Precio']}
|
||||
|
||||
@@ -14,11 +14,9 @@ export function useApiData<T>(endpoint: string) {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
// --- V CORRECCIÓN DEFINITIVA V ---
|
||||
// Construimos la URL completa y absoluta para la llamada.
|
||||
const fullUrl = `${API_ROOT}${endpoint}`;
|
||||
const response = await apiClient.get<T>(fullUrl);
|
||||
// --- ^ CORRECCIÓN DEFINITIVA ^ ---
|
||||
setData(response.data);
|
||||
} catch (err) {
|
||||
if (err instanceof AxiosError) {
|
||||
|
||||
@@ -31,7 +31,7 @@ const widgetRegistry = {
|
||||
'mercado-agro-tarjetas': MercadoAgroCardWidget,
|
||||
'mercado-agro-tabla': MercadoAgroWidget,
|
||||
|
||||
// Página completa como un widget
|
||||
// Widget Página datos crudos
|
||||
'pagina-datos-crudos': RawDataView,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user