Ok, I might understand what you are doing now. If you are populating one cell with the value "#FF0000" and hoping for it to turn red I am afraid that won't work. You will have to work with CSS and the style attribute.
Use something like style="background-color:#{!your_color_value}" in the tag displaying the cell that should have that background color.
Don't think it's possible to do that. There is no report object that I know of that can be used in Apex. Reports are just querying data so the best thing to do here is probably to create a SOQL query and put the resultset directly in to a map.
When using a map to get data from it, you will get the value using a key.
So if you call the map like this hm.get('P1') you will get the value of the key 'P1', i.e. '##0000A0'.
I am not sure I understand how your table is generated. You say it displays '##0000A0' in the table. How is this table generated? What do you want it to display?
Ok, I might understand what you are doing now. If you are populating one cell with the value "#FF0000" and hoping for it to turn red I am afraid that won't work. You will have to work with CSS and the style attribute.
Use something like style="background-color:#{!your_color_value}" in the tag displaying the cell that should have that background color.
Ok, I might understand what you are doing now. If you are populating one cell with the value "#FF0000" and hoping for it to turn red I am afraid that won't work. You will have to work with CSS and the style attribute.
Use something like style="background-color:#{!your_color_value}" in the tag displaying the cell that should have that background color.
style might not be accurate in this case. Check the Visualforce Component Reference to manipulate the right component. http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_compref.htm
All Answers
Hi,
You mean that you want to create a map in Apex?
See this page for explanation and examples:
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_collections_maps.htm
// Niklas
yes, I want to create using apex.
Well, then the provided link should give you a start. But for example you can do like this:
Map<String,String> theMap = new Map<String,String>();
theMap.put('Green','##00FF00'>;
theMap.put('Red','#FF0000'>
and so on. Then you can get either keys or values from the map.See all map methods here:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_map.htm
// Niklas
I want to create the heat map based on report data.
Sorry, you have to be more specific than that on what you want to accomplish.
// Niklas
I am creating a report and based on that I want create a heatmap. eg. like this,
Don't think it's possible to do that. There is no report object that I know of that can be used in Apex. Reports are just querying data so the best thing to do here is probably to create a SOQL query and put the resultset directly in to a map.
Ok. But I am not getting the color in table.It displays the value that I pass.I have used this code.
Map<String, String> hm = new Map<String, String>();
hm.put('P1','##0000A0');
It shows me ##0000A0 in table.
When using a map to get data from it, you will get the value using a key.
So if you call the map like this hm.get('P1') you will get the value of the key 'P1', i.e. '##0000A0'.
I am not sure I understand how your table is generated. You say it displays '##0000A0' in the table. How is this table generated? What do you want it to display?
I am creating table in pageblocktable and getting the value from the controoler in which I have created the MAP. My table should be:
P1
This cell shpuld be filled with RED color but it shows me the color value.
P2
This cell shpuld be filled with BLUE color
Ok, I might understand what you are doing now. If you are populating one cell with the value "#FF0000" and hoping for it to turn red I am afraid that won't work. You will have to work with CSS and the style attribute.
Use something like style="background-color:#{!your_color_value}" in the tag displaying the cell that should have that background color.
style might not be accurate in this case. Check the Visualforce Component Reference to manipulate the right component. http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_compref.htm
Ok, thanks its working.
Can you please help to get me started with heat map implementation.
Thanks.