deriveSeries
The Chart functionality requires additional licenses. Please contact support@documill.com to enable the licenses.
A child command of setChartData that adds a data series, with its data extracted from a Collection, to the chart data being created. Each item in the provided Collection is used to create a data point, with the data point's properties taken from an item using expressions defined by the attributes valueExpr
and labelExpr
. The data points in the series will be in the same order as their respective items within the Collection.
For example, if a Collection contains Data items with the keys "Name" and "Amount", a series with data points with Amount as the value, and Name being the default category label, could be created with labelExpr
of ${item.Name}
and valueExpr
of ${item.Amount}
. The expression format is much like an expression within a loop iterating through the Collection, with the iterated item's variable name being "item", or whatever the itemName
attribute resolves into.
Parent commands
setChartData
Required. Defines the chart data for which the series is for.
Attributes
value | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | Collection, Data Item | Yes |
Defines the Collection whose items provide the data for the data points of the created series. The value is primarily expected to be a Collection, but it may also be a Data Item, which is treated in the same way as a Collection containing that single item. |
itemName | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the name of the variable that represents the Collection item in the expressions defined for If not defined, value of "item" is used. |
valueExpr | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | Yes |
Defines the expression that will be used to resolve the value for a data point. The resolved value is expected, but not required to, make use of the variable holding the Collection item value, whose name is defined with the |
labelExpr | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines an expression that will be used to create a default category label for data points at the created data point's index. If the related |
label | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the label for the series. This label may be displayed on the chart to help identify the series. |
color | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines a color for the series. Data of this series on the chart will be displayed in this color. The resolved value is expected to specify a color in hexadecimal, RGB, or HSL notation. If not defined, the command rendering the chart will select the color to display this series in. |
type | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
This attribute may be used to set this series to displayed as a chart of a type different to the main type of this chart. The resolved value is expected to be one of the following chart types:
If not defined, this series is displayed according to the main type of the chart. |
xAxisID | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the X-axis the data points of this series map to. The resolved value is expected to match with the This attribute may be left undefined if the chart contains only one X-axis. |
yAxisID | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the Y-axis the data points of this series map to. The resolved value is expected to match with the This attribute may be left undefined if the chart contains only one Y-axis. |
pointLabelFontColor | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the font color of labels displaying values of the data points. This attribute being defined is also the requirement for these labels to be displayed at all. The resolved value is expected to specify a color in hexadecimal, RGB, or HSL notation. If not defined, value labels for the data points are not displayed. |
pointLabelBackgroundColor | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the background color of labels displaying values of the data points. The resolved value is expected to specify a color in hexadecimal, RGB, or HSL notation. This attribute has no effect if If not defined, value labels' background will be transparent. |
pointLabelPosition | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the position of labels displaying values of the data points. The resolved value is expected to be a String defining the position's anchor and alignment connected with a hyphen (e.g. "end-top", "center-left"). The anchor can be one of the following values:
The alignment can be one of the following values: center, top, right, bottom, left The position of the label is then mainly defined by the anchor point, and then shifted to a direction by the chosen alignment (except center, which causes no shift to occur). Note that the effects of the positioning vary between different chart types. Certain positions may also cause the value labels to overlap axis labels or chart legend. This attribute has no effect if If not defined, the position of "center-center" is used, placing the labels in the center of the data point. |
Examples
The deriveSeries
command provides a way to create simple series out of a Collection instead of using addSeries and addDataPoint with forEach. If one would have a Collection of Data items representing monthly work hours of an employee, with each item having the keys "workHours" and "month", deriveSeries
could create a series out of it like this:
<deriveSeries label="Monthly work hours" value="${workHours}" valueExpr="${item.workHours}" labelExpr="${item.month}">
With the labelExpr
attribute also defined, the chart also gets default category labels representing the months.