Skip to main content
Skip table of contents

defineAxis

A child command of setChartData that defines the properties of one of the chart's axes. A chart may contain up to four axes, one for each edge of the chart, and two at minimum - one X-axis and one Y-axis. Note that charts of certain types, such as a pie chart, do not require any axes.

Parent commands

  • setChartData
    Required. Defines the chart data whose axis is being defined.

Child commands

  • addCategory
    Optional. If defining a category axis, these child commands are used to define the categories.

Attributes

type

Required

Value type

EL-evaluated

Yes

String

Yes

Defines the type of the axis. The resolved value is expected to be one of the following:

  • "category" - The axis displays category labels. Use addCategory child commands to define these labels.

  • "linear" - The axis displays a linear, numerical value scale. 

  • "logarithmic" - The axis displays a logarithmic, numerical value scale.

position

Required

Value type

EL-evaluated

Yes

String

Yes

Defines the position of the axis. The resolved value is expected to be one of the following:

  • "top"

  • "left" 

  • "bottom"

  • "right"

The Chart data may contain only one axis for a specific position. If multiple defineAxis command specify the same position, the axis definition of the command evaluated last will be in effect. 

id

Required

Value type

EL-evaluated

No

String

Yes

Defines an ID for the axis, which is needed if there are multiple axes of this orientation, such as two X-axes. A series-creating command can specify to map its data to this axis by having the resolved value of its xAxisID or yAxisID attribute match with the resolved value of this attribute.   

label

Required

Value type

EL-evaluated

No

String

Yes

Defines a label for this axis. The label is typically displayed alongside the axis on the chart.

If not defined, the axis will have no label.

max

Required

Value type

EL-evaluated

No

Number

Yes

Defines the maximum value displayed by this axis. This only applies if the axis type is "linear" or "logarithmic".

If this attribute and min are both defined, make sure that max is greater than min - otherwise the values of both attributes are discarded and become undefined.

If not defined, the axis' maximum value will be automatically defined based on the data displayed.

min

Required

Value type

EL-evaluated

No

Number

Yes

Defines the minimum value displayed by this axis. This only applies if the axis type is "linear" or "logarithmic".

If this attribute and max are both defined, make sure that max is greater than min - otherwise the values of both attributes are discarded and become undefined.

If not defined, the axis' minimum value will be automatically defined based on the data displayed.

displayGridLines

Required

Value type

EL-evaluated

No

Boolean

Yes

Defines if grid lines of this axis should be displayed on the chart. It may be useful to hide the grid lines in case there are more than two axes.

If not defined, value of "true" is used and the grid lines will be displayed.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.