26

GitHub - typpo/quickchart: Google Image Charts alternative

 5 years ago
source link: https://github.com/typpo/quickchart
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

QuickChart

QuickChart is a service that generates images of charts from a URL. Because these charts are simple images, they are very easy to embed in non-dynamic environments such as email, SMS, chat rooms, and so on.

See it in action

The chart image generation service is available online at QuickChart.io. There is an interactive editor that allows you to adjust inputs and build images.

Here's an example chart that is defined completely by its URL:

Chart from URL

The above image can be included anywhere you like. Here is its URL:

https://quickchart.io/chart?width=500&height=300&c={type:'bar',data:{labels:['January','February','March','April','May'],datasets:[{label:'Dogs',data:[50,60,70,180,190]},{label:'Cats',data:[100,200,300,400,500]}]}}

As you can see, the JSON contained in the URL defines the chart:

{
  type: 'bar',
  data: {
    labels: ['January', 'February', 'March', 'April', 'May'],
    datasets: [{
      label: 'Dogs',
      data: [ 50, 60, 70, 180, 190 ]
    }, {
      label: 'Cats',
      data: [ 100, 200, 300, 400, 500 ]
    }]
  }
}

Chart configuration is compatible with the popular Chart.js API. Check out the Chart.js documentation for more information on how to customize your chart, or see QuickChart.io for more examples.

Dependencies and Installation

Chart generation requires several system dependencies: Cairo, Pango, libjpeg, and libgif. Run ./scripts/setup.sh for a fresh install on Linux machines (note that this also installs yarn and node).

To install system dependencies on Mac OSX, you probably just need to brew install cairo.

Once you have system dependencies installed, run yarn install or npm install to install the node dependencies.

Running the server

node index.js will start the server on port 3400.

License

QuickChart is open source, licensed under version 3 of the GNU GPL. If you would like to modify this project for commercial purposes (and not release the source code), please contact me.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK