ColumnChart color depending on the value of the column

Hi,
I'va been trying for 2 days to change the colors of columnseries in a columnchart and it is actually awful. I've tried to do it inline without custom itemRenderer but I quickly understood that it is impossible. I then looked on the internet, and found that it was maybe possible by creating a custom itemRenderer class, extending ProgrammticSkin and implementing IdataRenderer.
I have tried but am not at all able to retrieve the value of the column inside the itemRenderer. Even more, the so called _chartItem is always null and never never carries anything from anyparent.
I'm a bit exhausted of trying and getting this value, so if you have some idea, i'll be very grateful.
Here is the code for my itemRenderer class:
import flash.display.Graphics;
    import flash.geom.Rectangle;
    import mx.charts.ChartItem;
    import mx.charts.chartClasses.GraphicsUtilities;
    import mx.charts.series.items.ColumnSeriesItem;
    import mx.controls.Alert;
    import mx.core.IDataRenderer;
    import mx.graphics.IFill;
    import mx.graphics.IStroke;
    import mx.skins.ProgrammaticSkin;
    public class ColorRenderer extends ProgrammaticSkin implements IDataRenderer
        public function ColorRenderer():void
            super();
        private var _chartItem:ChartItem;
        public function get data():Object
            return _chartItem;
        public function set data(value:Object):void {
            _chartItem = value as ColumnSeriesItem;
            invalidateDisplayList();
        private static const fills:Array = [0xFF0000,0x00FF00,0x0000FF,
            0x00FFFF,0xFF00FF,0xFFFF00,
            0xAAFFAA,0xFFAAAA,0xAAAAFF];
        override protected function
            updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            var g:Graphics = graphics;
            g.clear(); 
            g.beginFill(fills[(_chartItem == null)? 0:_chartItem.element.y]);
            Alert.show(_chartItem.index.toString());
            g.drawRect(0, 0, unscaledWidth, unscaledHeight);
            g.endFill();
    } // Close class.
} // Close package.
Thank you

It worked, thanks
Date: Wed, 21 Apr 2010 09:03:14 -0600
From: [email protected]
To: [email protected]
Subject: Flex ColumnChart color depending on the value of the column
Have you looked at doing per-item fills?
http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf69084-7c3f.ht ml
This feature lets you define a function that customizes chart item fills based on their values.
>

Similar Messages

  • Heading and color scheme of the columns for the detail report

    Is it possible to have a heading and color scheme of the columns for the reports displayed on drill down of a query in WAD?

    Try the stylesheet in the properties of web template.

  • Image colors depend on the computer that publishes my Domain file?!?!

    Here's a weird one... First, the setup.
    My site is published from two different computers both using iWeb '08, using the same Domain.sites2 file that's passed from computer to computer using my idisk. The Domain file is always copied down to a local computer before new changes are made and published. Recently, I've noticed, that publishing from one of the computers (but not the other) results in overly intense colors, especially in the red tones. This I tested by accessing my site with Safari and opening one of the overly intense images. Leaving the browser page open, I then republish my site using a different computer, accessed the page again... and the images is normal! On screen you see the previously published image beside the newly published image, and the color deffirecenes are obvious, even though the same file was being published without modification.
    Can anyone think of why this is happening? I can't imagine iWeb treating the publishing of images differently from computer to computer, unless there is some other weird computer-dependent processing going on.
    Thanks for any ideas!
    John
    aking the same Domain file, and without replacing the

    Unfortunately, the issue is not with which pages get published (that works fine), but with the amount of color in the images that are published.
    Imagine this...
    You have a JPEG photo of a sunset that is stored on an idisk. The photo is downloaded to Computer A, placed onto a page in iWeb, and published to the web. Here, the photo appears on the web site as one would expect (blue sky, subtle oranges and reds, some purples). The Domain.sites2 file is then copied onto the idisk.
    Now, on Computer B the Domain.sites2 is downloaded from the idisk, and opened in iWeb. A change is made to the page (not a change to the photo) and the site is republished. When visiting the site a sunset still appears, but the blue sky is now really, really blue, and the subtle oranges and reds are now intensely red. It would appear that a significant amount of contrast and saturation has been added to the photo.
    Something about publishing is different on Computer B.
    Here's some additional interesting data.
    The original photo file is 1024 x 656 pixels and 391K in size.
    The photo is sized in iWeb to be 605 x 388.
    After the initial publishing from Computer A (the one in which the image looks fine), and upon investigating the Site folder created on MobileMe, the photo file has been resized to be 605 x 388 and now occupies 108K. After publishing from Computer B (where the image is contrasty and oversaturated), the dimensions of the file are still 605 x 388, but the size of the file when published from Computer B is 111K, so the file as published from Computer B is clearly different.
    I'm guessing that this has something to do with how iWeb treats rescaling an image on one computer (or, maybe, version of Mac OS X or Quicktime?!?!) to another.
    Does this sound familiar to anyone?
    Thanks!
    John

  • AnyGantt: How to set different bar color depending on data value.

    Need to have different colors for bars in a gantt resource chart.
    The color depends on certain data value not included in the visible part of the chart, so it must be provided 'extra' for the chart in some way without beeing visible.
    Have studied some examples but cannot figure out the mechanism for this, and the procedure to implement it.
    Any ideas?
    Apex 4.2.2
    Regards
    Per.

    Hi Per,
    You mention "+Among the samples I can see that it has been implemented, but not how.+" - in the Information region below the chart that Tony referred to (https://apex.oracle.com/pls/apex/f?p=36648:50) that I've stated the following:
    "The elements of the Timeline region have been customized via the Chart Attributes page, using the following settings: *Custom Colors*: #000000,#00FF00,#0033FF"
    So that's how I applied custom colours to that particular chart. However, that declarative option won't meet your requirements, where the colours you wish to apply are dependent on data not included in the chart series query. You mention "+Now, if I add another column to the statement I get a yellow error message telling that the statement is not valid.+". It is not possible to simply add an additional column to the chart series query. Each supported chart type expects the associated chart series query to use specific syntax - see About Creating SQL Queries for Charts in Chapter 10 of the APEX User's Guide, http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/bldapp_chrt.htm#BCEIJJID.
    So to answer your question "+How to add the new value if not providing another column to the graph?+", if you wish to customise your chart to that extent, then you will need to use custom XML. Depending on what exactly you're trying to achieve, this may require the generation of custom data for your chart. If you edit your chart, and take a look at the Custom XML region, you'll notice a substitution string, #DATA#, towards the end of the XML. When a chart is rendered, we use the chart series query to generate the necessary XML to represent the data on the chart, replacing the string #DATA# with the actual XML. The format of the data XML generated for gantt charts uses a bar style called "defaultStyle", and this handles the default appearance of the bars in the timeline region e.g.
    <period resource_id="1" start="2009.03.21 00.00.00" end="2009.09.21 00.00.00" style="defaultStyle"/>You'll see that the 'style="defaultStyle" ' attribute of the data corresponds to a segment of XML outlining what that style is e.g.
    <period_style name="defaultStyle">Now take a look at the Bar Style in Resource Project example in the AnyChart online documentation http://www.anychart.com/products/anygantt/docs/users-guide/bar-style.html#bar-style-application-resource-project. In that particular example, a number of different bar styles are used i.e.
    <periods>
      <period resource_id="server_1" start="2008.07.07" end="2008.07.8" style="Working" />
      <period resource_id="server_1" start="2008.07.8" end="2008.07.12" style="Maintance" />If you need to add a different bar style to particular rows of data on your chart, then you'll need to add new bar style XML for each colour you wish to use in the Custom XML on the Chart Attributes page, and then you'll also need to generate the data XML yourself, applying the necessary bar style to the relevant row of data. I've got an example of how custom data can be generated for a Resource Gantt here e.g. https://apex.oracle.com/pls/apex/f?p=36648:73 but keep in mind that particular example doesn't demo adding different styles to the data...but it can certainly give you an idea of what's entailed in the generation of custom data for your chart.
    I hope this helps.
    Regards,
    Hilary

  • Change Column Header / Column Background color based on a value in a specific row in the same column

    SSRS 2012
    Dataset (40 columns) including the first 3 rows for Report layout configuration (eg: the <second> row specifies the column background color).
    Starting from the 4th row, the dataset contains data to be displayed.
    I would like to change the background color of the ColumnHeader/Column based on the value in the same column in the <second> row.
    How can I accomplish the this requirement? (this must be applied for all the columns)
    Thanks

    Hi Fasttrck2,
    Per my understanding that you want to specify the background color of all the columns/column header based on the value in one special column of the special row, right?
    I have tested on my local environment and you can add expression to condition show the background color in the columns properties or the column header properties.
    Details information below for your reference:
    Specify the background color in the Column header: you can select the entire column header row and in the properties add expression in the Background color :
    If you want to specify the background color for the entire column, you can select the entire column and add the expression, repeat to add background color for other columns.
    If you want to specify the background color based on the value in the specific columns and row, you can create an hidden parameter to get the list of values from the  specific column, specify the Available values and default values by select "Get
    values from a query", finally using the expression as below to get the specific value you want:
    Expression(Backgroud Color):
    =IIF(Parameters!Para.Value(1)="1221","red","yellow")
    If your problem still exists, please try to provide some smaple data of the report and also the snapshot of the report structure to help us more effective to provide an solution.
    Any problem, please feel free to ask.
    Regards
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • Changing colors depending on output variable

    Hi there,
    I am pretty new to LabVIEW, using it for my dissertation at university. I looked for similar questions on this and other forums but can't seem to find an answer.
    What I'm trying to do is change the color of a graphic depending on the value of another variable. I'm calculating the temperatures inside a gas turbine, and would like to represent the temperature changes graphically for better understanding. So I have output values for different temperatures, which change with mass flow rate of fuel into the engine. How can I make a graphic change it's colors depending on the value of temperature?
    Thanks a lot,
    Fabian

    Do you mean something like this ? Run the VI and change the value of Thermometer.
    Attachments:
    Change BG of chart.vi ‏16 KB

  • How to fix the column header width in BEx or WAD

    hi there!
    how to fix the column header width in BEx or WAD. because, depends on the column data, the column size varies. i want to fix the size so that i can maintain the consistency through out the report.
    thanks!
    Vam.

    Dear Vam,
    you can easily do that with css, search the source code of the executed web template for the td tag which is around your coloumn header, remember the style sheet class name it is ´displayed as class= in the td tag.
    Now you can add this code the beginning of your web template:
    </style>
    This will only work in Web.
    Regards
    Marcus

  • Coloring JTable rows depending on the actual and previous value

    I need to change the background of the entire row of a JTable, but with the condintion of checking the value (Integer) in the column 0 of each row.
    I the actual value is equal to previous value I keep the same color (any color) if it is different I must change the color (to any other color).
    Any ideas how I could do that? I suppose I cant use CellRenderer because the Table is already full, so I was thinking about making a looping thru the table and chaning the background colors, but I have no idea how to do that.
    So far I have this code:
    int totalRows = modProdutos.getRowCount();
    int totalCols = modProdutos.getColumnCount();
    System.out.println("Total rows: " + totalRows);
    TableColumnModel tcm = tbProdutos.getColumnModel();
    DefaultTableModel modelo = (DefaultTableModel) tbProdutos.getModel();
    if (totalRows > 0) {
        int numeroOSAntes = (Integer) tbProdutos.getValueAt(0, 0);
        for (int i = 0; i < totalRows; i++) {
            int numeroOS = (Integer) tbProdutos.getValueAt(i, 0);
            if (numeroOS == numeroOSAntes) {
                // Paint the background with the same color (any color)
                System.out.println("Same Color: " + numeroOSAntes + " - " + numeroOS);
            } else {
                // Paint the background with a different color (any other color)
                System.out.println("Different color: " + numeroOSAntes + " - " + numeroOS);
            // keep the previous control number
            numeroOSAntes = numeroOS;
    }

            jTable1 = new JTable(0,4){
                @Override
                public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
                    Component c = super.prepareRenderer(renderer, row, column);
                    c.setBackground(Color.YELLOW);
                    boolean yellow = true;
                    for (int i = 1; i <= row; i++) {
                        if(!getValueAt(i,0).toString().equals(getValueAt(i-1,0).toString())){
                            yellow = !yellow;
                    if(!yellow){
                        c.setBackground(Color.WHITE);
                    return c;
            model = (DefaultTableModel)jTable1.getModel();
            model.addTableModelListener(new TableModelListener() {
                public void tableChanged(TableModelEvent e) {
                    jTable1.repaint();
            });

  • Need to change color of one column's value depending on the other column

    Hi,
    i have a search form which displays two column values
    First column value's colour should be based on second column's value
    For example, if second column has values 'Active', 'Inactive' and 'Pending'
    If 'Active' , the first column value's color sholud be 'red'
    If 'inacitve, another color ....
    Thanks in advance,

    Hi!
    What we did was we added a column on the VO that returns kind of a css part (for example if a column value is 'Active' the value of this column should be "background-color:rgb(255,0,0);")
    Than you use something like this on your column:
    inlineStyle="#{row.StatusStyle}"where StatusStyle is the name of the column with "background-color:rgb(255,0,0);" value.
    The problem here can be that the background color doesn't cover the whole column but only the text in it (so if it is null, the color is default).
    If you want the whole column to be of this color you use something like this:
                                        <af:column ...>
                                          <afh:tableLayout ...>
                                            <afh:rowLayout ...>
                                              <afh:cellFormat inlineStyle="#{row.StatusStyle}" ...>
                                                <af:outputText ...>
                                                </af:outputText>
                                              </afh:cellFormat>
                                            </afh:rowLayout>
                                          </afh:tableLayout>
                                        </af:column>Basically you put another table layout inside a column instead just a outputText (or whatever control you use)
    Hope this is understandable and it helps :)
    It works for us.
    BB

  • Shading part of a JTable Cell dependent upon the value of the cell

    Hi
    Was hoping some one woudl be able to provide some help with this. I'm trying to create a renderer that will "shade" part of a JTable cell's background depending upon the value in the cell as a percentage (E.g. if the cell contains 0.25 then a quarter of the cell background will be shaded)
    What I've got so far is a renderer which will draw a rectangle whose width is the relevant percentage of the cell's width. (i.e. the width of the column) based on something similar I found in the forum but the part I'm struggling with is getting it to draw this rectangle in any cell other than the first cell. I've tried using .getCellRect(...) to get the x and y position of the cell to draw the rectangle but I still can't make it work.
    The code for my renderer as it stands is:
    import java.awt.Component;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.table.TableCellRenderer;
    public class PercentageRepresentationRenderer extends JLabel implements TableCellRenderer{
         double percentageValue;
         double rectWidth;
         double rectHeight;
         JTable table;
         int row;
         int column;
         int x;
         int y;
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
              if (value instanceof Number)
                   this.table = table;
                   this.row = row;
                   this.column = column;
                   Number numValue = (Number)value;
                   percentageValue = numValue.doubleValue();
                   rectHeight = table.getRowHeight(row);
                   rectWidth = percentageValue * table.getColumnModel().getColumn(column).getWidth();
              return this;
         public void paintComponent(Graphics g) {
            x = table.getCellRect(row, column, false).x;
            y = table.getCellRect(row, column, false).y;
              setOpaque(false);
            Graphics2D g2d = (Graphics2D)g;
            g2d.fillRect(x,y, new Double(rectWidth).intValue(), new Double(rectHeight).intValue());
            super.paintComponent(g);
    }and the following code produces a runnable example:
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    public class PercentageTestTable extends JFrame {
         public PercentageTestTable()
              Object[] columnNames = new Object[]{"A","B"};
              Object[][] tableData = new Object[][]{{0.25,0.5},{0.75,1.0}};
              DefaultTableModel testModel = new DefaultTableModel(tableData,columnNames);
              JTable test = new JTable(testModel);
              test.setDefaultRenderer(Object.class, new PercentageRepresentationRenderer());
              JScrollPane scroll = new JScrollPane();
              scroll.getViewport().add(test);
              add(scroll);
         public static void main(String[] args)
              PercentageTestTable testTable = new PercentageTestTable();
              testTable.pack();
              testTable.setVisible(true);
              testTable.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }If anyone could help or point me in the right direction, I'd appreciate it.
    Ruanae

    This is an example I published some while ago -
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class Fred120 extends JPanel
        static final Object[][] tableData =
            {1, new Double(10.0)},
            {2, new Double(20.0)},
            {3, new Double(50.0)},
            {4, new Double(10.0)},
            {5, new Double(95.0)},
            {6, new Double(60.0)},
        static final Object[] headers =
            "One",
            "Two",
        public Fred120() throws Exception
            super(new BorderLayout());
            final DefaultTableModel model = new DefaultTableModel(tableData, headers);
            final JTable table = new JTable(model);
            table.getColumnModel().getColumn(1).setCellRenderer( new LocalCellRenderer(120.0));
            add(table);
            add(table.getTableHeader(), BorderLayout.NORTH);
        public class LocalCellRenderer extends DefaultTableCellRenderer
            private double v = 0.0;
            private double maxV;
            private final JPanel renderer = new JPanel(new GridLayout(1,0))
                public void paintComponent(Graphics g)
                    super.paintComponent(g);
                    g.setColor(Color.CYAN);
                    int w = (int)(getWidth() * v / maxV + 0.5);
                    int h = getHeight();
                    g.fillRect(0, 0, w, h);
                    g.drawRect(0, 0, w, h);
            private LocalCellRenderer(double maxV)
                this.maxV = maxV;
                renderer.add(this);
                renderer.setOpaque(true);
                renderer.setBackground(Color.YELLOW);
                renderer.setBorder(null);
                setOpaque(false);
                setHorizontalAlignment(JLabel.CENTER);
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
                final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
                if (value instanceof Double)
                    v = ((Double)value).doubleValue();
                return renderer;
        public static void main(String[] args) throws Exception
            final JFrame frame = new JFrame("Fred120");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(new Fred120());
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    }

  • Change the colour of a cell text depending on the value Web Reports (NW04s)

    Hi all,
    does anyone know how to change the color of the text of a cell depending on its value on Web Reports? For example red text for values smaller than zero and blue for values bigger than zero?
    I know you can create exceptions, but that changes the background color of the cell and not the text color
    I have tried modifying the theme but the property "negative text" doesn't related to cell values.
    Thanks
    C
    PD: Point will be awarded!
    Message was edited by:
            Carles Prunera

    This function changes all numeric fields to blue if no css style is set.
    [code]
    function turnblue(){
      var cells =document.getElementsByTagName('a');
      for ( i=0; i<cells.length; i++){
        if ( cells<i>.className == '' ){
          var changeColor = checknumber(cells<i>.innerHTML);
    // additional condition on value
          if (changeColor) {
            cells<i>.style.color = '#0000FF'
    function checknumber(cNumber){
      var x= cNumber
      var anum=/(\d+$)|(\d\.\d$)/
      if (anum.test(x))
        testresult=true
      else{
        testresult=false
    return (testresult)
    [/code]
    hope it helps

  • ADF Table cell color based on the value in that field

    Dear All,
    I want to create a table for our new application which contains a table used to represent the data in a chart format or matrix format,
    and each cell of the table should be filled with a colour out of three colors, based on the value belongs to which range eg:(1-8 ->green, 9-20 - yellow etc),
    I dont know how to implement this. Please help...
    Ranjith

    Check this out.
    How to highlight ADF table row based on column value?
    -Arun

  • Calculate a measure depending on the value of other dimension

    HI,
    I would like to know if it’s possible to calculate a measure depending on the value of other dimension. I want to calculate this measure in the Business Model and Mapping. I show you how I am trying to do it:
    http://img338.imageshack.us/img338/2496/imagenjp.png
    But when I try to make an aggregation of this measure then I get an error of consistency.
    I think a good example to make you to understand me is the function TODATE which calculates an aggregation depending on one time dimension. I would like to do the same thing but regarding to the value of other dimension.
    Can someone help me? Thanks a lot.

    Hi,
    Do you have that dimension table as a "Sources" in that BMM folder? if yes, then you can use the "Data Type" option and click on "show all logical sources". Then click on your fact table using which you want to do the calculation and then use this formula. After that you can have the aggregation.
    It should work.
    Thanks,
    Rohit

  • How do i prepopulate a listbox depending on the value of a textfield

    I am getting an custmerid value in a textfield depending on the selected customer name after getting this value i need to pass this customer id to a rowset query for populating the customer address listbox with that customers addresses only (he has multiple address ) iam doing so by doing setobject(1,custid) on that particular rowset.
    How ever on deploying iam getting invalid parameter binding exception.
    what do i do ? how do i get that customers addresses ?when does the creator look for the parameter bindings in the rowset.or trather when does it execute that particular rowset.?

    Hi,
    Check the following tutorial:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/listbox_components.html

  • How to restrict / filter the results of a VO depending on dynamic value ?

    Hello,
    Under JDeveloper 11.1.1.3.0 I have some tables / views containing data related to several users.
    I have the VO in the Model project to define the queries.
    The problem for me is to filter "automatically" the results of these queries depending on the user logged in the application. I have its Userid which is a part of the primary keys of the tables I would like to query.
    I made a Search Form based on criteria but if I add the Userid in the criteria it adds the field on the search form, and I don't want this since I know the value and don't want it to be changed.
    Where can I do such this stuff ?

    After dropping the VO as search form, open the panelFormLayout in the structur window, select the fields you don't want the user to change and either hide them (visible="false") or delete the whole element.
    Timo

Maybe you are looking for

  • Upgrade Vista to Windows 7

    Ok I have a T61 which is still works reasonably well for my purposes  (core duo T7500 @ 2.2 GHz + 8g Ram).  Windows Vista has become corrupted in some way which interferes with printing and now McAfee anti virus is giving me problems as well.  So I f

  • IDOC reading in ABAP

    Hey, found a lot of threads to this issue. Just want to know if I understood correctly. I created an own IDOC and the communication from XI to SAP system works. Until now I've got a dummy implementation as process code, which I want to implement corr

  • Create a PO with the following conditions

    Hi guys,     I have given this scenario. can anyone pls guide me so that i coud move one with the following scenario. can any pls tell me how to proceed with the given queries?? Release procedure with classification              a.Create new PO docum

  • AR Aging Document Date

    Is there any way to run an AR Aging by Due date, but actually have the document date field included in the results?

  • I need a driver for Officejet 150 Mobile , I am using an iPad air

    I am using an iPad Air with operating iOS 7 This question was solved. View Solution.