📊img-charts

A lightweight TypeScript library for managing ECharts visualizations with ease.

Introduction

img-charts is a TypeScript library that provides a fluent API for managing ECharts visualizations. It allows you to create, update, and export charts with ease.

chart chart

Features

Usage

Create a Chart


const option: ChartOption = {
    width: 1024,
    height: 768,
    // ...other ECharts options...
};

const img = document.querySelector('img#chart');
const chart = createChart(option);

img.src = chart.generateSvg(2);
            

Update a Chart


chart.update({
    width: 1200,
    // ...other ECharts options...
});
            

Export as Image


const blob = await createChartImage({
    option,
    type: 'png',
    quality: 2,
});
            

Get Image URL


const imageUrl = await createChartImgSrc({
    option,
    type: 'jpeg',
    quality: 2,
});
            

Installation


npm install https://github.com/jibbex/img-charts.git