TOAST UI Chart for Vue
npm install @toast-ui/vue-chart> This is Vue component wrapping TOAST UI Chart.

- Collect statistics on the use of open source
- Install
- Using npm
- Usage
- Load
- Components
- Implement
- Props
- Event
- Method
- Pull Request Steps
- Contributing
- License
Vue Wrapper of TOAST UI Chart applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Chart is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. > “ui.toast.com") is to be collected, and the sole purpose is nothing but to measure statistics on the usage. To disable GA, use the following usageStatistics options when declare Vue Wrapper component.
``js`
var options = {
//...
usageStatistics: false,
};
`sh`
npm install --save @toast-ui/vue-chart
You can use TOAST UI Chart for Vue as module format or namespace. When using module format, you should load toastui-chart.min.css in the script.
- Using ECMAScript module
`js`
import '@toast-ui/chart/dist/toastui-chart.min.css';
import { barChart, lineChart } from '@toast-ui/vue-chart';
- Using Commonjs module
`js`
require('@toast-ui/chart/dist/toastui-chart.min.css');
const toastui = require('@toast-ui/vue-chart');
const barChart = toastui.barChart;
const lineChart = toastui.lineChart;
- Using namespace
`js`
const barChart = toastui.barChart;
const lineChart = toastui.lineChart;
You can use all kinds of charts in TOAST UI chart. Vue Components for each chart types are:
- areaChartlineChart
- barChart
- boxPlotChart
- bubbleChart
- bulletChart
- columnChart
- columnLineChart
- heatmapChart
- lineAreaChart
- lineScatterChart
- nestedPieChart
- pieChart
- radarChart
- scatterChart
- treemapChart
-
1. If you want to use barChart, insert in the template or html. data prop is required.
`html`
2. Load chart component and then add it to the components in your component or Vue instance.
`js
import '@toast-ui/chart/dist/toastui-chart.min.css';
import { barChart } from '@toast-ui/vue-chart';
export default {
components: {
'bar-chart': barChart,
},
data() {
return {
chartData: {
// for 'data' prop of 'bar-chart'
categories: ['July', 'Aug', 'Sep', 'Oct', 'Nov'],
series: [
{
name: 'Budget',
data: [3000, 5000, 7000, 6000, 4000],
},
{
name: 'Income',
data: [1000, 7000, 2000, 5000, 3000],
},
],
},
};
},
};
`
You can use data, options, style props for initialize TOAST UI chart.
#### data
| Type | Required |
| ------ | -------- |
| Object | O |
This prop is for data of the chart. When you change data, chart is rendering for changing data.
For more information, see data of each type chart in TOAST UI chart document.
> TOAST UI Chart has its own reactivity system, and does not use the reactivity system of Vue. So, instead of adding props in the data, declare props in the created lifecycle method.
`html`
#### options
| Type | Required |
| ------ | -------- |
| Object | X |
This prop is for options of TOAST UI chart and used for initialize TOAST UI chart.
> TOAST UI Chart has its own reactivity system, and does not use the reactivity system of Vue. So, instead of adding props in the data, declare props in the created lifecycle method.
`html`
#### style
| Type | Required |
| ------ | -------- |
| Object | X |
This prop is for chart container style and used for initialize TOAST UI chart. To use responsive layout, the width or height of the container must be specified as a value such as "%" or "vh", "vw".
`html`
:options="chartProps.options"
:style="chartProps.containerStyle"
/>
| eventName | Details |
| --------------------- | ------------------------------------------------------------------------------------ |
| clickLegendLabel | Triggered when the legend's label area is clicked. |clickLegendCheckbox
| | Triggered when the legend's checkbox area is clicked. |selectSeries
| | Triggered when the series is selected. Requires options.series.selectable: true. |unselectSeries
| | Triggered when the series is unselected. Requires options.series.selectable: true. |hoverSeries
| | Triggered when the mouse hovers over a series. |unhoverSeries
| | Triggered when the mouse leaves the series after the hoverSeries event. |zoom
| | Triggered when zoomed. Requires options.series.zoomable: true. |resetZoom
| | Triggered when zoom is reset. Requires options.series.zoomable:true. |
- Example :
`html`
@clickLegendLabel="onClickLegendLabel"
@clickLegendCheckbox="onClickLegendCheckbox"
@selectSeries="onSelectSeries"
@unselectSeries="onUnselectSeries"
@hoverSeries="onHoverSeries"
@unhoverSeries="onUnhoverSeries"
@zoom="onZoom"
@resetZoom="onResetZoom"
/>
For use method, first you need to assign ref attribute of element like this:
`html`
After then, you can use methods through this.$refs. We provide invoke method. You can use invoke method to call the method of tui.chart. First argument of invoke is name of the method and second argument is parameters of the method.
`js`
this.$refs.tuiChart.invoke('resize', {
width: 500,
height: 500,
});
For more information of method, see method of TOAST UI chart.
TOAST UI products are open source, so you can create a pull request(PR) after you fix issues.
Run npm scripts and develop yourself with the following process.
Fork develop branch into your personal repository.
Clone it to local computer. Install node modules.
Before starting development, you should check to have any errors.
`sh``
$ git clone https://github.com/{your-personal-repo}/[[repo name]].git
$ cd [[repo name]]
$ npm install
Before PR, check to test lastly and then check any errors.
If it has no error, commit and then push it!
For more information on PR's step, please see links of Contributing section.
- Code of Conduct
- Contributing guideline
- Commit convention