Vous êtes sur la page 1sur 3

Hi,

follow these steps


a) In view SCATTER graph element SCATTER is present, create an event CLICK in gr
aph properties for OnAction. While creating event do remember to transfer event
parameters( comes as checkbox in pop up while creating event ).
b) In the context of the view - Node SERIES add an attribute of type string name
d as EVENTID.
c) In the context node SERIES->COMPANY add an attribute EVENTID_CAT of type stri
ng.
d) Now we will fill attributes EVENTID and EVENTID_CAT created above and assign
some unique values for them.
e) In method DOINIT of the view the data is populated for the node SERIES and CO
MPANY. Here only we'll make the changes and fill eventid and eventid_Cat attribu
te.
Modify the doinit code as follows:
data: node_series type ref to If_Wd_Context_Node,
node_company type ref to If_Wd_Context_Node,
first_series_elem type ref to If_Wd_Context_Element,
second_series_elem type ref to If_Wd_Context_Element,
it_company1 TYPE if_scatterview=>elements_company,
it_company2 TYPE if_scatterview=>elements_company,
company1 LIKE LINE OF it_company1,
company2 LIKE LINE OF it_company2.

* navigate from <CONTEXT> to <SERIES> via lead selection


node_series = wd_context->get_child_node( Name = 'SERIES' ).
* create new element for node SERIES
first_series_elem = node_series->create_element( ).
* set attributes
first_series_elem->set_attribute( name = 'LABEL'
value = 'Morgan GmbH' ).
first_series_elem->set_attribute( name = 'EVENTID'
value = 'Series1' ). " event_id = Series1
first_series_elem->set_attribute( name = 'COLOR'
value = 'Series1' ).
* bind first element to node
node_series->bind_element( new_item = first_series_elem
SET_INITIAL_ELEMENTS = abap_false ).
* get sub node COMPANY
node_company = node_series->get_child_node( name = 'COMPANY' ).
* set attributes of the node COMPANY
* the following data is stored in the internal table it_company1
company1-time_scale = '19990101'.
company1-sales_volume = '0'.
company1-eventid_cat = '0'. " event id assignment when you click on point\cate
gory of graph
append company1 TO it_company1.
company1-time_scale = '20000101'.
company1-sales_volume = '1'.
company1-eventid_cat = '1'.
append company1 TO it_company1.
company1-time_scale = '20010101'.
company1-sales_volume = '3'.
company1-eventid_cat = '3'.
append company1 TO it_company1.
company1-time_scale = '20020101'.
company1-sales_volume = '3.5'.
company1-eventid_cat = '3.5'.
append company1 TO it_company1.
company1-time_scale = '20030101'.
company1-sales_volume = '6'.
company1-eventid_cat = '6'.
append company1 TO it_company1.
node_company->bind_table( it_company1 ).
* create new element for node SERIES
second_series_elem = Node_series->create_element( ).
* set attributes
second_series_elem->set_attribute( name = 'LABEL'
value = 'Freeman Inc.' ).
second_series_elem->set_attribute( name = 'COLOR'
value = 'Series2' ).
second_series_elem->set_attribute( name = 'EVENTID'
value = 'Series2' ). "event id series2 will be raised when you click on second
series
* bind second element to node
node_series->bind_element( new_item = second_series_elem
SET_INITIAL_ELEMENTS = abap_false ).
* get sub node COMPANY
node_company = second_series_elem->get_child_node( name = 'COMPANY' ).
* set attributes for second company element
* the following data is stored in an internal table it_company2
company2-time_scale = '19990101'.
company2-sales_volume = '0'.
company2-eventid_cat = '2.0'. "some unique event id
append company2 TO it_company2.
company2-time_scale = '20000101'.
company2-sales_volume = '4'.
company2-eventid_cat = '2.4'. "some unique event id
append company2 TO it_company2.
company2-time_scale = '20010101'.
company2-sales_volume = '7'.
company2-eventid_cat = '2.7'. "some unique event id
append company2 TO it_company2.

node_company->bind_table( it_company2 ).
f) Now as we have filled the values for attributes eventid and eventid_cat we'll
bind these attributes to series and point property eventid.
g) go to view design layout, expand graph and select SERIES COMPANY, In company
series properties bind the property evenID to attribute EVENTID of context node
SERIES.
h) Similarly bind the attribute EVENTID_CAT to eventid property of POINT element
present in graph ( will come when you expand series UI element ).
g) Now go to your main event creted CLICK, there you will see an importing param
eter EVENT_ID of type string, whenever you click on any series or any point on t
he graph this parameter will be filled with the attribute values which we filled
above.
Based on these values you can come to know which point is clicked and can progra
m further.

I hope this helps you..


Regards
Manas Dua

Vous aimerez peut-être aussi