Home

Awesome

<p align="center"><img src="https://github.com/apexcharts/stencil-apexcharts/raw/master/src/assets/stencil-apexcharts.png"></p> <p align="center"> <a href="https://github.com/apexcharts/stencil-apexcharts/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg" alt="License"></a> <a href="https://travis-ci.com/apexcharts/stencil-apexcharts"><img src="https://api.travis-ci.com/apexcharts/stencil-apexcharts.svg?branch=master" alt="build" /></a> <a href="https://www.npmjs.com/package/stencil-apexcharts"><img src="https://img.shields.io/npm/v/stencil-apexcharts.svg" alt="ver"></a> </p> <p align="center"><a href="https://stenciljs.com">Stencil.js</a> wrapper for <a href="https://apexcharts.com">ApexCharts</a> to build interactive visualizations in stencil.</p> <p align="center"><a href="https://apexcharts.com/javascript-chart-demos/"><img src="https://apexcharts.com/media/apexcharts-banner.png"></a></p>

Installation

Script tag

Node Modules

In a stencil-app-starter app

Usage

JSX

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

HTML

<apex-chart></apex-chart>
<script>
  const chart = document.querySelector('apex-chart');
  chart.series = [
    {
      name: 'sales',
      data: [30, 40, 35, 50, 49, 60, 70, 91, 125]
    }
  ];
  chart.options = {
    xaxis: {
      categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]
    }
  };
</script>

How do I update the chart?

Simple! Just change the series or options and it will automatically re-render the chart.

<p align="center"><a href="#"><img src="https://apexcharts.com/media/react-chart-updation.gif"></a></p>

Properties

PropertyAttributeDescriptionTypeDefault
heightheightCan be 100% or 300px or 300number | stringundefined
options--The configuration object API (Reference)ApexOptionsundefined
series--The series API (Reference)number[] | { name: string; data: number[] | { x: string; y: number; }[]; }[]undefined
typetypeChart type API (Reference)"area" | "bar" | "bubble" | "candlestick" | "donut" | "heatmap" | "histogram" | "line" | "pie" | "radar" | "radialBar" | "scatter"undefined
widthwidthCan be 100% or 400px or 400number | stringundefined

Development

Install dependencies

npm install
npm install apexcharts

Running the example

Basic example is included to show how to get started using ApexCharts with Stencil easily.

To run the examples,

npm install
npm install apexcharts
npm run start

Bundling

npm run build

License

Stencil-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.