How to set background of graph marker line text programmaly?

I use this function to set graph marker line:

function beforeGeneration(chart, icsc)
{
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);

var chart = icsc.getChartInstance();
var yAxis = chart.getAxes().get(0).getAssociatedAxes().get(0);
var ok_value = 40;

ok_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(ok_value));
ok_ml.getLabel().getCaption().setValue("Test value " + ok_value);
ok_ml.getLabel().getCaption().getFont().setSize(10);
ok_ml.getLabel().getCaption().getFont().setBold(true);
ok_ml.getLabel().getCaption().getFont().setRotation(90);
//ok_ml.getLabel().getCaption().getFont().setBackground(0,255,0);
ok_ml.getLineAttributes().getColor().set(255,0,0);
ok_ml.getLineAttributes().setThickness(3);
}

How to set marker line text background color?
"ok_ml.getLabel().getCaption().getFont().setBackground(0,255,0);" return this error:
"Cannot find function setBackground in object [email protected].."
Thanks

Comments

  • I don't know if this is a textbook solution, but I will count it as an achievement unlocked. I copied your code into the chart script in the attached report and added the code at the bottom to change the fill color. Please test the code before using it in production.

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