Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ChartCrafter

License

Lightweight JavaScript library that wraps Chart.js to render any JSON data source into interactive, responsive charts with minimal configuration.

Installation

Include after Chart.js in your project or WordPress theme:

<scriptsrc="https://cdn.jsdelivr.net/npm/chart.js"></script><scriptsrc="chartcrafter.js"></script>

Usage

newChartCrafter('#my-chart',{source: 'https://example.com/data.json',type: 'bar',height: 400,title: 'Monthly Sales'});

Configuration

OptionTypeDefaultDescription
sourcestringnullURL of your JSON data (required)
typestring'bar'Chart type: bar, line, pie, doughnut, radar, polarArea
heightnumber400Chart height in pixels
titlestring''Chart title
responsivebooleantrueMake chart responsive

JSON Data Format

Simple format (single series):

{
"labels": ["Jan", "Feb", "Mar"],
"data": [120, 190, 150]
}

Multi-series format:

{
"labels": ["Jan", "Feb", "Mar"],
"datasets": [
{ "label": "Revenue", "data": [120, 190, 150] },
{ "label": "Costs", "data": [80, 100, 90] }
]
}

Tests

npm install
npm test

License

GPL v2 or later.


Part of the Crafter plugin family by TableCrafter.

About

Lightweight, standalone JavaScript library for visualizing JSON data into beautiful Charts.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages