xAxis

defines the horizontal axis

object xAxis;

Example

webix.ui({
    view:"chart",
    ...
    xAxis:{
        title: "Years",
        template: "#year#",
        lines: true
    }
});

Related samples

Details

The property is applicable only to bar, line, area, scatter, radar charts.
Only the 'template' attribute is mandatory


Attributes of the property differ for different chart types:

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.

'template' attribute. Function definition

As a function, 'template' is called for each data item of the chart and takes the item object as a parameter.

template: function(obj){
    return webix.i18n.dateFormatStr("%F")(obj.date); //returns the month name
}

'lineColor' attribute. Function definition

Function definition allows you have different lines in different colors.

As a function, 'lineColor' is called for each data item of the chart and takes the item object as a parameter. Must return the true(show the line) or false(hide the line) value.

lineColor:function(obj){
    return (obj.year%2 ? "#e9eef9" : "#f3f7ff"); //colors lines for odd and even years in different colors
}

'lines' attribute. Function definition

Function definition allows you to manipulate the visibility of lines: to hide/show them depending on the specified rules. We reccomend 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 data item of the chart and takes the item object as a parameter. Must return the true(show the line) or false(hide the line) value.

lines:function(obj){
    return (obj.year%2 ? true : false); // hides lines for odd years
}
See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix ui widget library and page of javascript graph library product.