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: 2 months ago
JSON representation

๐ŸŒˆ Simple, elegant spark lines for Vue.js

Lists

README

        

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ


More powerful, more flexible chart library for Vue.js ๐Ÿ‘‰ https://github.com/QingWei-Li/laue


๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ

---


Vue Trend


Vue Trend


๐ŸŒˆ Simple, elegant spark lines for Vue.js




npm

vue

## 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