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
Parameter | Type | Description |
---|---|---|
seriesName | Comparable | The name you want to use to identify the series on the plot itself. |
t | Table | The table. |
sds | SelectableDataSet | Selectable data set (e.g., OneClick filterable table). |
categories | String | The column in |
y | String | The column in |
byColumns | list[String] | Column(s) in |
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()