/sChart

simple svg charts with zero dependencies

Primary LanguageTypeScript

sChart

simple svg charts with zero dependencies more examples, more png

Contents

Installation

  • Install via npm:

    $ npm install s-chart

    and include in your project:

    import Chart from "s-chart"
  • ...or include within your HTML

      <script src="./schart.js"></script>

Usage

const data0 = [
	{
		label: '实例1',
		value: 234
	},
	{
		label: '实例2',
		value: 100
	},
	{
		label: '实例3',
		value: 500
	},
		{
		label: '实例4',
		value: 400
	}
]
const pieChart = new Chart({
	id: 'pie-chart',
	title: 'Pie Chart',
	data: data0,
	type: 'pie', // or 'line', 'scatter', 'pie', 'percentage', 'scatter'
	height: 250,
	width: 640,
	sortDataType: 'descending', // ascending descending none
})

View Examples:

  1. Clone this repo.
  2. cd into project directory.
  3. npm install -g parcel
  4. npm run example

If you want to contribute:

  1. Clone this repo.
  2. cd into project directory
  3. npm install
  4. npm run build

Updates

v0.1.0
  • The very first version out, with pie, percentage, bars, lines and scatter.

License

This repository has been released under the MIT License


Project maintained by facejiong