Otros

Línea de Tiempo

type: 'timeline'

Marcadores de eventos secuenciales dispuestos a lo largo de una línea; cada punto es un hito con un nombre, una etiqueta corta y una descripción opcional que se muestra en el tooltip. Horizontal por defecto, vertical cuando se activa chart.inverted.

Edita el JSON a la derecha y presiona Ejecutar (o ⌘/Ctrl + Intro) — los datos, títulos, categorías y colores se actualizan en vivo.

En Vivo
Línea de Tiempo
Editar · JSON

Formato de datos

{ name: string, label?, description?, color? }

Estructura de datos

El JSON que pasas dentro del gráfico — colócalo directamente en tu series.

data: [
  { name: 'Founded', label: '2019', description: 'First prototype shipped.' },
  { name: 'Series A', label: '2022', description: '$15M raised; team of 40.' },
  { name: 'v1.0', label: '2024', description: 'General availability launch.' }
]

Ejemplo

import KatuCharts from 'katucharts.js';

KatuCharts.chart('container', {
  chart: { type: 'timeline' },
  series: [{
    data: [
      { name: 'Founded', label: '2019', description: 'First prototype shipped.' },
      { name: 'Series A', label: '2022', description: '$15M raised; team of 40.' },
      { name: 'v1.0', label: '2024', description: 'General availability launch.' }
    ]
  }]
});

Opciones específicas del tipo

OpciónDescripción
dataLabels.formatPlantilla de etiqueta por punto, p. ej. '<b>{point.name}</b><br>{point.label}'.
dataLabels.alternateAlterna las etiquetas a ambos lados de la línea (por defecto true).
dataLabels.distanceSeparación entre el marcador y su etiqueta (por defecto 22).
chart.invertedDispone la línea de tiempo en vertical en lugar de horizontal.
markerMarcador por punto — { symbol, radius, lineColor, lineWidth }.
colorByPointColorea cada marcador desde la paleta (por defecto true).

Variaciones

Vertical (invertido)

Activa chart.inverted para disponer la línea de tiempo en vertical — ideal para columnas estrechas e historiales de formación.

KatuCharts.chart('container', {
  chart: { type: 'timeline', inverted: true },
  series: [{
    data: [
      { name: "Bachelor's", label: '2006 – 2008', description: 'Computer Networks — FAZ, Brazil' },
      { name: "Master's", label: '2014 – 2016', description: 'Computer Science — UFPA, Brazil' },
      { name: 'Doctorate', label: '2018 – 2022', description: 'Artificial Intelligence — USP, Brazil' }
    ]
  }]
});

Descripciones en el tooltip

Da una descripción a cada punto y aparece en el tooltip al pasar el cursor, manteniendo cortas las etiquetas.

KatuCharts.chart('container', {
  chart: { type: 'timeline' },
  tooltip: { pointFormat: '{point.description}' },
  series: [{
    data: [
      { name: 'Founded', label: '2019', description: 'First prototype shipped.' },
      { name: 'Series A', label: '2022', description: '$15M raised; team of 40.' },
      { name: 'v1.0', label: '2024', description: 'General availability launch.' }
    ]
  }]
});

Etiquetas en un solo lado

Pon dataLabels.alternate en false para mantener todas las etiquetas en el mismo lado de la línea.

KatuCharts.chart('container', {
  chart: { type: 'timeline' },
  series: [{
    dataLabels: { alternate: false },
    data: [
      { name: 'v1.0', label: 'Ene' },
      { name: 'v1.5', label: 'Abr' },
      { name: 'v2.0', label: 'Ago' },
      { name: 'v2.4', label: 'Nov' }
    ]
  }]
});

Etiquetas simples (marcadores redondos)

Pon dataLabels.borderWidth en 0 para quitar la caja y dejar que marcadores redondos más grandes guíen la línea de tiempo.

KatuCharts.chart('container', {
  chart: { type: 'timeline' },
  series: [{
    marker: { radius: 9 },
    dataLabels: { borderWidth: 0 },
    data: [
      { name: 'Discovery', label: 'T1' },
      { name: 'Diseño', label: 'T2' },
      { name: 'Build', label: 'T3' },
      { name: 'Launch', label: 'T4' }
    ]
  }]
});

Common errors

Why does my línea de tiempo chart render as a line chart?
The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
Why do I get "Cannot read properties of null (reading 'appendChild')"?
The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
Why is the chart rendering with zero height?
The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.

FAQ

How do I create a línea de tiempo chart in JavaScript?
Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'timeline' }, series: [...] }).
Why does my línea de tiempo chart render as a line chart?
The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
Why do I get "Cannot read properties of null (reading 'appendChild')"?
The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
Why is the chart rendering with zero height?
The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.
Las opciones comunes (color, visible, marker, dataLabels, animation, events, zones…) se aplican a todos los tipos — véase Configuración → series. Míralo renderizado en la galería.