60

GitHub - apexcharts/apexcharts.js: A JavaScript Chart Library

 6 years ago
source link: https://github.com/apexcharts/apexcharts.js
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.
neoserver,ios ssh client

README.md

68747470733a2f2f617065786368617274732e636f6d2f6d656469612f617065786368617274732d6c6f676f2e706e67

License FREE Version

68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c

A modern JavaScript charting library to build interactive charts and visualizations with simple API.

68747470733a2f2f617065786368617274732e636f6d2f6d656469612f617065786368617274732d62616e6e65722e706e67

Download and Installation

Installing via npm

NPM

Direct <script> include
<script src="https://unpkg.com/apexcharts/dist/apexcharts.min.js"></script>

Usage

Creating your first chart

To create a basic bar chart with minimal configuration, write as follows:

var options = {
  chart: {
    type: 'bar'
  },
  series: [{
    name: 'sales',
    data: [30, 40, 35, 50, 49, 60, 70, 91, 125]
  }],
  xaxis: {
    categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]
  }
}

var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();

This will render the following chart

68747470733a2f2f617065786368617274732e636f6d2f6d656469612f66697273742d6261722d63686172742e737667

A little more than the basic

You can create a combination of different charts, sync them and give your desired look with unlimited possibilites. Below is an example of synchronized charts with github style.

68747470733a2f2f617065786368617274732e636f6d2f6d656469612f6769746875622d6368617274732e676966

Some interactivity

Zoom, Pan, Scroll through data. Make selections and load other charts using those selections. An example showing some interactivity

interactive chart

Dynamic Data Updation

Another approach to Drill down charts where one selection updates the data of other charts. An example of loading dynamic series into charts is shown below

dynamic-loading-chart

Annotations

Annotations allows you to write custom text on specific values or on axes values. Valuable to expand the visual appeal of your chart and make it more informative.

annotations

Heatmaps

Use Heatmaps to represent data through colors and shades. Frequently used with bigger data collections, they are valuable for recognizing patterns and area of focus.

heatmap

Gauges

The tiny little gauges are an important part of a dashboard and are useful in displaying single digit data. A demo of these gauges:

radialbar-chart

Sparklines

Utilize sparklines to indicate trends in data, for example, occasional increments or declines, monetary cycles, or to feature most extreme and least values:

sparkline-chart

What's included

The download bundle includes the following files and directories providing a minified single file in the dist folder. Every asset including icon/css is bundled in the js itself to avoid loading multiple files.

apexcharts/
├── dist/
│   └── apexcharts.min.js
├── src/
│   ├── assets/
│   ├── charts/
│   ├── modules/
│   ├── utils/
│   └── apexcharts.js
└── samples/

Development

Install dependencies and run project

npm install
npm run start

This will start the webpack watch and any changes you make to src folder will autocompile and output will be produced in dist folder.

Minifying the src

npm run build

Where do I go next?

Head over to the documentation section to read more about how to use different kinds of charts and explore all options.

Credits.

ApexCharts uses SVG.js for drawing shapes, animations, applying svg filters and a lot more under the hood.

License

ApexCharts is released under MIT license. You are free to use, modify and distribute this software, as long as the copyright header is left intact.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK