Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qingwei-li/vue-trend
🌈 Simple, elegant spark lines for Vue.js
https://github.com/qingwei-li/vue-trend
trend trending vue vue-components
Last synced: 4 days ago
JSON representation
🌈 Simple, elegant spark lines for Vue.js
- Host: GitHub
- URL: https://github.com/qingwei-li/vue-trend
- Owner: QingWei-Li
- License: mit
- Created: 2017-03-10T19:46:48.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T23:16:14.000Z (about 2 years ago)
- Last Synced: 2024-12-18T15:03:05.617Z (6 days ago)
- Topics: trend, trending, vue, vue-components
- Language: JavaScript
- Homepage: https://cinwell.com/vue-trend/
- Size: 1.52 MB
- Stars: 1,193
- Watchers: 22
- Forks: 79
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🔥🔥🔥
More powerful, more flexible chart library for Vue.js 👉 https://github.com/QingWei-Li/laue
🔥🔥🔥
---
## Installation
```shell
npm i vuetrend -S
```## Usage
```js
import Vue from "vue"
import Trend from "vuetrend"Vue.use(Trend)
```_vue template_
```html
```
[Live Demo](https://jsfiddle.net/nyh18bLq/)
## Inspired
[unsplash/react-trend](https://github.com/unsplash/react-trend) - 📈 Simple, elegant spark lines
## Props
| Name | Type | Default | Description | Example |
| ----------------- | -------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| data | Number\|Object | `undefined` | The data accepted by Vue Trend is incredibly simple: An array of y-axis values to graph. | `[120, 149, 193.4, 200, 92]` or `[{ value: 4 }, { value: 6 }, { value: 8 }]` |
| gradient | String | `['#000']` | Colour can be specified as any SVG-supported format (named, rgb, hex, etc). | `['#0FF', '#F0F', '#FF0']` | - |
| gradientDirection | String | `top` | Top, Bottom, Left or Right. | | - |
| width | Number | auto | Set an explicit width for your SVG. | - |
| height | Number | auto | Set an explicit height for your SVG. | - |
| padding | Number | `8` | If you set a very large `strokeWidth` on your line, you may notice that it gets "cropped" towards the edges. | - |
| smooth | Boolean | `false` | Smooth allows the peaks to be 'rounded' out so that the line has no jagged edges. | - |
| radius | Number | `10` | When using **smoothing**, you may wish to control the amount of curve around each point. This prop has no effect if `smooth` isn't set to `true`. | - |
| autoDraw | Boolean | `false` | Allow the line to draw itself on mount. Set to `true` to enable, and customize using `autoDrawDuration` and `autoDrawEasing`. | - |
| autoDrawDuration | Number | `2000` | The amount of time, in milliseconds, that the autoDraw animation should span. This prop has no effect if `autoDraw` isn't set to `true`. | - |
| autoDrawEasing | String | `ease` | The easing function to use for the autoDraw animation. Accepts any transition timing function within [the CSS spec](http://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp) (eg. `linear`, `ease`, `ease-in`, `cubic-bezier`...). | - |
| max | Number | `-Infinity` | Specify max value | - |
| min | Number | `Infinity` | Specify min value, This is useful if you have multiple lines. See [#8](https://github.com/QingWei-Li/vue-trend/issues/8) | - |#### SVG Props
By default, all properties not recognized by Vue Trend will be delegated to the SVG. The line inherits these properties if none of its own override them.
This means that, among other properties, you can use:
- `stroke` to set a solid colour,
- `strokeWidth` to change the default line thickness,
- `strokeOpacity` to create a transparent line,
- `strokeLinecap`/`strokeLinejoin` to control the edges of your line,
- `strokeDasharray` to create a dashed line, and
- `strokeDashoffset` to control where the dashes start.## Development
```sh
yarn
yarn dev
# open localhost:4000
```## TODO
- Unit test
## License
MIT