Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Change partially color of scatter chart line
Change partially color of scatter chart line [message #641169] Wed, 24 November 2010 13:21 Go to next message
Helmut Neubauer is currently offline Helmut Neubauer
Messages: 54
Registered: July 2009
Member
Hi,

I've a scatter chart showing the line between the markers and I would
like to change the color if the associated values are greater than a
defined value.

I tried to use beforeDrawDataPoint with fill, but I could only change
the marker color using this way.

Perhaps you can help me?

Thanks,
Helmut
Re: Change partially color of scatter chart line [message #641246 is a reply to message #641169] Wed, 24 November 2010 15:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Helmut,

All line segments in a scatter chart have to have the same color for any
one series. The last place you can change it is in the beforeDrawSeries
script like:

function beforeDrawSeries( series, isr, icsc )
{
if( series.getClass() == ScatterSeriesImpl ){
series.getLineAttributes().getColor().set(0,255,0);
}
}

Jason

On 11/24/2010 8:21 AM, Helmut Neubauer wrote:
> Hi,
>
> I've a scatter chart showing the line between the markers and I would
> like to change the color if the associated values are greater than a
> defined value.
>
> I tried to use beforeDrawDataPoint with fill, but I could only change
> the marker color using this way.
>
> Perhaps you can help me?
>
> Thanks,
> Helmut
Re: Change partially color of scatter chart line [message #641615 is a reply to message #641246] Fri, 26 November 2010 10:33 Go to previous message
No real name is currently offline No real name
Messages: 7
Registered: November 2010
Junior Member
Had the same problem, just use this code snippet on the onRender() Event for the chart. I had to use a dynamic border line and change the color of the bars in a bar chart to change the color (green, yellow, red) based on the borders and a small calculation for the yellow ones if it's between a unvisible border between 75% and the database border (100%)

good luck! Smile
Regards
Nadine

/**
* Called before rendering Series.
*
* @param series
* Series
* @param isr
* ISeriesRenderer
* @param icsc
* IChartScriptContext
*/
var ot;
var ut;
var ot75;
var ut75;

/**
* Called after populating the series dataset.
*
* @param series
* Series
* @param dataSet
* DataSet
* @param icsc
* IChartScriptContext
*/

function afterDataSetFilled( series, dataSet, icsc )
{
if (series.getSeriesIdentifier()=="OT"){
var list = dataSet.getValues();
if (list.length > 0){
ot = list[0];
ot75 = ot * 0.75;
}
} else if (series.getSeriesIdentifier()=="UT"){
var list = dataSet.getValues();
if (list.length > 0){
ut = list[0];
ut75 = ut * 0.75;
}
}
}

/**
* Called after drawing each datapoint graphical representation or marker.
*
* @param dph
* DataPointHints
* @param fill
* Fill
* @param icsc
* IChartScriptContext
*/

function beforeDrawDataPoint( dph, fill, icsc )
{
var xVal = dph.getOrthogonalValue();

if (xVal >= 0){

if (xVal >= ot) {
fill.set(255,0,0);
}
else if ((xVal >= ot75) && (xVal < ot)){
fill.set(255,255,0);
} else if (xVal < ot75){
fill.set(0,255,0);
}
}

else if (xVal < 0){

if (xVal <= ut){
fill.set(255,0,0);
}
else if ((xVal <= ut75) && (xVal > ut)){
fill.set(255,255,0);
}
else if ((xVal > ut75) && (xVal < 0)){
fill.set(0,255,0);
}
}}










Previous Topic:place charts dynamically
Next Topic:Birt only fetches some records (1000)
Goto Forum:
  


Current Time: Sun Oct 26 05:16:13 GMT 2014

Powered by FUDForum. Page generated in 0.01744 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software