Modules@robinpath/chart

@robinpath/chart

0.1.1Public

Generate chart images (PNG/JPEG) using Chart.js. Supports bar, line, pie, doughnut, scatter, radar, polarArea, and bubble charts with auto-coloring and customizable titles, legends, and dimensions.

@robinpath/chart

Generate chart images (PNG/JPEG) using Chart.js. Supports bar, line, pie, doughnut, scatter, radar, polarArea, and bubble charts with auto-coloring and customizable titles, legends, and dimensions.

Category Functions Auth License

Why use this module?

The chart module lets you:

  • Create a new chart (bar, line, pie, doughnut, scatter, radar, polarArea, bubble)
  • Add a dataset to an existing chart
  • Update chart options (title, size, legend, type, labels)
  • Render chart and save to PNG or JPEG file
  • Render chart and return as base64 data URL string

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/chart

Quick Start

No credentials needed — start using it right away:

chart.addDataset "c1" {"label": "Costs", "data": [50, 80]}

Available Functions

FunctionDescription
chart.createCreate a new chart (bar, line, pie, doughnut, scatter, radar, polarArea, bubble)
chart.addDatasetAdd a dataset to an existing chart
chart.updateUpdate chart options (title, size, legend, type, labels)
chart.saveRender chart and save to PNG or JPEG file
chart.toBase64Render chart and return as base64 data URL string
chart.toBufferRender chart and return as raw Buffer
chart.destroyRemove chart from memory

Examples

Add a dataset to an existing chart

chart.addDataset "c1" {"label": "Costs", "data": [50, 80]}

Update chart options (title, size, legend, type, labels)

chart.update "c1" {"title": "Updated Title", "width": 1200}

Render chart and save to PNG or JPEG file

chart.save "c1" "./output/chart.png"

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/chart";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  chart.addDataset "c1" {"label": "Costs", "data": [50, 80]}
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.1latestyesterday
Install
$ robinpath install @robinpath/chart
Version0.1.1
LicenseMIT
Unpacked Size5.6 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

data