Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Changing a line style/width/color dynamically?
Changing a line style/width/color dynamically? [message #698891] Wed, 20 July 2011 08:35 Go to next message
Mike Wulkan is currently offline Mike Wulkan
Messages: 141
Registered: July 2009
Senior Member
Is there a way to change the line attributes of a line graph on the fly? For example, I have a series that shows value X, but I'd like the series line to be solid when another data attribute Y is true and dashed when Y is false. Is this possible?
Re: Changing a line style/width/color dynamically? [message #698961 is a reply to message #698891] Wed, 20 July 2011 10:49 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike Wulkan
Messages: 141
Registered: July 2009
Senior Member
From a priority point of view I have used a different technique to visualize what I am after, however I'd still like to know the answer to this for future reference.

What I did was add a new series that plots the same data as the original and conditioned the value based on the data attribute Y (see above) else null. This way I can set the line attributes any way I want and just make sure that the Z order of this series is on top of the original series.

This works for me as I actually wanted the legend to show information for the "annotated" part of the plot so a new series actually works better than just changing the line attributes on the fly.
(no subject) [message #698991 is a reply to message #698961] Wed, 20 July 2011 11:45 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You should be able to do this with a beforeGeneration script like::

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

var newxAxis = chart.getBaseAxes()[0];
var newyAxis = chart.getOrthogonalAxes( newxAxis, true)[0]
var newseriesDef = newyAxis.getSeriesDefinitions().get(0)
var runSeries = newseriesDef.getRunTimeSeries().get(0);
runSeries.getLineAttributes().setStyle(LineStyle.DASHED_LITERAL);

}

LineStyle has
DASH_DOTTED_LITERAL
DASHED_LITERAL
DOTTED_LITERAL
SOLID_LITERAL

Jason

On 7/20/2011 10:49 AM, Mike Wulkan wrote:
> From a priority point of view I have used a different technique to
> visualize what I am after, however I'd still like to know the answer to
> this for future reference.
>
> What I did was add a new series that plots the same data as the original
> and conditioned the value based on the data attribute Y (see above) else
> null. This way I can set the line attributes any way I want and just
> make sure that the Z order of this series is on top of the original series.
>
> This works for me as I actually wanted the legend to show information
> for the "annotated" part of the plot so a new series actually works
> better than just changing the line attributes on the fly.
Re: (no subject) [message #699004 is a reply to message #698991] Wed, 20 July 2011 12:13 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike Wulkan
Messages: 141
Registered: July 2009
Senior Member
I think you misunderstood my requirement. I am looking for a way to change the line attributes for just portions of the line, not the entire line. For example, make a portion of the line if the value is above 100 red and blue otherwise, etc...
Re: (no subject) [message #699015 is a reply to message #699004] Wed, 20 July 2011 12:16 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I do not think this is currently possible with the current line series.
It would be a good idea to log a bug for this if you do not mind.

Jason

On 7/20/2011 12:13 PM, Mike Wulkan wrote:
> I think you misunderstood my requirement. I am looking for a way to
> change the line attributes for just portions of the line, not the entire
> line. For example, make a portion of the line if the value is above 100
> red and blue otherwise, etc...
Previous Topic:Birt connexion to Hive
Next Topic:how to calculate uptime as java expression
Goto Forum:
  


Current Time: Tue Jul 22 21:55:19 EDT 2014

Powered by FUDForum. Page generated in 0.02600 seconds