Convert Figma logo to code with AI

frappe logocharts

Simple, responsive, modern SVG Charts with zero dependencies

14,928
717
14,928
141

Top Related Projects

64,334

Simple HTML5 Charts using the <canvas> tag

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

📊 Interactive JavaScript Charts built on SVG

101,622

JavaScript 3D Library.

16,856

Open-source JavaScript charting library behind Plotly and Dash

Highcharts JS, the JavaScript charting framework

Quick Overview

Frappe Charts is a lightweight, modern JavaScript charting library that offers simple and interactive SVG charts. It's designed to be easy to use and customize, making it suitable for both beginners and experienced developers who need to create visually appealing charts for web applications.

Pros

  • Simple and intuitive API for creating various chart types
  • Lightweight and fast, with minimal dependencies
  • Responsive design and mobile-friendly
  • Customizable appearance and animations

Cons

  • Limited advanced chart types compared to more comprehensive libraries
  • Fewer data visualization options for complex datasets
  • Documentation could be more detailed for advanced use cases

Code Examples

Creating a simple bar chart:

const data = {
    labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
    datasets: [
        { values: [18, 40, 30, 35, 8, 52, 17] }
    ]
};

const chart = new frappe.Chart("#chart", {
    data: data,
    type: 'bar',
    height: 250
});

Updating chart data dynamically:

chart.update({
    labels: ["A", "B", "C", "D"],
    datasets: [{ values: [25, 40, 30, 35] }]
});

Creating a line chart with multiple datasets:

const data = {
    labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
    datasets: [
        {
            name: "Dataset 1",
            values: [25, 40, 30, 35, 8, 52]
        },
        {
            name: "Dataset 2",
            values: [25, 50, -10, 15, 18, 32]
        }
    ]
};

const chart = new frappe.Chart("#chart", {
    data: data,
    type: 'line',
    height: 300,
    colors: ['#7cd6fd', '#743ee2']
});

Getting Started

  1. Include the Frappe Charts library in your HTML file:
<script src="https://unpkg.com/frappe-charts@latest/dist/frappe-charts.min.iife.js"></script>
  1. Create a container element for your chart:
<div id="chart"></div>
  1. Initialize a chart with JavaScript:
const data = {
    labels: ["12am-3am", "3am-6am", "6am-9am", "9am-12pm",
        "12pm-3pm", "3pm-6pm", "6pm-9pm", "9pm-12am"],
    datasets: [
        {
            name: "Some Data",
            values: [25, 40, 30, 35, 8, 52, 17, 4]
        }
    ]
};

const chart = new frappe.Chart("#chart", {
    title: "My Awesome Chart",
    data: data,
    type: 'bar',
    height: 250,
    colors: ['#7cd6fd']
});

Competitor Comparisons

64,334

Simple HTML5 Charts using the <canvas> tag

Pros of Chart.js

  • More extensive feature set and chart types
  • Larger community and ecosystem, with numerous plugins and extensions
  • Better documentation and examples

Cons of Chart.js

  • Larger file size, which may impact page load times
  • Steeper learning curve due to more complex API
  • Can be overkill for simple charting needs

Code Comparison

Chart.js:

new Chart(ctx, {
    type: 'bar',
    data: {
        labels: ['Red', 'Blue', 'Yellow'],
        datasets: [{
            label: 'My Dataset',
            data: [12, 19, 3]
        }]
    }
});

Charts:

const chart = new frappe.Chart("#chart", {
    data: {
        labels: ["Red", "Blue", "Yellow"],
        datasets: [{ values: [12, 19, 3] }]
    },
    type: 'bar'
});

Summary

Chart.js offers a more comprehensive charting solution with a wider range of features and community support, making it suitable for complex visualization needs. However, this comes at the cost of a larger file size and potentially more complex implementation.

Charts provides a simpler, lightweight alternative that's easier to get started with and may be preferable for basic charting requirements or projects where minimizing bundle size is crucial.

The choice between the two largely depends on the specific needs of your project, balancing feature requirements against performance considerations.

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

Pros of d3

  • Highly flexible and powerful, allowing for complex and custom visualizations
  • Extensive ecosystem with numerous plugins and extensions
  • Large and active community, providing support and resources

Cons of d3

  • Steeper learning curve, requiring more time to master
  • More verbose code for simple charts and graphs
  • Heavier library size, potentially impacting page load times

Code Comparison

d3:

const svg = d3.select("body").append("svg")
    .attr("width", 400)
    .attr("height", 300);

svg.selectAll("rect")
    .data(data)
    .enter()
    .append("rect")
    .attr("x", (d, i) => i * 70)
    .attr("y", d => height - d * 10)
    .attr("width", 65)
    .attr("height", d => d * 10);

frappe/charts:

const chart = new frappe.Chart("#chart", {
    data: {
        labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
        datasets: [{ values: [18, 40, 30, 35, 8, 52, 17] }]
    },
    type: 'bar',
    height: 300
});

The code comparison demonstrates that frappe/charts offers a more straightforward and concise approach for creating basic charts, while d3 provides greater control and customization options at the cost of increased complexity.

📊 Interactive JavaScript Charts built on SVG

Pros of ApexCharts.js

  • More extensive chart types and customization options
  • Better support for responsive and interactive charts
  • Larger community and more frequent updates

Cons of ApexCharts.js

  • Larger file size and potentially heavier performance impact
  • Steeper learning curve due to more complex API

Code Comparison

ApexCharts.js:

var options = {
  chart: { type: 'line' },
  series: [{ data: [30, 40, 35, 50, 49, 60, 70] }],
  xaxis: { categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997] }
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();

Frappe Charts:

const chart = new frappe.Chart("#chart", {
  data: {
    labels: ["1991", "1992", "1993", "1994", "1995", "1996", "1997"],
    datasets: [{ values: [30, 40, 35, 50, 49, 60, 70] }]
  },
  type: 'line'
});

Both libraries offer simple ways to create charts, but ApexCharts.js provides more configuration options in its initialization. Frappe Charts has a more straightforward API, which can be easier for beginners or simpler use cases.

101,622

JavaScript 3D Library.

Pros of three.js

  • More powerful and versatile for 3D graphics and animations
  • Larger community and ecosystem with extensive documentation
  • Supports a wide range of 3D features, including WebGL and WebXR

Cons of three.js

  • Steeper learning curve due to its complexity
  • Larger file size and potentially higher performance overhead
  • May be overkill for simple 2D chart visualizations

Code Comparison

three.js:

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

charts:

const chart = new frappe.Chart("#chart", {
  data: {
    labels: ["12am-3am", "3am-6am", "6am-9am", "9am-12pm", "12pm-3pm", "3pm-6pm", "6pm-9pm", "9pm-12am"],
    datasets: [{ name: "Some Data", values: [25, 40, 30, 35, 8, 52, 17, 4] }]
  },
  type: 'bar'
});

Summary

three.js is a powerful 3D graphics library with a vast ecosystem, making it ideal for complex 3D visualizations and games. However, it may be excessive for simple 2D charts. charts, on the other hand, is more focused on creating straightforward 2D charts with less complexity, making it easier to use for basic data visualization tasks but limiting its capabilities for advanced 3D graphics.

16,856

Open-source JavaScript charting library behind Plotly and Dash

Pros of Plotly.js

  • More extensive and feature-rich library with a wider variety of chart types
  • Supports interactive and animated visualizations out of the box
  • Better documentation and larger community support

Cons of Plotly.js

  • Larger file size and potentially slower load times
  • Steeper learning curve due to more complex API
  • May be overkill for simple charting needs

Code Comparison

Plotly.js:

Plotly.newPlot('myDiv', [{
  x: [1, 2, 3, 4],
  y: [10, 15, 13, 17],
  type: 'scatter'
}]);

Charts:

const chart = new frappe.Chart("#chart", {
  data: {
    labels: ["1", "2", "3", "4"],
    datasets: [{ values: [10, 15, 13, 17] }]
  },
  type: 'line'
});

Summary

Plotly.js offers a more comprehensive charting solution with advanced features and interactivity, making it suitable for complex data visualization needs. However, it comes with a larger footprint and steeper learning curve. Charts, on the other hand, provides a simpler API and lighter-weight solution, which may be preferable for basic charting requirements or projects with performance constraints.

Highcharts JS, the JavaScript charting framework

Pros of Highcharts

  • More extensive feature set with a wide variety of chart types
  • Better documentation and community support
  • Advanced interactivity and animation capabilities

Cons of Highcharts

  • Commercial license required for most use cases
  • Larger file size and potentially slower performance
  • Steeper learning curve due to more complex API

Code Comparison

Highcharts:

Highcharts.chart('container', {
  chart: { type: 'bar' },
  series: [{
    data: [1, 2, 3, 4, 5]
  }]
});

Charts:

const chart = new frappe.Chart("#chart", {
  data: {
    labels: ["Sun", "Mon", "Tue", "Wed", "Thu"],
    datasets: [{ values: [1, 2, 3, 4, 5] }]
  },
  type: 'bar'
});

Both libraries offer straightforward ways to create basic charts, but Highcharts provides more configuration options out of the box. Charts focuses on simplicity and ease of use, making it quicker to set up simple visualizations. Highcharts offers more customization possibilities, which can be beneficial for complex projects but may require more initial setup time.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Frappe Charts

GitHub-inspired modern, intuitive and responsive charts with zero dependencies

Explore Demos » Edit at CodeSandbox » Documentation »

Contents

Installation

Via NPM

Install via npm:

$ npm install frappe-charts

and include in your project:

import { Chart } from "frappe-charts"

Or include following for es-modules(eg:vuejs):

import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js'
// import css
import 'frappe-charts/dist/frappe-charts.min.css'
or include within your HTML
<script src="https://cdn.jsdelivr.net/npm/frappe-charts@1.6.1/dist/frappe-charts.min.umd.js"></script>
<!-- or -->
<script src="https://unpkg.com/frappe-charts@1.6.1/dist/frappe-charts.min.umd.js"></script>

Usage

const data = {
    labels: ["12am-3am", "3am-6pm", "6am-9am", "9am-12am",
        "12pm-3pm", "3pm-6pm", "6pm-9pm", "9am-12am"
    ],
    datasets: [
        {
            name: "Some Data", chartType: "bar",
            values: [25, 40, 30, 35, 8, 52, 17, -4]
        },
        {
            name: "Another Set", chartType: "line",
            values: [25, 50, -10, 15, 18, 32, 27, 14]
        }
    ]
}

const chart = new frappe.Chart("#chart", {  // or a DOM element,
                                            // new Chart() in case of ES6 module with above usage
    title: "My Awesome Chart",
    data: data,
    type: 'axis-mixed', // or 'bar', 'line', 'scatter', 'pie', 'percentage'
    height: 250,
    colors: ['#7cd6fd', '#743ee2']
})

Or for es-modules (replace new frappe.Chart() with new Chart()):

- const chart = new frappe.Chart("#chart", {
+ const chart = new Chart("#chart", {  // or a DOM element,
                                    // new Chart() in case of ES6 module with above usage
    title: "My Awesome Chart",
    data: data,
    type: 'axis-mixed', // or 'bar', 'line', 'scatter', 'pie', 'percentage'
    height: 250,
    colors: ['#7cd6fd', '#743ee2']
})

If you want to contribute:

  1. Clone this repo.
  2. cd into project directory
  3. npm install
  4. npm i npm-run-all -D (optional --> might be required for some developers)
  5. npm run dev

License

This repository has been released under the MIT License


Project maintained by Frappe. Used in ERPNext. Read the blog post.

NPM DownloadsLast 30 Days