Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Set label of marker in a chart
Set label of marker in a chart [message #648738] Fri, 14 January 2011 06:00 Go to next message
Klaus Meisl is currently offline Klaus Meisl
Messages: 90
Registered: July 2009
Member
Hi,
I want to change the label of a marker in a chart via script. I use
beforeDrawMarkerLine function (see below). The following (setLabel) does
not work (this error:
Can't find method
org.eclipse.birt.chart.model.component.impl.MarkerLineImpl.s etLabel(string).
at line 19 of chart script:'')

Perhaps anybody can give me a hint. thanks.


function beforeDrawMarkerLine(axis, markerLine, icsc)
{
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
var min_value =
icsc.getExternalContext().getScriptable().getPersistentGloba lVariable( "min_val");
markerLine.setValue(NumberDataElementImpl.create(min_value)) ;

markerLine.setLabel("Value: " + min_value);
}
Re: Set label of marker in a chart [message #648832 is a reply to message #648738] Fri, 14 January 2011 11:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Add
importPackage(Packages.org.eclipse.birt.chart.model.componen t.impl)
right above where you calculate the min_value.

Jason



On 1/14/2011 6:00 AM, Klaus Meisl wrote:
> Hi,
> I want to change the label of a marker in a chart via script. I use
> beforeDrawMarkerLine function (see below). The following (setLabel) does
> not work (this error:
> Can't find method
> org.eclipse.birt.chart.model.component.impl.MarkerLineImpl.s etLabel(string).
> at line 19 of chart script:'')
>
> Perhaps anybody can give me a hint. thanks.
>
>
> function beforeDrawMarkerLine(axis, markerLine, icsc)
> {
> importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
> var min_value =
> icsc.getExternalContext().getScriptable().getPersistentGloba lVariable( "min_val");
> markerLine.setValue(NumberDataElementImpl.create(min_value)) ;
>
> markerLine.setLabel("Value: " + min_value);
> }


Jason Weathersby

BIRT Exchange
Re: Set label of marker in a chart [message #648873 is a reply to message #648832] Fri, 14 January 2011 13:34 Go to previous messageGo to next message
Klaus Meisl is currently offline Klaus Meisl
Messages: 90
Registered: July 2009
Member
Jason,

setting the line works fine, it just does not set the label of the line.
My script now looks like this, but the error remains.

function beforeDrawMarkerLine(axis, markerLine, icsc)
{
importPackage(Packages.org.eclipse.birt.chart.model.data.imp l);
importPackage(Packages.org.eclipse.birt.chart.model.componen t.impl);
var min_value =
icsc.getExternalContext().getScriptable().getPersistentGloba lVariable( "min_val");
markerLine.setValue(NumberDataElementImpl.create(min_value)) ;
// works fine so far

// this does not work
markerLine.setLabel("This is the line");
}


Am 14.01.11 17:27, schrieb Jason Weathersby:
> Add
> importPackage(Packages.org.eclipse.birt.chart.model.componen t.impl)
> right above where you calculate the min_value.
>
> Jason
>
>
>
> On 1/14/2011 6:00 AM, Klaus Meisl wrote:
>> Hi,
>> I want to change the label of a marker in a chart via script. I use
>> beforeDrawMarkerLine function (see below). The following (setLabel) does
>> not work (this error:
>> Can't find method
>> org.eclipse.birt.chart.model.component.impl.MarkerLineImpl.s etLabel(string).
>>
>> at line 19 of chart script:'')
>>
>> Perhaps anybody can give me a hint. thanks.
>>
>>
>> function beforeDrawMarkerLine(axis, markerLine, icsc)
>> {
>> importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
>> var min_value =
>> icsc.getExternalContext().getScriptable().getPersistentGloba lVariable( "min_val");
>>
>> markerLine.setValue(NumberDataElementImpl.create(min_value)) ;
>>
>> markerLine.setLabel("Value: " + min_value);
>> }
>
Re: Set label of marker in a chart [message #649119 is a reply to message #648873] Mon, 17 January 2011 13:32 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Try:

markerLine.getLabel().getCaption().setValue("Test");


On 1/14/2011 1:34 PM, Klaus Meisl wrote:
> Jason,
>
> setting the line works fine, it just does not set the label of the line.
> My script now looks like this, but the error remains.
>
> function beforeDrawMarkerLine(axis, markerLine, icsc)
> {
> importPackage(Packages.org.eclipse.birt.chart.model.data.imp l);
> importPackage(Packages.org.eclipse.birt.chart.model.componen t.impl);
> var min_value =
> icsc.getExternalContext().getScriptable().getPersistentGloba lVariable( "min_val");
> markerLine.setValue(NumberDataElementImpl.create(min_value)) ;
> // works fine so far
>
> // this does not work
> markerLine.setLabel("This is the line");
> }
>
>
> Am 14.01.11 17:27, schrieb Jason Weathersby:
>> Add
>> importPackage(Packages.org.eclipse.birt.chart.model.componen t.impl)
>> right above where you calculate the min_value.
>>
>> Jason
>>
>>
>>
>> On 1/14/2011 6:00 AM, Klaus Meisl wrote:
>>> Hi,
>>> I want to change the label of a marker in a chart via script. I use
>>> beforeDrawMarkerLine function (see below). The following (setLabel) does
>>> not work (this error:
>>> Can't find method
>>> org.eclipse.birt.chart.model.component.impl.MarkerLineImpl.s etLabel(string).
>>>
>>> at line 19 of chart script:'')
>>>
>>> Perhaps anybody can give me a hint. thanks.
>>>
>>>
>>> function beforeDrawMarkerLine(axis, markerLine, icsc)
>>> {
>>> importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
>>> var min_value =
>>> icsc.getExternalContext().getScriptable().getPersistentGloba lVariable( "min_val");
>>>
>>> markerLine.setValue(NumberDataElementImpl.create(min_value)) ;
>>>
>>> markerLine.setLabel("Value: " + min_value);
>>> }
>>
>


Jason Weathersby

BIRT Exchange
Previous Topic:Multi Value Rows
Next Topic:myeclipse reporting issue
Goto Forum:
  


Current Time: Mon Apr 21 03:23:35 EDT 2014

Powered by FUDForum. Page generated in 0.01677 seconds