Skip to Content
0
Former Member
Apr 08, 2015 at 11:18 AM

SAPUI5 VIZ Chart Events in XML-Views

108 Views

Hi,

I'm trying to attach Events to Charts via XML-Views. The Idea is to have a chart above a table and a click on a datapoint/column will highlight the corresponding data in the table.

Since I am using XML-Views I cant figure out the right way - do i have to attach the events through javascript after the view was created?

My XML-Fragment:

<core:FragmentDefinition xmlns:core="sap.ui.core"
     xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:l="sap.ui.layout"
     xmlns:v="sap.viz.ui5" xmlns:vd="sap.viz.ui5.data" xmlns:vt="sap.viz.ui5.types"
     xmlns:f="sap.ui.layout.form" controllerName="zcfs_customer.Customer"
     xmlns:html="http://www.w3.org/1999/xhtml">
<v:Column width="100%" height="300px">
     <v:dataset>
          <vd:FlattenedDataset data="{/acctAggr}">
               <vd:dimensions>
                    <vd:DimensionDefinition axis="1" value="{ACCT_NR}" name="Account"></vd:DimensionDefinition>
               </vd:dimensions>
               <vd:measures>
                    <vd:MeasureDefinition value="{NUMBER_OF_TRANS}" name="Number of Transactions"></vd:MeasureDefinition>
               </vd:measures>
           </vd:FlattenedDataset>
     </v:dataset>
     <v:interaction>
          <vtc:Interaction supportedEventNames="mouseup,mousedown,mousemove,mouseout,mouseover,touchstart">
               <vtc:selectability>
                    <vtc:Interaction_selectability mode="none"></vtc:Interaction_selectability>
               </vtc:selectability>
          </vtc:Interaction>
     </v:interaction>
</v:Column>

I tried to add handlers="chartClick" to the <vtc:Interaction>-Node but it won't find it in the Controller and states "undefined" in the console - but it is present in my Controller:

chartClick : function(evt) {
     console.log(evt);
}

Any hints?

I would like to do as much as possible through my XML-Views.

greetz

Ruven