BIRT: Highlighting the Series Label of the max Value in a bar-Chart

Hello everyone,
I'm working on a report using BIRT All-in-one-version. Is there any way using scripting to highlight the max value of the Series Label of the bar?

Please Take a look at this example in order to understand what i want.

Would be grateful if i could get some Help

Khaled

Comments

  • Here is sample code to dynamically alter the label:

    function beforeDrawDataPointLabel( dph, label, icsc )
    {
      if(dph.getOrthogonalValue() > 50) {  // if data point value > 50
        label.getCaption().setColor(ColorDefinitionImpl.ORANGE());
      }
    
      if(dph.getBaseValue().equals("Australia")) {  // if data point label = Australia
        label.getCaption().setColor(ColorDefinitionImpl.RED());
        //label.getCaption().getColor().set(255,0,0);  // alternative method
      }
    }
    

    I don't have an example of how to modify the label associated with the max value. I don't know if it is possible to get the max value and change the label in the beforeDrawDataPointLabel() function above. The code runs for each data point, however, you don't know the max value while iterating through the points. The max can only be determined once all points have been processed at which point you might have looped past the label that needs to be modified. It seems like you either need to save the label associated with the highest data point value and modify it after the last point is processed (if possible), or get the max value prior to iterating through the points (if possible).

    Hopefully this helps get you started.

    Jeff F.
    Customer Support Engineer I
    OpenText
Sign In or Register to comment.