Skip to Content
0
Former Member
Dec 23, 2010 at 09:59 AM

perform dynamically cl_gui_chart_engine

172 Views

Hi experts,

I copy the code of program GRAPHICS_GUI_CE_DEMO to create a dynamic graph.

I create two list box on screen and a container, I split container in two part 1 for alv and second for graph.

if user change the list box field, alv will change and graph also will change.

i use below code in pbo of screen. it work but when user change list box, alv contains are change but graph

area display only chart grids only, no columns and other things like title etc. are displaying.

if i comment CALL METHOD l_ixml_custom_doc->render at end, the graph display changes but

customize setting not apply.

IF g_ce_container IS INITIAL OR
    ( oldl1f <> l1field OR oldl2f <> l2field ).
    IF g_ce_container IS NOT INITIAL.
      CALL METHOD g_ce_container->free.
      CLEAR g_ce_container.
      CLEAR alv.
      CLEAR : g_ce_cont_split, g_ce_cont_graph, g_ce_cont_alv,
              g_ce_viewer, g_design_mode, g_value_change,
              g_ixml_sf
              .
      CLEAR g_ce_viewer_eh.
      g_ixml_sf = g_ixml->create_stream_factory( ).
*
    ENDIF.
* Create the object for container.
    CREATE OBJECT g_ce_container
      EXPORTING
      container_name = 'CONTAINER_GRAPH'.


    CREATE OBJECT g_ce_cont_split
        EXPORTING
          parent  = g_ce_container
          rows    = 1
          columns = 2
          align   = 15
          .
*call method g_ce_cont_split->set_border
*       exporting border = '1'.

    CALL METHOD g_ce_cont_split->set_column_width
      EXPORTING
        id    = 2
        width = 75.
    CALL METHOD g_ce_cont_split->get_container
      EXPORTING
        row       = 1
        column    = 1
      RECEIVING
        container = g_ce_cont_alv.

    CALL METHOD g_ce_cont_split->get_container
      EXPORTING
        row       = 1
        column    = 2
      RECEIVING
        container = g_ce_cont_graph.

* Bind the container to the object.
    CREATE OBJECT g_ce_viewer
      EXPORTING
        parent = g_ce_cont_graph.

    CREATE OBJECT g_ce_viewer_eh.

    SET HANDLER g_ce_viewer_eh->on_click FOR g_ce_viewer.
    SET HANDLER g_ce_viewer_eh->on_value_change FOR g_ce_viewer.
    SET HANDLER g_ce_viewer_eh->on_property_change FOR g_ce_viewer.

    PERFORM create_data_demo USING l_ixml_data_doc.
    l_ostream = g_ixml_sf->create_ostream_xstring( l_xstr ).
    CALL METHOD l_ixml_data_doc->render
      EXPORTING
        ostream = l_ostream.
    g_ce_viewer->set_data( xdata = l_xstr ).

    CLEAR l_xstr.
    PERFORM create_custom_demo USING l_ixml_custom_doc.
    l_ostream = g_ixml_sf->create_ostream_xstring( l_xstr ).
    CALL METHOD l_ixml_custom_doc->render
      EXPORTING
        ostream = l_ostream.
    g_ce_viewer->set_customizing( xdata = l_xstr ).

  ENDIF.

CALL METHOD g_ce_viewer->render.