Chart

Data visualization.

Basic

Use b-chart with chart-type or use specific chart such as b-bar-chart.

Chart with type

Bar Chart


Bar chart

Default

Horizontal

Stacked

Horizontal Stacked

Gradient

Gradient Stacked


Line chart

Default

No tension

No points

Solid background


Bubble chart


Donut chart

Default

Rotation

Gradient


Pie chart

Default

Gradient


Polar area chart


Radar chart


Scatter chart


Custom chart

import { createTypedChart } from 'vue-chartjs'
import { LineController } from 'chart.js'

// The first argument is the chart-id, the second the chart type, third is the custom controller
const CustomLine = createTypedChart('custom-line', 'line', LineController)

Chart Attributes

AttributeDescriptionTypeAccepted ValuesDefault
chart-dataObject with Chart dataObjectRefopen in new window
chart-optionsObject with Chart optionsObjectRefopen in new window
dataset-id-keyIndex key in datasetString'label'
widthchart width, will ignore if options.responsive = true (default)Number400
heightchart height, will ignore if options.responsive = true (default)Number400
pluginsArray with Chart pluginsArrayRefopen in new window

Chart Events

Event NameDescriptionParameters
chart:renderedif the chart object instance rendered
chart:destroyedif the chart object instance removed
chart:updatedif the update handler performs an update instead of a re-render
labels:updatedif new labels were set

Chart Methods

MethodDescriptionParameters
createTypedChartGenerate a custom chart(chartId: string, chartType: string, chartController: ChartController)
Last Updated: 3/6/2023, 9:29:52 AM
Contributors: Tam Mai