-
Notifications
You must be signed in to change notification settings - Fork 322
features axes
- This section introduces about feature of axes.
Using title options(yAxis.title, xAxis.title), you can set about each title of axes.
//...
var options = {
xAxis: {
title: 'X Axis Title'
},
yAxis: {
title: 'Y Axis Title'
}
};
tui.chart.barChart(container, data, options);This is not working on v2.9.4. See #20
It will be fixed until next second release v2.11.0. on Oct 28th
If you want moving title position, you can use object type xAxis.title(yAxis.title) option.
In this case, title text is using xAxis.title.text option.
xAxis.title.offsetX, xAxis.title.offsetY options are using for moving a title to four direction like top, bottom, left and right.
var options = {
xAxis: {
title: {
text: 'X Axis Title',
offsetX: 50,
offsetY: 10
}
},
yAxis: {
title: {
text: 'Y Axis Title',
offsetX: -30,
offsetY: 20
}
}
};Using xAxis.min, xAxis.max options, you can set about minimum or maximum value of X axis.
These options are available in bar and heatmap charts.
//...
var options = {
xAxis: {
min: 0,
max: 1000
}
};
tui.chart.barChart(container, data, options);Using yAxis.min, yAxis.max options, you can set about minimum or maximum value of Y axis.
These options are available in column, line, area, heatmap and combo charts.
//...
var options = {
yAxis: {
min: 0,
max: 1000
}
};
tui.chart.columnChart(container, data, options);Using xAxis.labelInterval option, you can display the axis label sparsely.
This option is available in column, line, area and combo charts.
//...
var options = {
xAxis: {
labelInterval: 2
}
};
tui.chart.columnChart(container, data, options);Label of x axis is rotated, when a width for label is wider than the width of the rendering area.
If you do not want rotating label of x axis, you can use xAxis.rotateLabel option.
//...
var options = {
xAxis: {
rotateLabel: false
}
};
tui.chart.columnChart(container, data, options);
Title of y axis is rotated, when rendering.
If you do not want rotating title of y axis, you can use yAxis.rotateTitle option.
//...
var options = {
yAxis: {
rotateTitle: false
}
};
tui.chart.columnChart(container, data, options);
If you want formatting label to date format, you can use type='datetime' and dateFormat options.
var rawData = {
categories: ['01/01/2016', '02/01/2016',...],
//..
};
var options = {
xAxis: {
type: 'datetime',
dateFormat: 'YYYY.MM'
}
}| Represent type | format string |
|---|---|
| years | YY / YYYY / yy / yyyy |
| months(n) | M / MM |
| months(str) | MMM / MMMM |
| days | D / DD / d / dd |
| hours | H / HH / h / hh |
| minutes | m / mm |
| meridiem(AM,PM) | A / a |
a. before using format option
b. dateFormat='MMM'
c. dateFormat='YYYY.MM
If you want spread to gap the axis and label, you can use labelMargin options.
//...
var options = {
xAxis: {
labelMargin: 30
}
};
tui.chart.columnChart(container, data, options);- Chart Guide