cancel
Showing results for 
Search instead for 
Did you mean: 

GRAPH TYPE CHANGE DYNAMICALLY

Former Member
0 Kudos

Dear All,

How to change the business graph chart type dynamically in the code.

Please help me.

Regards,

Arun

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Create a context attribute CHART_TYPE of type WDUI_BGTYPE.

And set the type of chart you want by setting this attribute.

lv_chart = '01'.   "Bar type
wd_context->set_attribute
exporting
name = 'CHART_TYPE'
value = lv_chart.

Regards,

Lekha.

Edited by: Lekha on Aug 28, 2009 11:57 AM

Former Member
0 Kudos

Thanks for replay,

Kindly tell me where to assign the attribute.

Regards,

Arun

Former Member
0 Kudos

Hi,

Is this the dynamic BG element that is getting generated.

Bind the Chart type of BG to this context attribute. If you want to use it globbaly then create this under a node in the

compoennet controller.

How many views are there. Are you giving any input based on which you are trying to show BG.

You can write it either in WDODINIT or HANDLER for Plugs.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

I have one view,when dropdown is changed the BG should change the chart type.

I have done the code for change the Attribute "CHART_TYPE". but i could not assign the chart_type attribute into

CHART TYPE property in GRAPH control. is there any code to get the GRAPH control and assign the attribute?.

Regards,

Arun

Former Member
0 Kudos

Hi,

On the dropdown selection, set the attribute for chart type.

You have to bind this attribute to the charttype property of the BG.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

There is no direct binding possible for chart type property of BG. So you need to do that using its handler as follows:


  DATA: lr_view_elem    TYPE REF TO if_wd_view_element,
        lr_bg           TYPE REF TO cl_wd_business_graphics,
        l_chart_type    TYPE WDUI_BGTYPE.

***Changing Customizing file for BG depending on graph
  IF wd_this->gr_view IS NOT INITIAL.                             "Get global view controller from WDDOMODIFY method
***Get Business graphic element from view
    CALL METHOD wd_this->gr_view->get_element
      EXPORTING
        id      = 'BG_TEST'      "Name of Business graph UI element
      RECEIVING
        element = lr_view_elem.
***Get Business graphic element object
    lr_bg ?= lr_view_elem.
l_chart_type = '02'.   "Columns
lr_bg->SET_CHART_TYPE( l_chart_type ).
endif.

Thanks,

Tejaswini

Former Member
0 Kudos

Hi,

Sorry, Yes there is no direct binding option available. You can refer to Tesjawin's code for the same.

Regards,

Lekha.

Former Member
0 Kudos

Hai,

Kindly tell me how to define the gr_view in modify method.

Regards,

Arun

0 Kudos

Hi Arun,

Go to the tab 'Attributes' in your WebDynpro View and define gr_view Type Ref to IF_WD_VIEW. For rest of the procedure follow the steps above.

Regars,

Viqar.

0 Kudos

Also do not forget to assign the view reference to your attributein the WDDOMODIFYVIEW method.

Ie. In the WDDOMODIFYVIEW write:

IF first_time eq abap_true.

wd_this->gr_view = view.

ENDIF.