defines the vertical axis
webix.ui({
view:"chart",
...
yAxis:{
start:-10,
end:10,
step:2,
title:"Sales"
},
origin:0
});
The property is applicable only to bar, line, area, scatter, radar charts.
All the attributes are optional.
Available set of attributes depends on the chart type:
start | (number) the minimum value of the scale | bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH, radar |
end | (number) the maximum value of the scale | bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH, radar |
step | (number) the scale step | bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH, radar |
template | (string,function) the template for the scale labels | bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH, radar |
title | (string) the axis title | bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH |
lines | (boolean,function) enables/disables horizontal lines for the scale units (by default, true) | bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH, radar |
color | (string) the axis color (by default, "#000000") | bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH |
lineColor | (string,function) the color of the scale lines (by default, "#cfcfcf") |
bar, stackedBar, line, spline, area, stackedArea, scatter, barH, stackedBarH, radar |
lineShape | ("arc" or "line") the shape of lines (by default, "line") |
radar |
bg | (string,function) the background color (by default, "#ffffff") |
radar |
If attributes end, start, step are not set, they will be automatically calculated.
However, you may control the minimum value of the scale by using the origin property. For example, if you set origin:0, the scale will start from '0', even if the minimum value in the dataset is greater.
As a function, 'template' is called for each scale item of the chart and takes the item numeric value as a parameter.
template: function(value){
return value%10 ? "" : value;
}
Function definition allows you to manipulate the visibility of lines: to hide/show them depending on the specified rules. We recommend to use such a definition in case you have a lot of items, to prevent the chart from looking overloaded.
As a function, 'lines' is called for each scale item of the chart and takes the item index as a parameter. Must return the true(show the line) or false(hide the line) value.
lines: function(index){
return index%2 ? false : true; // hides even lines
}
Function definition allows you have different lines in different colors.
As a function, 'lineColor' is called for each scale item of the chart and takes the item index as a parameter. Must return string with the desired color.
lineColor: function(index){
return index%2 ? "#e9eef9" : "#f3f7ff"; // colors odd and even lines in different colors
}
As a function, 'bg' is called for each scale item of the chart and takes 2 parameters: the yAxis item index and the xAxis item index.
bg: function(yIndex, xIndex){
return yIndex%2 ? "#e9eef9" : "#f3f7ff";
}