charts README

The project's README from github.com/frappe/charts. As one markdown file: README.md.

Frappe Charts logo

Frappe Charts

Simple, modern SVG charts for the web, with zero dependencies

Test and Release npm version gzipped size

Live demos

Frappe Charts: mixed axis, line with a today marker, horizontal bar and donut charts

Frappe Charts

Frappe Charts is a small charting library with a simple API. It started as the sales graph in ERPNext and is now used for charts across the Frappe Framework.

Key Features

Usage

npm install frappe-charts
import { Chart } from 'frappe-charts';
import 'frappe-charts/dist/frappe-charts.min.css';

Or load it in the browser:

<link rel="stylesheet" href="https://unpkg.com/frappe-charts/dist/frappe-charts.min.css">
<script src="https://unpkg.com/frappe-charts/dist/frappe-charts.umd.js"></script>
<!-- the browser build exposes window['frappe-charts'].Chart -->
const chart = new Chart('#chart', {
  title: 'Sales by channel',
  type: 'axis-mixed', // or 'bar', 'line', 'donut', 'pie', 'percentage', 'heatmap'
  height: 250,
  colors: ['#318ad8', '#30a66d'],
  data: {
    labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
    datasets: [
      { name: 'Online', chartType: 'bar', values: [42, 48, 39, 55, 61, 58] },
      { name: 'Target', chartType: 'line', values: [60, 62, 64, 68, 72, 76] }
    ],
    yMarkers: [{ label: 'Goal', value: 70 }]
  }
});

chart.addDataPoint('Jul', [66, 80]);
chart.export();

For a horizontal bar chart, use type: 'bar' with barOptions: { horizontal: 1 }.

Development Setup



Frappe Technologies

charts (frappe/charts)

Searching Database…

15.1K ·GitHub
What is this?Frappe Charts is a lightweight JavaScript charting library that renders simple, responsive charts as SVG, with zero dependencies.
Is this a hosted service or a library I embed in my own page?It's a library: you import it into a project or drop a script tag into your HTML, and charts render as SVG right in the browser.
How do I add it to a project?Import the installed package, or include the script tag directly in your HTML. To work on the library itself, clone the repo, run npm install, then npm run dev.
Does it pull in any other libraries?No - zero dependencies is the headline feature, so nothing else has to be installed first.
What kinds of charts can it draw?Axis charts as bars, lines and areas, plus mixed axis, pie, percentage and heatmap charts. You can annotate charts with x and y markers, highlight regions and add tooltips.
Why did the author build a new charting library instead of using c3.js?ERPNext needed a simple sales-history graph, but c3.js didn't match the product's classic design and other JS libraries felt too complex or rigid. So the author wrote a small library focused on turning value pairs into simple shapes and positions.
Can I update the data after a chart is already on the page?Yes - add, remove or update individual data points in place, or refresh the entire dataset. Colors, animations and custom titles are configurable too.
Can I try it without installing anything?Yes - the README links to live demos, including an editable version on CodeSandbox, so you can experiment in the browser first.
What are similar projects?uPlot, d3, apexcharts.js, Chart.js, plotly.js, visx, highcharts, G6
Creator
frappe
Size
6.9 MB
Stars
15.1K
Age
9y
Commits · 90 Days