Articles in this section
Category / Section

What is the use of columnDefinitions property in ejChart?

2 mins read

Essential Chart supports splitting the chart area into multiple columns by using the columnDefinitions property. It has options that allow you to specify the column width and unit to be considered like percentage or pixel, for the specified width of a column.

Horizontal axes can be added to a column using the columnIndex property of the axis. By default, all the horizontal axes are present at the column with index 0, that is, the first column. This property is useful in scenarios that need to display multiple series in the chart. It can also be used in combination with the rowDefinitions property to split chart area into multiple rows and columns.

Note that all the series in the chart should be compatible with each other when you are using the columnDefinitions property, since incompatible series types are not rendered. For example, column and bar type series are not compatible with each other. When any attempts are made to render incompatible series in different columns, either the column or the bar series will be drawn based on their position in the series collection.

JS

$("#container").ejChart({
 
     //Splitting chart area into multiple columns
    columnDefinitions: [{
 
       //Specifying width for the column
        columnWidth: 50,
 
        //Specifying width should be considered in percentage
        unit: 'percentage',
    },
    . . . . . . . .
    . . . . . . . .
    ],
    primaryXAxis: {
        //Placing axis at second column
        columnIndex: 1
    },
    axes: [{
        orientation: 'horizontal',
        name: 'SecondaryX',
        //Placing axis at first column. First column starts from the left side of chart area
        columnIndex: 0
    }],
    . . . . . . .
    . . . . . . .
});

Screenshot

The following screenshot displays chart with multiple columns.

Use of column definitions

Figure 1: Output

JS Playground sample link: Column Definitions

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied