The piweb.events module encapsulates the events with the associated callbacks that are triggered by the PiWeb host application. The callback functions serve as
entry points for almost everything that happens in a plot extension, like drawing and data processing.
'use strict';
import * as piweb from'piweb';
piweb.events.on("load", load);
functionload()
{
//1. The plot is loaded, e.g. when adding the element to the report.
piweb.logger.debug(`'load' called`)
}
piweb.events.on("dataChanged", dataChanged);
functiondataChanged()
{
//2. The data of the databinding has been fetched.
piweb.logger.debug(`'dataChanged' called`)
}
piweb.events.on("render", render);
functionrender( context: piweb.drawing.DrawingContext )
{
//3. The plot is rendered. This happens whenever anything on the page changes.
piweb.logger.debug(`'render' called`)
}
piweb.events.on("dataBindingChanged", dataBindingChanged);
functiondataBindingChanged()
{
//4. The databinding was modified. Subsequently, 'dataChanged' and 'render' will be called.
piweb.logger.debug(`'dataBindingChanged' called`)
}
Introduction
The
piweb.events
module encapsulates the events with the associated callbacks that are triggered by the PiWeb host application. The callback functions serve as entry points for almost everything that happens in a plot extension, like drawing and data processing.'use strict'; import * as piweb from 'piweb'; piweb.events.on("load", load); function load( ) { //1. The plot is loaded, e.g. when adding the element to the report. piweb.logger.debug(`'load' called`) } piweb.events.on("dataChanged", dataChanged); function dataChanged( ) { //2. The data of the databinding has been fetched. piweb.logger.debug(`'dataChanged' called`) } piweb.events.on("render", render); function render( context: piweb.drawing.DrawingContext ) { //3. The plot is rendered. This happens whenever anything on the page changes. piweb.logger.debug(`'render' called`) } piweb.events.on("dataBindingChanged", dataBindingChanged); function dataBindingChanged( ) { //4. The databinding was modified. Subsequently, 'dataChanged' and 'render' will be called. piweb.logger.debug(`'dataBindingChanged' called`) }
drawing
data