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: 

SAP Graph - graph with many colors

Former Member
0 Kudos

Hi,

I have programmed graph display, using graphics proxy and classes LCL_DC_PREST, IF_GRAPHIC_PROXY, CL_GUI_GP_PRES.

It displays graphs like this <a href="http://img80.imageshack.us/img80/9259/graph1ys2.jpg">Graphics display before</a>

I would like to achieve graph colors like this:

<a href="http://img81.imageshack.us/img81/7321/graph2jw5.jpg">Graphics display new</a>

Is it possible to achieve?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi again

I managed to do the chart, it works perfectly, thank you.

I have another question.

I am able to set the background color of the bars on the chart. I can set it, using

CL_CU_DISPLAY_CONTEXT class and different attributes: CO_BG_STRUCTURE, CO_BG_CLR_PLT_ID, CO_AREA_STYLE and so on. With I can set the background to pattern, structure etc.

But I cannot find anywhere in the documentation how to set the color to AUTOMATIC. How to set it? It is possible to set the background to automatic in the right-click on the chart.

Thank you!

15 REPLIES 15

kai_gutenkunst
Active Contributor
0 Kudos

Hi,

yes, create an instance of cl_cu_values per data series and change the color as desired.

However, I recommend to use the chart engine instead. Have you already tried the SAP Chart Designer (cl_gui_chart_engine): SDN - Downloads - WebAS?

Regards, Kai

0 Kudos

Can you please provide some code example?

0 Kudos

Hi,

GFW: see report GFW_PROG_GET_CU_BUNDLE.

Chart Engine:

See chapter 3.2 'Attribute customizing' of XML Format.pdf (part of the SDN SAP Chart Designer package).

Regards, Kai

0 Kudos

Hi,

What I need to achieve is to have chart with for example only one bar, the value is 10, but 3 should be in green, 3 in yellow and 4 in blue color.

Is it possible to achieve? In all examples there is only bar by bar and every bar is in one color?

0 Kudos

Hi,

ok, then you do not need series customizing, but point customizing!

Each data point has to use its own point settings. This is done my marking a data point (using an arbitrary ID). Additionally you have to create point customizing (for each point) and use the same IDs.

GFW: GFW_PROG_POINT_WITH_LABEL

Chart Engine: in the Chart Designer right-click on Points and create a new point customizing. The default ID 'pointX' can be renamed as desired. In the data XML mark your point with the same ID, e.g. <Point customizing="pointX"><Value type="y">110</Value></Point>

Regards, Kai

Former Member
0 Kudos

Hi again

I managed to do the chart, it works perfectly, thank you.

I have another question.

I am able to set the background color of the bars on the chart. I can set it, using

CL_CU_DISPLAY_CONTEXT class and different attributes: CO_BG_STRUCTURE, CO_BG_CLR_PLT_ID, CO_AREA_STYLE and so on. With I can set the background to pattern, structure etc.

But I cannot find anywhere in the documentation how to set the color to AUTOMATIC. How to set it? It is possible to set the background to automatic in the right-click on the chart.

Thank you!

0 Kudos

Hi,

automatic coloring is only available using the chart engine; one more reason to switch from GFW to the chart engine

Regards, Kai

0 Kudos

How can I switch to chart engine? Is it built in to SAP GUI?

0 Kudos

Hi,

yes, the chart engine is available as a SAPGUI control (see class cl_gui_chart_engine, demo report graphics_gui_ce_demo) and as part of the IGS (see class cl_igs_chart_engine, demo report graphics_igs_ce_test).

The easiest way to check out all available features is to download the SAP Chart Designer (see my first answer for details). Use it to generate the customizing XML interactively. The package also contains documentation about the XML format of the data.

In your ABAP application you simply have to provide data and customizing XML for the chart engine (no matter if you use the SAPGUI control or the IGS).

Regards, Kai

0 Kudos

Hi

as I understand, once I generate customizing XML file, I do not need to build it every time? I have a requirement for every char-run to have different amount of bars, then I understand I have to build XML customizing every time on my own?

0 Kudos

No, it's also possible to use the Chart Designer for creating point customizing for N data points (e.g. with IDs Point1 .. PointN). Create this customizing once and use it at runtime without changes.

Regards, Kai

0 Kudos

Great, it works perfectly to me now It is not documented well anywhere so I appreciate your help very much.

I stored my XML customizing in SAP repository, t-code smw0. Do you think it is a good idea to keep it there?

0 Kudos

hi,

sorry for awakening this thread but i need to do exactly the same as u mentioned in

http://img81.imageshack.us/img81/7321/graph2jw5.jpg

i need to do a chart with one column that contains several colours..and lets say it will go from 1 to 10000.

witch on 2000 i'll need to put a label and it will be color 1, from 2000 to 6000 it will be in another color and there will be another label next to the 6000..and so on until it reaches 10000.

the thing is i need to do it dynamic, first i'll get all the numbers that i need to show...and than i'll make a chart from those numbers.

from what you wrote i understand you managed doing so...i would realy like to know how exactly..with more details

0 Kudos

Hi,

I need to do the same than you. A graphic where the charts can have different colors. I have searched information in Internet but I haven't found nothing. From what you wrote, I understand that you did it. Can you explain me please how did you develop it?

Thank you very much in advanced.

Former Member
0 Kudos

One more question.