Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 1020 Bytes

section_use_of_events.adoc

File metadata and controls

25 lines (17 loc) · 1020 Bytes

Using Events

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 RunRestart application server and log in to the system. Open the screen and click one of the columns.

chart with event
Figure 1. Chart that handles graph item click event