@bndynet/ichat-renderer-chart
v3.3.1
Published
Chart fenced-code renderer for @bndynet/ichat: bar, line, area, pie, and gauge charts via @bndynet/icharts.
Maintainers
Readme
@bndynet/ichat-renderer-chart
Chart fenced-code renderer for iChat. Renders ````chartfence blocks as interactive chart visualizations via@bndynet/icharts`.
Install
npm install @bndynet/ichat-renderer-chartUsage
Import before the first <i-chat> element connects to the DOM — auto-registers on import:
import "@bndynet/ichat-renderer-chart";Or register manually with custom options:
import { registerCodeRenderer } from "@bndynet/ichat";
import { createChartRenderer } from "@bndynet/ichat-renderer-chart";
registerCodeRenderer(createChartRenderer({ codeToggle: false }));Fence format
```chart
{"type":"bar","data":{"categories":["Q1","Q2","Q3"],"series":[{"name":"Sales","data":[10,20,30]}]},"options":{"title":"Sales"}}
```Supported chart types: bar, line, area, pie, gauge.
API
| Export | Description |
| ---------------------------- | ------------------------------------------- |
| chartRenderer | Pre-built BlockRenderer (code toggle on) |
| createChartRenderer(opts?) | Factory with customizable RendererOptions |
| chartPlugin | markdown-it plugin (for md.use()) |
| ChartInput | TypeScript type for chart JSON shape |
Peer dependencies
@bndynet/ichat-messages and markdown-it are peer dependencies; the required
version ranges are declared in package.json.
The renderer uses the library's audited trusted: true path so the <i-chart>
custom element is preserved. JSON values are escaped before they are written to
HTML attributes; consumers do not need to change the renderer security config.
License
MIT
