Let us consider the use of events. We will add handling of a graph item click to the screen created in [cdb_creating_chart]. Open the screen controller in the IDE and inject the chart:
@Inject
private SerialChart serialChart;
Then add a listener at the bottom of the init(Map<String, Object> params)
method. When a chart receives data from DataProvider
, the getDataItemNN()
method should be used to get the item clicked. In this example, the SerialChart
component is bound to the datasource, so another method should be used: getEntityNN()
:
link:../../../../source/chart/GraphItemClickListener.java[role=include]
To see the results, rebuild the project using Run → Restart application server and log in to the system. Open the screen and click one of the columns.