Template ViewHelper <c:plugin>
ViewHelper that includes a plugin.
Go to the source code of this ViewHelper: PluginViewHelper.php (GitHub).
Arguments
The following arguments are available for the plugin ViewHelper:
chartId
-
- Required
true
- Type
- string
key
-
- Required
true
- Type
- string
Plugin key
fileName
-
- Default
- ''
- Type
- string
File name containing the JavaScript function
Examples
The following examples should be included in the "Templates" field of the "Fluid Parser" tab of the plugin.
With fileName attribute
<c:plugin chartId="pieChart__1" key="chartAreaBorder" fileName="EXT:sav_charts/Resources/Public/Plugins/ChartAreaBorder.js" />
Copied!
Child nodes
The JavaScript function is directly inserted in the child.
<c:plugin chartId="pieChart__1" key="chartAreaBorder">
beforeDraw(chart, args, options) {
const {
ctx,
chartArea: { left, top, width, height }
} = chart;
ctx.save();
ctx.strokeStyle = options.borderColor;
ctx.lineWidth = options.borderWidth;
ctx.setLineDash(options.borderDash || []);
ctx.lineDashOffset = options.borderDashOffset;
ctx.strokeRect(left, top, width, height);
ctx.restore();
}
</c:plugin>
Copied!