Skip to content

πŸ’Ž Release new version 3.3.0

Compare
Choose a tag to compare
@apertureless apertureless released this 23 Mar 16:50
· 378 commits to main since this release

Changelog

Bug Fixes

  • readme: Update paypal donate button (bfda218)

Features

  • charts: Export generateChart to create custom charts (50e5644)
  • docs: Update docs with custom chart example (3247a61)

πŸ‘¨β€πŸ« Custom Charts

You can now extend Chart.js chart types and modify them or create new chart types.

// 1. Import Chart.js so you can use the global Chart object
import Chart from 'chart.js'
// 2. Import the `generateChart()` method to create the vue component.
import { generateChart } from 'vue-chartjs'

// 3. Extend on of the default charts
// http://www.chartjs.org/docs/latest/developers/charts.html
Chart.defaults.LineWithLine = Chart.defaults.line;
Chart.controllers.LineWithLine = Chart.controllers.line.extend({ /* custom magic here */})

// 4. Generate the vue-chartjs component
// First argument is the chart-id, second the chart type.
const CustomLine = generateChart('custom-line', 'LineWithLine')

// 5. Extend the CustomLine Component just like you do with the default vue-chartjs charts.

export default {
  extends: CustomLine,
  mounted () {
    // ....
  }
}

see-heavy-aQYR1p8saOQla