Skip to content

Commit b2eb63b

Browse files
committed
Add basic documentation
1 parent 19dd36a commit b2eb63b

File tree

1 file changed

+75
-19
lines changed

1 file changed

+75
-19
lines changed

README.md

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,85 @@
1-
# funnel-vue
1+
# VueFunnelGraph.js
22

3-
## Project setup
4-
```
5-
npm install
6-
```
3+
Funnel graph drawing library for Vue.js.
74

8-
### Compiles and hot-reloads for development
9-
```
10-
npm run serve
11-
```
5+
* SVG charts
6+
* Values, Labels, Percentages display
7+
* Two-dimensional graph support
8+
* Legend display
9+
* Detailed percentage breakdown on hover
10+
* Animated
11+
* Solid color and gradient fill
12+
* Horizontal and vertical charts
1213

13-
### Compiles and minifies for production
14-
```
15-
npm run build
16-
```
14+
<img src="https://i.imgur.com/BEkq4DE.gif">
15+
16+
This is the Vue.js version of FunnelGraph.js, learn more about the library and see documentation [here.](https://github.com/greghub/funnel-graph-js)
1717

18-
### Run your tests
18+
## Installation
19+
20+
#### NPM
21+
```js
22+
npm i vue-funnel-graph-js
1923
```
20-
npm run test
24+
25+
## Usage
26+
27+
After installing, import the `VueFunnelGraph` component:
28+
29+
```js
30+
import { VueFunnelGraph } from 'vue-funnel-graph-js';
2131
```
2232

23-
### Lints and fixes files
33+
You can now use the custom element:
34+
```vue
35+
<vue-funnel-graph :width="width" :height="height" :labels="labels"
36+
:values="values" :colors="colors" :subLabels="subLabels" :direction="direction"
37+
:gradient-direction="gradientDirection"
38+
:animated="true" :display-percentage="true"
39+
></vue-funnel-graph>
2440
```
25-
npm run lint
41+
42+
The values are passed to props:
43+
```vuejs
44+
export default {
45+
name: 'app',
46+
components: {
47+
VueFunnelGraph
48+
},
49+
data() {
50+
return {
51+
labels: ['Impressions', 'Add To Cart', 'Buy'],
52+
subLabels: ['Direct', 'Social Media', 'Ads'],
53+
values: [
54+
[3000, 2500, 6500],
55+
[3000, 1700, 1000],
56+
[600, 200, 130]
57+
],
58+
colors: [
59+
['#FFB178', '#FF78B1', '#FF3C8E'],
60+
['#A0BBFF', '#EC77FF'],
61+
['#A0F9FF', '#7795FF']
62+
],
63+
direction: 'horizontal',
64+
gradientDirection: 'horizontal',
65+
height: 300,
66+
width: 800
67+
};
68+
}
69+
}
2670
```
2771

28-
### Customize configuration
29-
See [Configuration Reference](https://cli.vuejs.org/config/).
72+
## Options
73+
74+
| Option | Description | Type | Required | Options | Default | Example |
75+
|--------|-------------|------|----------|---------|---------|---------|
76+
| `width` | Width of the funnel graph | `number` | Yes | | 0 | 800 |
77+
| `height` | Height of the funnel graph | `number` | Yes | | 0 | 300 |
78+
| `labels` | Title of each data part | `array` | Yes | | | ['Impressions', 'Add To Cart', 'Buy'] |
79+
| `values` | Numbers that the funnel chart visualizes | `array` | Yes | | | [12000, 4700, 930] |
80+
| `colors` | Colors of the graph. If a string or array with one element passed it fills the graph with a solid color, if the array contains more than one element it fill the graph with a gradient. For two-dimensional charts and array of arrays shall be passed to fill each segment with a separate gradient. The array can contain arrays and strings mixed. If a there are more segments than colors provided, up to 10 extra segments will be filled with pre-defined solid colors | `array⎮string` | Yes | | | [12000, 4700, 930] |
81+
| `subLabels (:subLabels)` | Title of each data segment | `array` | Yes for two-dimensional graphs | | | ['Direct', 'Social Media', 'Ads'] |
82+
| `direction` | Whether the chart visualization is displayed vertically or horizontally | `string` | No | 'vertical', 'horizontal' | 'horizontal' | |
83+
| `gradientDirection (:gradient-direction)` | Whether the gradient applied to the segments of the graph is displayed from top to bottom or from left to right | `string` | No | 'vertical', 'horizontal' | 'horizontal' |
84+
| `animated` | Whether any change in graph shape will be displayed with a smooth transition | `boolean` | No | `true`, `false` | `true` | `false` |
85+
| `displayPercentage (:display-percentage)` | Whether to display the automatically calculated percentage values below the labels | `boolean` | No | `true`, `false` | `true` | |

0 commit comments

Comments
 (0)