Instalación

Elige tu integración y construye tu primer gráfico completo.

Distribución actual

Instala el paquete de tu integración desde la raíz del proyecto. El motor de cálculo se resuelve como dependencia del renderer.

Paquetes de la integración
PaqueteFunciónInstalación
@neural-charts/webSVG e interacción en el navegador.Instala este paquete.
@neural-charts/coreCálculo y geometría.Dependencia del renderer.

JavaScript o TypeScript

Instala @neural-charts/web. Incluye los tipos TypeScript y declara la versión compatible de Core, que npm instala automáticamente. Usa el ejemplo en la entrada de tu aplicación y llama a dispose al retirar su vista.

Ejemplo
npm install @neural-charts/web
index.html
<div id="chart"></div>
<button type="button" id="remove-chart">Retirar gráfica</button>
<script type="module" src="/src/main.ts"></script>
main.ts
import { createChart, type ChartData, type ChartOptions } from '@neural-charts/web';

const data: ChartData = {
  "type": "line",
  "axes": {
    "x": {
      "type": "linear"
    },
    "y": {
      "type": "linear",
      "includeZero": true
    }
  },
  "series": [
    {
      "id": "visits",
      "name": "Visitas",
      "data": [
        {
          "id": "mon",
          "x": 1,
          "y": 12
        },
        {
          "id": "tue",
          "x": 2,
          "y": 18
        },
        {
          "id": "wed",
          "x": 3,
          "y": 15
        }
      ]
    }
  ]
};
const options: ChartOptions = {
  "title": "Actividad semanal",
  "locale": "es",
  "height": 360,
  "tooltip": {
    "enabled": true,
    "crosshair": true
  }
};
const host = document.getElementById('chart');
if (!host) throw new Error('Chart host missing');
const result = createChart(host, data, options, {
  instanceId: 'weekly-visits',
  onPointActivate: event => console.log(event.id, event.observation.value),
  onDiagnostic: diagnostic => console.error(diagnostic)
});
if (result.status === 'invalid') throw new Error(result.diagnostic.message);
const chart = result.value;
document.getElementById('remove-chart')?.addEventListener('click', () => {
  chart.destroy();
}, { once: true });
main.js
// @ts-check
import { createChart } from '@neural-charts/web';

/** @type {import('@neural-charts/web').ChartData} */
const data = {
  "type": "line",
  "axes": {
    "x": {
      "type": "linear"
    },
    "y": {
      "type": "linear",
      "includeZero": true
    }
  },
  "series": [
    {
      "id": "visits",
      "name": "Visitas",
      "data": [
        {
          "id": "mon",
          "x": 1,
          "y": 12
        },
        {
          "id": "tue",
          "x": 2,
          "y": 18
        },
        {
          "id": "wed",
          "x": 3,
          "y": 15
        }
      ]
    }
  ]
};
/** @type {import('@neural-charts/web').ChartOptions} */
const options = {
  "title": "Actividad semanal",
  "locale": "es",
  "height": 360,
  "tooltip": {
    "enabled": true,
    "crosshair": true
  }
};
const host = document.getElementById('chart');
if (!host) throw new Error('Chart host missing');
const result = createChart(host, data, options, {
  instanceId: 'weekly-visits',
  onPointActivate: event => console.log(event.id, event.observation.value),
  onDiagnostic: diagnostic => console.error(diagnostic)
});
if (result.status === 'invalid') throw new Error(result.diagnostic.message);
const chart = result.value;
document.getElementById('remove-chart')?.addEventListener('click', () => {
  chart.destroy();
}, { once: true });

Ver dónde guardar cada archivo y cómo arrancar la demo

Importaciones públicas

No enlaces fuentes, importes rutas dist internas ni copies el cálculo dentro de tu aplicación.

Ejemplo
import { createChart } from '@neural-charts/web';

Si algo no encaja