Charts - Dynamic change of color (cl_gui_chart_engine set_customizing) ST

Dear all,
I want to influence the colors in chart which I created via class cl_gui_chart_engine. The first time I call the chart the columns are displayed in the desired colours (column 1 =  green / column 2 = red). BUT,when I influence the global variable g_trn  at runtime (see coding) I don't get the expected result (column 1 = red / column 2 = green). Other paramters (like title) work, but the colours somehow do not change. Any ideas? I guess I'm not the only one out there who wants a chart with GREEN (positive) and RED (negative) columns / lines...
Thanks & kind regards Benno
CONSTANTS: c_color_green(14) type c value 'RGB(60,248,80)',
                       c_color_red(14)   type c value 'RGB(248,80,60)'.
  IF g_trn IS INITIAL.
    l_color_1 = c_color_red.
    l_color_2 = c_color_green.
  ELSE.
    l_color_1 = c_color_green.
    l_color_2 = c_color_red.
  ENDIF.
  CLEAR l_xstr.
  CALL TRANSFORMATION z_gui_chart_engine_layout
      SOURCE title               = g_bupa
             category_axis_title = 'Time'
             value_axis_title    = 'Volume'
             chart_type          = 'Columns'   
             dimension           = 'PseudoTwo'
             colorpalette        = 'Tradeshow'
             color_1             = l_color_1
             color_2             = l_color_2
      RESULT XML l_xstr.
  g_viewer_r4->set_customizing( xdata = l_xstr ).
  CALL METHOD g_viewer_r4->render.
Transformation:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
  <tt:root name="CHART_TYPE"/>
  <tt:root name="DIMENSION"/>
  <tt:root name="TITLE"/>
  <tt:root name="CATEGORY_AXIS_TITLE"/>
  <tt:root name="VALUE_AXIS_TITLE"/>
  <tt:root name="COLORPALETTE"/>
  <tt:root name="COLOR_1"/>
  <tt:root name="COLOR_2"/>
  <tt:template>
    <SAPChartCustomizing version="2.1">
      <GlobalSettings>
        <ColorPalette>
          <tt:value ref="COLORPALETTE"/>
        </ColorPalette>
        <Dimension>
          <tt:value ref="DIMENSION"/>
        </Dimension>
        <Defaults>
          <ChartType>
            <tt:value ref="CHART_TYPE"/>
          </ChartType>
        </Defaults>
      </GlobalSettings>
      <Elements>
        <ChartElements>
          <Title>
            <Caption>
              <tt:value ref="TITLE"/>
            </Caption>
            <Text>
              <Size>14</Size>
            </Text>
          </Title>
        </ChartElements>
        <ChartAxes>
          <CategoryAxis>
            <Title>
              <Caption>
                <tt:value ref="CATEGORY_AXIS_TITLE"/>
              </Caption>
            </Title>
          </CategoryAxis>
          <ValueAxis id="ValueAxis1">
            <Title>
              <Caption>
                <tt:value ref="VALUE_AXIS_TITLE"/>
              </Caption>
            </Title>
          </ValueAxis>
        </ChartAxes>
      </Elements>
      <Values>
        <Series id="Series1">
          <LineColor>
            <tt:value ref="COLOR_1"/>
          </LineColor>
          <Color>
            <tt:value ref="COLOR_1"/>
          </Color>
        </Series>
        <Series id="Series2">
          <LineColor>
            <tt:value ref="COLOR_2"/>
          </LineColor>
          <Color>
            <tt:value ref="COLOR_2"/>
          </Color>
        </Series>
      </Values>
    </SAPChartCustomizing>
  </tt:template>
</tt:transform>

I think it would work with CL_GUI_CHART_ENGINE_WIN but the RENDER method of CL_GUI_CHART_ENGINE checks if m_gui_control is initial, which probably isn't true ?

Similar Messages

  • Dynamically changing the color of nodes in a JTree

    I have created a JTree and want to dynamically change the color of some of the TreeNodes as my program runs. The JTree is displayed in a JPanel. There is an algorithm built into which identifies the nodes whose color I need to change. No user actions is performed (everythign is internal to the program).
    It seems that in the TreeCellRender only kicks in when the tree is first displayed. How do I get it to re-render the tree when the TreeModel changes? It seems that the Listeners are only looking for external user interactions.
    Any help would be greatly appreciated.
    Thanks!

    I think I was a bit too vague in my question. Let me try again...
    I have changed an attribute in a node in a JTree. This attribute is changed after the tree was initially rendered, but while the program is still running. I want to tell the TreeCellRenderer to look again at this node since that attribute that was changed will effect how the node should be renderered. I tried using the nodeChanged() method, but it did not work (the colot of the node did not change). Any advise how I can do this?
    Thanks!

  • Dynamically changing row color in an ADF table?

    Hi,
    I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Can anyone please let me know the code for dynamically changing the row color of an ADF table?
    Thanks,
    Vik

    well you can use EL on af:column inlineStyle property to change the color on condition
    e.g
    inlineStyle='#{(row.SelectedRow)?"background-color: Silver":""};a example can be found here it is changing color based on Checkbox selection http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html

  • Dynamic change color of series in line chart

    Hi
    I would like to be able to dynamically change the color of the individual series in a line chart, based on user preference. It works excellent having dynamic labels on the series using the &item. syntax and a before header computation.
    The same approach for the color does not seem to work. I get errors like undefined entity....
    Any ideas?
    Best regards Jesper

    Very surprisingly the following code (also generated by the macro recording) works ok.
    (I selected the serie inside the chart instead of selecting the serie in the legend)
        ActiveChart.FullSeriesCollection(1).Select
        With Selection.Format.Fill
            .Visible = msoTrue
            .ForeColor.ObjectThemeColor = msoThemeColorAccent3
            .ForeColor.TintAndShade = 0
            .ForeColor.Brightness = -0.25
            .Transparency = 0.3000000119
            .Solid
        End With
    If an MVP or Microsoft official come accross this, I suggest further testing as it is very likely a bug (with the first set of code generated by Excel)

  • How do I change the colors to whatever I want within a chart?

    I see that i can change the colors to a few predetermined color combinations, however I need them to be a specific color in a specific order.  Is that possible?

    You can click on each series in a chart and change the color here:
    SG

  • Change graph color dynamically in Discoverer

    Hi,
    Is it possible to change the background color for a graph based on certain condition? If so, how should I do it?
    Thanks,

    No - you cannot dynamically change the color of a graph or graph element in Discoverer.
    Thanks
    Abhinav
    Oracle Business Intelligence Product Management
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    Documentation: http://www.oracle.com/technology/documentation/appserver1012.html
    Discoverer: http://www.oracle.com/technology/products/discoverer/
    BI Software: http://www.oracle.com/technology/software/products/ias/devuse.html
    BI Samples: http://www.oracle.com/technology/products/bi/samples/
    Blog: http://oraclebi.blogspot.com/

  • Dynamically setting the color of the title in a Panel

    Hello, I know I can set the color & font of the title in a Panel using the titleStyleName in a stylesheet.  How can I dynamically change the color though?  I have a component:
             <mx:Panel id="myPanel"borderColor="{this.color1}" />
    where this.color1 is a value that changes dynamically, and thus changes the border color.  How do I do this for the color of the text in the title?

    Hi,
    Try this
    var css:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".myPanelTitle");
    css.setStyle("color",0x00FF00);

  • How can I change the color of plot in a waveform chart and graph?

    There are 4 plots in a waveform chart, from plot0 to plot3, and I want to chang the color of plots dynamicly up to my needs when the VI is running.
    For example, as show in the picture, i want to set the plot0 as RED, and plot1 is BLUE, plot2 is YELLOW, plot3 is GRAY.
    If there is only one plot, i can change it's color, however when there are more than one plot, it fail.
    How can I do it?
    Thanks
    Attachments:
    waveform.JPG ‏61 KB

    Hello MilkyStone,
    first you have to set the active plot, then change its color (or other properties). All that is done using property nodes.
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to programatically (dynamically) change the chart legend ?

    How do I add new labels/symbols to the chart legend dynamically ?
    I'm creating a scatter graph using the query
    select A,B,C from tableX group by A
    B is the y-axis, C is the x-axis. Points plotted for each grouping of A will be a different color. I know I can change the color of the point to be plotted thru the format trigger. The format trigger will change the color of the plotted points when there is a change in the grouping of A. My problem is how can I add a new label/color to the legend for each grouping of A as it is plotted ? The number of groupings of A is variable depending on what's in tableX. I need to programatically create the legend (each grouping of A will have it's own label/color) thru the format trigger as I won't know before hand how many groupings of A there will be.

    Try with Presentation variables.

  • Changing the custom XML for a flash chart dynamically

    Hello
    I am wondering if anyone has found a way to change the custom XML
    for a flash chart dynamically.
    For instance.
    On the www.anychart.com website their is a gallery with charts.
    I have studied one called "2Dlinetimechart. It has hours on the X-axis.
    When I view the XML for this chart.
    I found this enrty
    - <block color="0x0080C0" border_color="0x0080C0" name="Sales dept.">
    <set value="0" argument="0" name="00:00" />
    <set value="1" argument="0" name="01:00" />
    It uses the tag value to set the position on the X-axis. But the tag name to set the labels on the X-axis.
    I have not found a way to do this in application express 3.0.
    Therefore I wonder if I can change to XML dynamically, and build my own block based on the input I have.
    Or even build a chart, based on a xml that I create first then sends to the object that renders the chart.
    Hope this makes sence ?
    Ulf
    PS this is related to my question about
    http://forums.oracle.com/forums/thread.jspa?messageID=1887210?
    using dates on the x-axis.
    But would by nice to know a general method to rebuild the xml-file dynamically so I can change the chart within the limits of the xml-definition.

    String value = ResultSet.getObject("myfield").toString();
    String opvalue = "15";
    <OPTION Value=15 <%=((opvalue.equals(value))?"selected":"")%>>

  • Dial chart dynamic color range

    Hi
    I am trying to dynamically change range of the scalebar color.
    I see that I can give Apex a low and high value exactly for this reason.
        Invalid Dial chart query, use the following syntax:
         SELECT VALUE, MAX [, LOW, HIGH] VALUE FROM ...
        VALUE      Numeric column that defines dial value.
        MAX      Numeric column that defines Maximum dial value.
        LOW (optional)      Numeric column that defines the low value of a range to display on the dial. If this value is defined, a HIGH value is required.
        HIGH (optional)      Numeric column that defines the high value of a range to display on the dial. If this value is defined, a LOW value is required.
        This query should return one row.I would hope for Apex to use those value in the #SCALE_DATA# in the Chart XML.
    <axis start_angle="90" sweep_angle="180" >
    #SCALE_DATA#
            <labels enabled="true" align="Inside" text_align="Near" rotation="0" >
                  <format><![CDATA[{%Value}{numDecimals:0,decimalSeparator:\,,thousandsSeparator: }%]]></format>
              <font family="Tahoma" size="10" color="#000000" />
            </labels>
    </axis>But it does not seems to work.
    I only need to add those lines
    <scale_bar enabled="false" />
    <color_ranges>
       <color_range start="0" end="25" color="Red" />
       <color_range start="25" end="90" color="Green" />
       <color_range start="90" end="100" color="Red" />
    </color_ranges>25 being the #LOW# value and 90 the #HIGH# value.
    I do not want to use custom XML everywhere.
    ANy iadea if I can modify the default XML or modify the behavior of the #SCALE_DATA# ?
    Thanks a lot
    Sebastien

    Hello,
    What do you mean by maximum value?
    The 10 in the query is to figure out values other than the dial itself there is not a graphical component that represents that number.
    The high line usually is used historical maximum value. Do you want to change the color of the dial when it hits 10?
    Carl

  • Help Needed : Changing the Color of Bar Graph Dynamically

    Hi..
    Is der any body to help me out...?
    My Question is :- How to change the color of Bar graph Dynamically..
    For example (Assume when one of the Bar Graph crosses certain limit of Y axis value mentioned, the graph must be changed into RED color)
    Thanks in Advance
    Edited by: user12873839 on Mar 30, 2010 10:03 PM

    Manoj,
    You have to create the entire chart manually. follow the below steps. You can refer to the anychart website for more help on different tags and features.
    1. Enter the following code in the html header of the page
    <script src="#WORKSPACE_IMAGES#AnyChart.js"  type="text/javascript" > </script>2. Create an ON Demand Application process by going to the Home>Application Builder>Application #>Shared Components>Application Processes
    3. Click On Create
    4. Enter the name as DYNAMIC_BAR_GRAPH_CHART
    5. Select the processing point as On Demand
    6. Click on Nxt
    7. Enter the following code in the processing text
    DECLARE
    BEGIN
    OWA_UTIL.mime_header ('text/xml', FALSE);
    OWA_UTIL.http_header_close;
    HTP.p ('<?xml version = "1.0" encoding="utf-8" standalone = "yes"?>');
    HTP.p ('<anychart>');
         HTP.p ('<settings>');
              HTP.p ('<animation enabled="True"/>');
         HTP.p ('</settings>');
      HTP.p ('<charts>');
       HTP.p ('<chart plot_type="CategorizedVertical">');
         HTP.p ('<data_plot_settings default_series_type="Bar">');
              HTP.p ('<bar_series>');
                        HTP.p ('<tooltip_settings enabled="True">');
                        HTP.p ('<position valign="Top" halign="Right"/>');
                        HTP.p ('<format> Name: {%Name}');
                        HTP.p ( 'Value : ${%YValue}{numDecimals:0}');
                        HTP.p ('</format>');
                        HTP.p ('<font bold="false"/>'); 
                        HTP.p ('<background>');
                        HTP.p ('<corners type="Rounded" all="3"/>');
                        HTP.p ('<border type="Solid" color="DarkColor(%Color)" thickness="2"/>');
                        HTP.p ('</background>');
                   HTP.p ('</tooltip_settings>');
              HTP.p ('</bar_series>');
         HTP.p ('</data_plot_settings>');
         HTP.p ('<data>');
              HTP.p ('<series name="series 1">');
               FOR cThis IN (select table2.name, table2.value
                                  from table1,table2,table3
                                  where table1.T1ID = table3.T3ID
                                  and table2.T3ID = table3.T3ID
                                  and table3.C_ID=1
                                  and table3.A_ID=1
                        ORDER BY table2.name )
              LOOP
                   IF cThis.value > 90 THEN
                        HTP.p ('<point name="' || cThis.name || '" y="'|| cThis.value || '" color="red"/>');
                    ELSE
                        HTP.p ('<point name="' || cThis.name || '" y="'|| cThis.value || '" />');
                   END IF;
              END LOOP;
              HTP.p ('</series>');
         HTP.p ('</data>');
         HTP.p ('<chart_settings>');
              HTP.p ('<title>');
                   HTP.p ('<text>Chart Title</text>');
              HTP.p ('</title>');
              HTP.p ('<axes>');
                   HTP.p ('<y_axis>');
                        HTP.p ('<title>');
                             HTP.p ('<text>Value</text> ');
                        HTP.p ('</title>');
                        HTP.p ('<labels>');
                             HTP.p ('<format>${%Value}{numDecimals:0}</format>');
                        HTP.p ('</labels>');
                   HTP.p ('<axis_markers>');
                   HTP.p ('</axis_markers>');
                   HTP.p ('</y_axis>');
                   HTP.p ('<x_axis position="Normal" align="inside">');
                   HTP.p ('<labels display_mode="Rotated" rotation="90" align="inside" />');
                   HTP.p ('<title>');
                        HTP.p ('<text>Name</text> ');
                   HTP.p ('</title>');
                   HTP.p ('</x_axis>');
              HTP.p (' </axes>');
         HTP.p ('</chart_settings>');
        HTP.p ('</chart>');
      HTP.p ('</charts>');
    HTP.p ('</anychart>');
    htmldb_application.g_unrecoverable_error := true;
    END;8. Click on Create Process
    Now we will create a html region to display the graph.
    9. Create a new region of type HTML on the same page and select the region template as no template.
    10. Enter the following code in the region source
    &lt;div id="DynamicaBarGraph"></div>
    &lt;script type="text/javascript" language="javascript">
    function DynamicaBarGraph()
    var DynamicaBarGraph = new AnyChart('/i/flashchart/swf/AnyChart.swf');
    //    DynamicaBarGraph.width = "400";
    //    DynamicaBarGraph.height = "400";
    DynamicaBarGraph.addEventListener('pointClick', onDynamicaBarGraphClick);
        var DynamicaBarGraphData = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=DYNAMIC_BAR_GRAPH_CHART',0);
        gReturn = DynamicaBarGraphData.get();
        DynamicaBarGraph.setData(gReturn);
        DynamicaBarGraph.write("DynamicaBarGraph");
    function onDynamicaBarGraphClick(e)
    // Read point name
         name=e.data.Name;
    // Read point value
         value=e.data.YValue;
    // You can add onclick even here using the values name and value
    DynamicaBarGraph();
    </script> Hope it helps. Thanks.
    Regards,
    Manish

  • How can I change the color of chart in webi report

    Hi :
      I create one Webi report including one table and chart  In BO 4.0.
    The chart  display  the relationship between sales-amount and profit amount . I do not want to use the default color but want to specify the red color for sales-amount and yellow color for profit amount . How can I do it ??
    Thanks Very Much
    Emily MA

    Hi,
    You can change the color very easily. It's simple & straight forward which I found it couple of days back. (Sometimes simple things are hard to find :-p )
    Select the area in the Chart that you want to change color, then go to Format > Style > Background color. Now select the color that you want. In the attached picture, I have selected Yellow color for a piece of pie chart.

  • How to change the colors for individual bubbles in a bubble chart?

    I have a report where in a bubble chart needs to be shown with different colors for bubbles available in the chart. I cant find any option to select individual bubbles and format the color options.
    Any guidance or suggestions solving this would be much appreciated.
    Thanks,
    Vinay

    Thanks JB for your reply, I see in format chart data there is are two sections:
    1. Positional
    2. Conditional
    In Positional - I have the type and color changes for the bubbles but if I change any color in that all the bubbles are simultaneously getting the same color code.
    Not sure if there is any other setting. Please share me your thoughts on this.
    Thanks again

  • How to change the color of bar in bar chart

    Hi I'm
    using Crystal Reports 2005 with Visual Studio 2005. How do i change the color of the bar in a bar chart, i don't see any options, someone telling in the forum that i can simply right click on the bar and choose color, but i don't get that option. all i can select is the entire chart object.
    any help is greatly appreciated.
    Thanks
    yesvee

    You have to make sure that you select the correct part of the bar.
    For Example:   When you click on the outside of the chart, the entire chart will be selected. Clicking somewhere inside the chart will also highlight the entire chart, but to highlight a specific bar or line you have to click until only that part is highlighted.
    Once you have the bar or series highlighted, right-click on the highlighted section and then select Chart Options, or "Format Series Riser" and you should be able to change the colour of the bar/line.

Maybe you are looking for

  • How do I add a new page to my website?

    So I've created my home page, and now I want to make a page that it will link to. I can't seem to find info on exactly how to do this. I've created the new page; do I now set site preferences for it? Do I define it as a "New Site?" If so, what do I p

  • Error while defining :- createStatement(ResultSet.TYPE_SCROLL_SENSITIVE)

    What I am trying to do is, get the current row and compare with the previous from the resultset. To achieve it I am using the previous(), absolute() and next() methods from ResultSet. Now to be able to use these methods I believe I need to define con

  • Podcasts won't auto delete

    Have all my subscribed podcasts set to "keep all unplayed episodes" Once I have finished listening to an episode, it doesn't automatically delete, even when the next episode is downloaded I am getting a backlog of episodes all stored on my iPhone, wi

  • Nightguy2000

    I need to transfer hi8 Sony tapes to elements 11. Do I need extra. Hardware

  • TS3694 how to update apple iphone 4.4.3 to latest 6.1.2

    Current itunes software version is 11.0.2. Windows on laptop does updates regularly. However, whenever i connect iphone 4 to itunes and try to update IOS 4.4.3 to the latest, it prompts error message i.e.missing files etc. Pls help