1.1.0 • Published 2 years ago

charttopng v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

charttopng

Convert ChartJS JSON configuration to PNG image

Installation

npm install -g charttopng

Usage

charttopng convert CONFIG_PATH OUTPUT_PATH

Example

charttopng convert chart.json chart.png

chart.json

{
    "type": "bar",
    "data": {
        "labels": [
            "January",
            "February",
            "March",
            "April",
            "May",
            "June",
            "July"
        ],
        "datasets": [
            {
                "label": "Fully Rounded",
                "data": [
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    7
                ],
                "borderColor": "red",
                "backgroundColor": "blue",
                "borderWidth": 2,
                "borderRadius": 1.7976931348623157e+308,
                "borderSkipped": false
            }
        ]
    },
    "options": {
        "responsive": true,
        "plugins": {
            "legend": {
                "position": "top"
            },
            "title": {
                "display": true,
                "text": "Chart.js Bar Chart"
            }
        }
    }
}