The chart control supports unlimited number of axes. They can be added and customized in several ways.
Each ready-to-use chart component that uses the Cartesian coordinate system (line chart, bar chart) exposes two properties: xAxis and yAxis. You can use them to specify the basic settings of an axes:
JavaScript Copy Code |
---|
lineChart.yAxis.minValue = 0; |
The Axis class exposes also numberFormat property, which you can use to specify how the labels will appear using the standard format strings.
In order to style an axis specified this way you must use the properties of the theme class:
JavaScript Copy Code |
---|
lineChart.theme.axisLabelsFontSize = 14; |
In case you are building your dashboard or plot that uses custom axes you must follow these simple steps:
JavaScript Copy Code |
---|
var commonAxis = new Charting.Axis(); |
JavaScript Copy Code |
---|
var commonAxisRenderer1 = new Charting.XAxisRenderer(commonAxis); |
The AxisRenderer class is the one where you find the styling options. Here is a XAxisRenderer that specifies the color of the axis, axis title and labels.
JavaScript Copy Code |
---|
var commonAxisRenderer1 = new Charting.XAxisRenderer(commonAxis); |
The AxisRenderer must be added to a layout panel, where it will be measured and arranged. For instance, a GridPanel:
JavaScript Copy Code |
---|
// set up grid panel grid.children.add(commonAxisRenderer1); |
You might want to designate the axis to be a particular axis in a plot:
JavaScript Copy Code |
---|
var plot1 = new Charting.Plot2D(); |
The plot then can be added to another element, for instance a grid.
JavaScript Copy Code |
---|
plot1.gridColumn = 1; |