How to highlight one bar in Bar Chart [message #528918] |
Thu, 22 April 2010 11:56 |
Amy Messages: 29 Registered: April 2010 |
Junior Member |
|
|
Hi all,
I'm new to use the BIRT Chart. I created a bar chart.
Y - axis is the amount.
X - axis is the levels. ( 50, 60, 70 , 80...)
When user select a preference level, I need to change one bar color to highlight the user selected.
Can I do this is bar chart?
Thanks in advance!
[Updated on: Thu, 22 April 2010 11:57] Report message to a moderator
|
|
|
Re: How to hightlight one bar in Bar Chart [message #528949 is a reply to message #528918] |
Thu, 22 April 2010 13:42 |
|
Amy,
How do they select the level? A report Parameter? Or clicking on the
chart?
Jason
Amy wrote:
> Hi all,
> I'm new to use the BIRT Chart. I created a bar chart.
>
>
> Y - axis is the amount. X - axis is the levels. ( 50, 60, 70 , 80...)
>
> When user select a preference level, I need to change one bar color to
> highlight the user selected.
> Can I do this is bar chart?
>
> Thanks in advance!
>
|
|
|
Re: How to hightlight one bar in Bar Chart [message #529083 is a reply to message #528949] |
Thu, 22 April 2010 20:37 |
Amy Messages: 29 Registered: April 2010 |
Junior Member |
|
|
Jason,
The user select the level done on Java Windon based application GUI part.
I use script to created the datset, outer table has one value tell me which level user selected.
From the inner table, I have all level values display on the chart. I can using data binding to get which level need highlight.
For example: I display data for Level 5, 6,7 and 8 on the chart. I know level 6 need display different color to show user selected.
In this case, how I can make color different on chart?
No color change on click event. The report is PDF.
Thanks!
[Updated on: Fri, 23 April 2010 13:33] Report message to a moderator
|
|
|
Re: How to hightlight one bar in Bar Chart [message #529221 is a reply to message #529083] |
Fri, 23 April 2010 13:55 |
|
Amy,
Take a look at this example.
http://www.birt-exchange.org/devshare/designing-birt-reports /1203-set-the-color-of-one-bar-based-on-parameter/#descripti on
Jason
On 4/22/2010 4:37 PM, Amy wrote:
> Jason,
>
> The user select the level done on Java Windon based allpication GUI part.
>
> I use script to created the datset, outer table has one value tell me
> which level user selected.
>
> From the inner table, I have all level values display on the chart. I
> can using data binding to get which level need highlight.
> For example: I display data for Level 5, 6,7 and 8 on the chart. I know
> level 6 need display different color to show user selected.
> In this case, how I can make color different on chart?
>
> No color change on click event. The report is PDF.
>
> Thanks!
>
>
|
|
|
|
Re: How to hightlight one bar in Bar Chart [message #529337 is a reply to message #529325] |
Fri, 23 April 2010 20:45 |
|
In the outer table you need to put an oncreate script on the data item
that holds the selected value or on a row of that dataset and enter
something like
//on data item
var sv = this.getValue();
//on row - Use this if you are not displaying the value but it is in
//the bindings
var sv = this.getRowData().getColumnValue("NameOfDataBinding");
reportContext.setPersistentGlobalVaraible("selectedbar", sv );
Then in the chart script:
//this returns reportContext
var rc =icsc.getExternalContext().getScriptable();
var sv = rc.getPersistentGlobablVariable("selectedbar");
One other note:
if the selected value is not a string you may have to do something like
var sv = parseInt(rc.getPersistentGlobalVariable("selectedbar"));
Jason
On 4/23/2010 3:48 PM, Amy wrote:
> Jason,
>
> Thank you so much!
>
> I tried this and the bar color chaneged on my chart !
>
> But I still have a question for how I get the userSelected value pass in
> this function.
>
> You use this:
> var hl = icsc.getExternalContext().getScriptable().getParameterValue(
> "HighlightColumn");
> to get the user input.
>
> I hard code the vlalue: var hl = 60; It works for my Level 60.
>
> I don't know how I can set value hl based on the outer table data.
>
> I have the user selected value in outer table.
> For inner table, display chart .
>
> I try this:
>
> var hl = row._outer["CCCovLevel"] ;
> This didn't work.
>
> I try to create a variable when I create the inner table,:
> selectedLevel =0;
> Insert a data filed in inner table, binding the outer table data
> CCCovLevel(60 ).
> Increase the variable value based on the outer table data .
>
> selectedLevel = parseInt(this.getValue());
>
> I can display the value 60 in the inner table footer. But
> hl ==selectedLevel didn't work.
>
> Can you help ?
>
> Thanks!!!
>
|
|
|
|
|
Re: How to highlight one bar in Bar Chart and change that highlighted bar label font [message #544555 is a reply to message #544474] |
Sat, 03 July 2010 17:18 |
|
Emily,
Add a beforeDrawDataPointLabel script like:
function beforeDrawDataPointLabel( dph, label, icsc )
{
var hl =
icsc.getExternalContext().getScriptable().getParameterValue( "HighlightColumn");
if( dph.getBaseDisplayValue() == hl ){
label.setVisible(true);
label.getCaption().getFont().setBold(true);
label.getCaption().getFont().setSize(14);
label.getCaption().getFont().setName("Arial");
}else{
label.setVisible(false);
}
}
This turns off all series labels but the one. If you want them all on
just remove the else.
Jason
On 7/2/2010 3:08 PM, Amy wrote:
> Jason,
>
> I asked you question about how to hightlight one bar in bar chart based
> on users selected in April. Your answer work well.
> Now, I need do more function on top of it. The user want me to change
> the hightlighted bar label .
> Example: If user selected coverage level = 60, ( x = 60, Y =$550) the
> bar is hightlighted. I set the series label on top of the bar, that
> label show Y value -> $550. User want to bold that lable and make the
> font size large.
>
> Can you tell me how I can make this happen?
>
> Thank you so much for your help !
>
>
> Emily
|
|
|
|
Powered by
FUDForum. Page generated in 0.03206 seconds