Skip to main content
Version: Java (Groovy)

catPlotBy

The catPlotBy method creates multiple category plots per distinct grouping value specified in byColumns.

Syntax

catPlotBy(seriesName, t, categories, y, byColumns)
catPlotBy(seriesName, sds, categories, y, byColumns)

Parameters

ParameterTypeDescription
seriesNameComparable

The name you want to use to identify the series on the plot itself.

tTable

The table.

sdsSelectableDataSet

Selectable data set (e.g., OneClick filterable table).

categoriesString

The column in t contains discrete data.

yString

The column in t that contains the Y variable data.

byColumnslist[String]

Column(s) in t that holds the grouping data.

Returns

A category plot with multiple series.

Examples

The following example creates two plots with catPlotBy. The two plots show the difference changing the by column makes.

source = newTable(
stringCol('Department', 'HR', 'HR', 'HR', 'IT', 'IT', 'IT'),
stringCol('EmployeeType', 'Junior', 'Mid-Level', 'Senior', 'Junior', 'Mid-Level', 'Senior'),
intCol('Count', 5, 12, 3, 7, 6, 2)
)

employeeTypesByDepartment = catPlotBy('No. of employees per dept.', source, 'EmployeeType', 'Count', 'Department').show()
employeeDepartmentsByType = catPlotBy('Employee departments by type', source, 'Department', 'Count', 'EmployeeType').show()

img img