Skip to content

Commit

Permalink
Merge pull request #7 from lin-xin/dev
Browse files Browse the repository at this point in the history
release:V3.0.0
  • Loading branch information
lin-xin authored Nov 1, 2019
2 parents e56c39d + 9469b4d commit 789d9ed
Show file tree
Hide file tree
Showing 16 changed files with 4,273 additions and 923 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"indent": ["error", 4],
"quotes": ["error", "single"],
"semi": ["error", "always"]
}
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.git
node_modules/
dist/
src/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
Expand Down
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 林鑫
Copyright (c) 2019 林鑫

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
140 changes: 9 additions & 131 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
<br>
</p>

## Demo
## Document
- [中文文档](https://lin-xin.gitee.io/example/schart/)
- [English](https://lin-xin.gitee.io/example/schart/en/)

- [Demo](http://blog.gdfengshuo.com/example/sChart/demo.html)
- [Demo code](https://github.com/lin-xin/sChart.js/blob/master/example/chart.html)
## Demo

![demo](http://blog.gdfengshuo.com/example/sChart/static/img/demo.png)
![柱状图](https://lin-xin.gitee.io/example/schart/assets/img/1.6ad92a2c.png)
![折线图](https://lin-xin.gitee.io/example/schart/assets/img/2.c260f420.png)
![饼状图](https://lin-xin.gitee.io/example/schart/assets/img/3.bfe79000.png)
![环形图](https://lin-xin.gitee.io/example/schart/assets/img/4.5db72d39.png)

## Doc
- [中文文档](http://blog.gdfengshuo.com/example/sChart/index.html)
- [English](http://blog.gdfengshuo.com/example/sChart/en.html)

## Chart Types
The following chart types are implemented:
Expand All @@ -35,132 +36,9 @@ npm install schart.js
### using Javascript

```js
new sChart(canvasId, type, data, options)
```

### example

```html
<body>
<canvas id="canvas" width="500" height="400"></canvas>

<script src="sChart.min.js"></script>
<script>
// Bar Charts
var data = [
{name:'2014', value:2260},
{name:'2015', value:1170},
{name:'2016', value:970},
{name:'2017', value:1450}
]
new sChart('canvas', 'bar', data, {
title: '商店近年营业总额' // The title of a bar chart
});
</script>
</body>
new Schart(canvasId, options)
```

### Use rem or % in the mobile
```html
<body>
<div class="schart-wrapper" style="width: 7rem;height: 4rem">
<canvas id="canvas"></canvas>
</div>

<script src="sChart.min.js"></script>
<script>
var data = [
{name:'2014', value:2260},
{name:'2015', value:1170},
{name:'2016', value:970},
{name:'2017', value:1450}
]
new sChart('canvas', 'bar', data, {
title: '商店近年营业总额',
autoWidth: true // 设置宽高自适应父元素宽高
});
</script>
</body>
```

## Options

### title
String.The title of chart.
Default is null.

### titleColor
String.Title Color.
Default is '#000000'.

### titlePosition
String.Title position.
Default is 'top'.

### showValue
Display the value in the chart.
Default is true.

### autoWidth
Adaptive width and height.
Default is false.

### bgColor
String.The background color of chart.
Default is '#ffffff'.

### topPadding
Number.Inside top margin of chart.
Default is 50.

### bottomPadding
Number.Inside bottom margin of chart.
Default is 50.

### leftPadding
Number.Inside left margin of chart.
Default is 50.

### rightPadding
Number.Inside right margin of chart.
Default is 0.

### yEqual
Number.The number of points on the Y axis.
Default is 5.

### fillColor
String.The color of bar chart or line chart.
Default is '#1E9FFF'.

### axisColor
String.The color of the coordinate axis.
Default is '#666666'.

### contentColor
String.The color of the horizontal lines of the content.
Default is '#eeeeee'.

### radius
Number.The radius of a pie chart or ring chart.
Default is 100.

### innerRadius
Number.The inner radius of a ring chart.
Default is 700.

### colorList
Array.The color list of a pie chart or ring chart.
Default is ['#1E9FFF', '#13CE66', '#F7BA2A', '#FF4949', '#72f6ff'];

### legendColor
String.The color of the legend text.
Default is '#000000'.

### legendTop
Number.Legend position of top.
Default is 40.

## Relevant
[vue-schart](https://github.com/lin-xin/vue-schart) : Vue.js wrapper for sChart.js

Expand Down
90 changes: 0 additions & 90 deletions example/chart.html

This file was deleted.

Loading

0 comments on commit 789d9ed

Please sign in to comment.