Aller au contenu
Skillpedia
Sites et interfaces (frontend)6.2k · #14402

developing-chart-types-locally

Ce qu’il fait

Cette compétence guide la modification d'un type de graphique personnalisé créé ou téléchargé avec la CLI Lightdash. Elle s'adresse aux développeurs qui créent leurs propres composants visuels pour Lightdash.

Quand l’utiliser

  • ✓Quand vous voulez modifier un type de graphique personnalisé que vous avez créé avec la CLI Lightdash.
  • ✓Quand vous devez téléverser un type de graphique et vérifier qu'il fonctionne.
  • ✓Quand vous voulez prévisualiser un type de graphique en local avec des données d'exemple.

Lien du skill

https://github.com/lightdash/lightdash/blob/main/packages/cli/src/handlers/apps/authoring/developing-chart-types-locally/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/lightdash/lightdash/blob/main/packages/cli/src/handlers/apps/authoring/developing-chart-types-locally/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Modifie mon type de graphique à bulles personnalisé pour afficher la légende à droite, puis téléverse-le et vérifie qu'il fonctionne.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

La compétence explique les règles qu'un composant de graphique doit respecter, comme obtenir ses données uniquement depuis l'hôte. Elle guide ensuite les étapes de téléversement et de vérification, ainsi que l'aperçu local avec des données de test.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Developing Lightdash Custom Chart Types Locally

You are editing a Lightdash custom chart type (a reusable visualization, the data_app_viz template) that was created or downloaded with the Lightdash CLI. It is ONE chart component that Lightdash hands data and settings to — not a data app.

The contract is the reusable-visualization skill

Read the reusable-visualization skill before editing. It defines everything the component may do: useVizContext() is the only channel to the host for data, options and resolved colours; the component runs no query and owns no explore. App-level query APIs (query builder, useLightdash, filters) do not apply here and must not be introduced.

Never hand-build a data-point action menu when useVizContext().pointMenu.enabled — call pointMenu.open({ x, y, row, metric }) and let Lightdash render it; an in-viz menu is only the fallback for hosts that predate the capability.

External HTTP APIs go through linked connections

A chart type's rows always come from useVizContext(). Anything else it needs from outside Lightdash, such as reference data from a third-party API or images from a URL, goes through an external connection, the same way it does for data apps.

  • The one sanctioned path to a third-party API is client.externalFetch('<alias>', ...), with the client from useLightdashClient(), against an external connection a project admin configured and linked to this chart type. Do not add direct fetch or REST calls; the sandbox blocks them.
  • Images load only from a linked connection that has public images enabled, from its exact origin. Never put Lightdash data in an image URL.
  • Links are declared in this folder's lightdash-app.yml under externalConnections (- alias: stripe / connectionSlug: stripe-api). When the key is present, upload reconciles the chart type's links to match it exactly, so to link a connection that already exists in the project, add its {alias, connectionSlug} entry and upload. Do not remove entries casually: an entry removed from the list (or an empty list) unlinks on upload, and a manifest without the key leaves links unchanged.
  • Watch the upload output: a connectionSlug that doesn't exist in the target project is skipped with a warning (the chart type uploads, but externalFetch on that alias fails at runtime). If a link is skipped or forbidden, report it to the user instead of retrying.
  • If the chart type needs an API with no existing connection, stop and say so. An admin must create the connection first; then it can be linked via the manifest as above.
  • Connections are not emulated by the local fixture preview. Test them after upload, in the explorer.

The declaration lives in lightdash-app.yml — keep it in lockstep

In the in-product builder the declaration is emitted by the generation run; locally it is the vizSchema block in this folder's lightdash-app.yml, and upload round-trips it to the server (without it the chart type never appears in the explorer's chart type picker).

The correspondence must be exact in both directions: every key the component reads from fieldMapping or options is declared in vizSchema, and everything declared there is read by the component. When an edit changes what the component reads — a new field, a renamed option, a removed control — update vizSchema in the same edit. A declared option nothing reads is a dead control; a read key nothing declares never receives a value.

The edit → validate → upload → verify loop

Run these commands from this folder under chart-types/<slug>/. The upload path ../.. selects the Lightdash content root.

  1. Edit files under src/ (and vizSchema when the declaration changes).
  2. lightdash apps validate checks source and manifest (including that vizSchema parses); lightdash apps validate --build adds the Cloud-parity Vite production build. A build failure is a validation error with the Vite output.
  3. lightdash upload --chart-types <slug> --path ../.. (the slug from lightdash-app.yml) — the server rebuilds and serves it.
  4. Verify in Lightdash: open any explore, run a query with at least the required fields' shapes (e.g. a dimension and a metric), pick this chart type in the chart type picker, and map its fields. Check every config option you declared actually changes the chart.

Saved charts already using this chart type may pin a version; unpinned charts move to the newly uploaded version right away. W

Questions fréquentes

Un type de graphique peut-il lancer sa propre requête ?

Non, la compétence indique qu'un type de graphique reçoit ses données de Lightdash et ne lance pas sa propre requête.

Comment le prévisualiser ?

La compétence décrit un aperçu local qui utilise des données de test fournies.

Qu'en est-il des API externes ?

Les requêtes externes passent par une connexion liée configurée par un administrateur dans le projet.

Détails

Description originale de l’auteur

Use when editing a locally created or downloaded Lightdash custom chart type (data_app_viz) — the vizSchema/component lockstep contract, the upload-and-verify loop, the local fixture preview, and how a chart type reaches the official registry.

repo: lightdash/lightdash

Popularité

Étoiles GitHub
6.2k
Position au classement
#14402
Licence
—
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires