Giter VIP home page Giter VIP logo

vue-svg-charts's Introduction

vue-svg-charts

Lightweight Vue components for drawing pure svg charts without external dependencies.

Live demo

Live demo can be found on the project page: https://sapk.github.io/vue-svg-charts/

The code of the demo us available here: https://github.com/sapk/vue-svg-charts/blob/master/src/App.vue

Features

  • Pure SVG. Vue is only used for calculations.
  • No external dependencies

Installation

1. Install via yarn or npm

yarn add vue-svg-charts

OR

npm install vue-svg-charts

2. Import and use vue-svg-charts

  • ES6
import BarGraph from "vue-svg-charts/components/bar";

Vue.use(BarGraph);

Usage

Basic usage

With sane defaults in place, basic usage is as simple as passing a points array of values bar-graph component.

<template>
  <bar-graph :points="points"/>
</template>
<script>
  export default {
    data() {
      return {
        points: [42, 8, 15, 16, 23, 42, 4, 8, 15]
      };
    }
  };
</script>

Usage with all the available props

<template>
    <bar-graph
      title="Test Bar Graph"
      animDuration="1s"
      :showValues="true"
      :easeIn="true"
      :points="points"
      :labels="labels"
      :width="1024"
      :height="320"
    />
</template>
<script>
  export default {
    data() {
      return {
      points: [42, 8, 15, 16, 23, 42, 4, 8, 15],
      labels: [
        "Label 1",
        "Label 2",
        "Label 3",
        "Label 4",
        "Label 5",
        "Label 6",
        "Label 7",
        "Label 8",
        "Label 9"
      ]
      };
    }
  };
</script>

Props

width

  • type: Number
  • default: 680
  • Width of the graph. Can be any positive value.

height

  • type: Number
  • default: 320
  • Height of the graph. Can be any positive value.

title

  • type: String
  • default: ``
  • Title to set for the graph (is display on hover).

points

  • type: Array
  • default: []
  • Values to display.

labels

  • type: Array
  • default: []
  • Lables related to values array.

showValues

  • type: Boolean
  • default: false
  • Specifies whether the graph should display values on top of bar.

animated

  • type: Boolean
  • default: true
  • Specifies whether the graph should be animated by transition.

animDuration

  • type: String
  • default: 1s
  • SVG animation duration.

Contributing

License

Code released under MIT license.

Roadmap

  • More graph

Inspired by:

vue-svg-charts's People

Contributors

dependabot[bot] avatar sapk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.