1.0.7 • Published 4 years ago

@tygr/vue-pie-chart v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Vue Pie Chart

Build Status

DEMO

A simple no-nonsense pie chart optimized for VueJS

demo

Installation

Yarn

yarn add -D @tygr/vue-pie-chart
import PieChart from '@tygr/vue-pie-chart'

export default {
  components: {
    PieChart,
  }
}

Browser

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/@tygr/vue-pie-chart/dist/vue-pie-chart.min.js" charset="utf-8"></script>
<script>
  Vue.use(PieChart)
</script>
  • Charset attribute required

Usage

<pie-chart :plot="plot"></pie-chart>
export default {
  data: () => ({
    plot: [
      {
        value: 10,
        color: 'blue',
        label: 'Blue amount',
        id: 1
      },
      {
        value: 45,
        color: 'green',
        label: 'Green amount',
        id: 2
      },
      {
        value: 30,
        color: 'purple',
        label: 'Purple amount',
        id: 3
      }
    ]
  })
}

Events

eventpayloaddescription
clickanyEmits the id of a datum when clicked

Props

proptypedefaultdescription
plotarray[]The plot data to show
background-colorstring'grey'The background color
colorstring'white'Text and border color

Datum properties

proptypedescription
valuenumberpercentage out of 100
colorstringbackground color for the circle segment
labelstringlabel for the segment
idanyIdentifier to be used for the click event
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago