Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Chart Pie with chart designer --> Set color

Former Member
0 Kudos

Hello,

I created xml customizing which i use to create a chart pie.

The chart pie is created, but the color settings are ignored.

I do not know how to set the customizing ID so that the pie gets the color.

Do I have to create Points? I tried to find example coding but in program GRAPHICS_IGS_CE_TEST there is only coding for a column chart.

Any idea or example coding? This is my first chart and i am not that familiar with it. I also have not fully understood the relationship between the XML customizing and the Data customizing ... and how I have to create the Data customizing. I used the above mentioned program.

Thank you!!

Here is the coding I created so far:

FORM create_data_pie USING p_ixml_doc TYPE REF TO if_ixml_document.

      • Chart type = Pie, 4 Categories, 1 Series

DATA: l_simplechartdata TYPE REF TO if_ixml_element,

l_categories TYPE REF TO if_ixml_element,

l_series TYPE REF TO if_ixml_element,

l_points TYPE REF TO if_ixml_element,

l_element TYPE REF TO if_ixml_element,

l_encoding TYPE REF TO if_ixml_encoding.

DATA: lv_value TYPE string.

p_ixml_doc = g_ixml->create_document( ).

l_encoding = g_ixml->create_encoding(byte_order = if_ixml_encoding=>co_little_endian

character_set = 'utf-8' ).

p_ixml_doc->set_encoding( l_encoding ).

l_simplechartdata = p_ixml_doc->create_simple_element(

name = 'SimpleChartData' parent = p_ixml_doc ).

l_series = p_ixml_doc->create_simple_element(

name = 'Series' parent = l_simplechartdata ).

      • Piece 1

l_element = p_ixml_doc->create_simple_element(

name = 'S' parent = l_series ).

lv_value = gs_interface_data-fld41.

l_element->if_ixml_node~set_value( lv_value ).

      • Piece 2

l_element = p_ixml_doc->create_simple_element(

name = 'S' parent = l_series ).

lv_value = gs_interface_data-fld73.

l_element->if_ixml_node~set_value( lv_value ).

      • Piece 3

l_element = p_ixml_doc->create_simple_element(

name = 'S' parent = l_series ).

lv_value = gs_interface_data-fld95.

l_element->if_ixml_node~set_value( lv_value ).

      • Piece 4

l_element = p_ixml_doc->create_simple_element(

name = 'S' parent = l_series ).

lv_value = gs_interface_data-fl110.

l_element->if_ixml_node~set_value( lv_value ).

ENDFORM.

Edited by: Viktoria P. on Oct 4, 2011 5:10 PM

2 REPLIES 2

Former Member
0 Kudos

Hi,

in case anybody else might have the same question.

I inserted the following coding after every element creation.

l_element->set_attribute( name = 'customizing'

value = 'Category1' ).

The value has to be the ID of the Point within the XML customizing (ID is also visible in the chart engine --> Data series -> Series ) where you define the color settings.

Regards

Viktoria

0 Kudos

Thank you for sharing your solution, I am trying to apply the same requirement to a BSP pie chart, regardless of what I do I get the chart in shades of green. The customizing XML looks fine in chart designer with the point colors as specified. I am using IF_GRAPH_DATA_MODEL~GET_DATA_XML to define the data elements and have had no change in the colors - code below.

 

LOOP AT l_series_1_data-point_data INTO l_point_data.

l_s_element = l_document->create_simple_element( parent = l_series_1_element name = 'S' value = l_point_data-value ).

l_tooltip = 'title='.

CONCATENATE l_tooltip l_apostrophe l_point_data-tooltip l_apostrophe INTO l_tooltip.

l_s_element->set_attribute( name = 'extension' value = l_tooltip ).

CASE sy-tabix.

WHEN 1.

l_s_element->set_attribute( name = 'customizing' value = 'Category1' ).

WHEN 2.

l_s_element->set_attribute( name = 'customizing' value = 'Category2' ).

WHEN 3.

l_s_element->set_attribute( name = 'customizing' value = 'Category3' ).

WHEN 4.

l_s_element->set_attribute( name = 'customizing' value = 'Category4' ).

WHEN 5.

l_s_element->set_attribute( name = 'customizing' value = 'Category5' ).

WHEN OTHERS.

ENDCASE.

ENDLOOP.

I have since copied GRAPHICS_GUI_CE_DEMO and converted it to PIE, and it is all shades of blue, currently I am trying to replicate the customizing XML in the program to match what chart designer had, any tips would be much appreciated.