Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Legend entries for curve fitting lines
Legend entries for curve fitting lines [message #846807] Mon, 16 April 2012 19:24 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
I have line charts for which I would like to NOT show the line and NOT show the markers but I do want to show the curve fitting line for the series.
This works fine except that since the lines and markers are turned off, the legend entry for the series has no icon to match with the curve fitting line. (I set the color of the curve fitting line to the same color as the series color). So basically the legend is useless.
Is there a way to force the legend to show the icon for the series even if the series visibility is turned off? If not can I put my own image in there?

Thanks
Mike
Re: Legend entries for curve fitting lines [message #847020 is a reply to message #846807] Mon, 16 April 2012 23:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike,

What I would do is set the marker visible and then just set its size to
0. Change the marker to be a rectangle. Take a look at the attached.

Jason

On 4/16/2012 3:24 PM, Mike Wulkan wrote:
> I have line charts for which I would like to NOT show the line and NOT
> show the markers but I do want to show the curve fitting line for the
> series.
> This works fine except that since the lines and markers are turned off,
> the legend entry for the series has no icon to match with the curve
> fitting line. (I set the color of the curve fitting line to the same
> color as the series color). So basically the legend is useless.
> Is there a way to force the legend to show the icon for the series even
> if the series visibility is turned off? If not can I put my own image in
> there?
>
> Thanks
> Mike
Re: Legend entries for curve fitting lines [message #847559 is a reply to message #847020] Tue, 17 April 2012 12:24 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Excellent, that was the easy workaround I was looking for. One more thing (of course Wink )...
Can you think of a way to automatically tighten up the Y axis scale? Since the actual data may have outliers, this forces the scale on the Y axis to accommodate these values even though the only thing visible (the curve fitting line) never comes close to these limit values. Thus you get a lot of empty space above and below the curve fitting line because of the invisible outlying markers and the line itself is compressed. into a narrow region. In other words I would like the Y axis scale to be computed based on the min/max of the curve fitting line rather than the actual data.
Re: Legend entries for curve fitting lines [message #847567 is a reply to message #847559] Tue, 17 April 2012 12:30 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Also is there a way to automatically use the series color for the curve fitting line? I am currently just hard-coding the color but I'd rather set it based on the palette color assigned to the series.
Re: Legend entries for curve fitting lines [message #847692 is a reply to message #847567] Tue, 17 April 2012 15:03 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike

The color is easy. Just add this script:

var currentColor;
function beforeDrawFittingCurve( curveFitting, icsc )
{

curveFitting.getLineAttributes().setColor(currentColor);
}


function beforeDrawDataPoint( dph, fill, icsc )
{
currentColor = fill;
}

the Curve gets drawn after drawing the series but before the next
series, so just store the color in the beforeDrawDataPoint and use it in
the beforeDrawFittingCurve event. You can set the scale manually with a
script like

function beforeGeneration(chart, icsc)
{
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
xAxis = chart.getBaseAxes()[0];

yAxis = chart.getOrthogonalAxes( xAxis, true)[0]
yscale = yAxis.getScale();
yscale.setStep (10);
yscale.setMin( NumberDataElementImpl.create(1.5) )
yscale.setMax( NumberDataElementImpl.create(170) )
yAxis.setScale(yscale);

}


Jason

On 4/17/2012 8:30 AM, Mike Wulkan wrote:
> Also is there a way to automatically use the series color for the curve
> fitting line? I am currently just hard-coding the color but I'd rather
> set it based on the palette color assigned to the series.
Re: Legend entries for curve fitting lines [message #847745 is a reply to message #847692] Tue, 17 April 2012 15:59 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Thanks again Jason. The color solution is perfect.

As for the scale, yes I realized that you can programatically set the min/max however what I need is a way to determine what those values are based on the curve fitting line; ie., the min and max values of the computed curve fitting line rather than actual data points. If there is an easy answer to this then I would like to know, however please consider this a lower priority for yourself as I am starting to lean towards not hiding the raw data after all for this specific application. But I would still like to know how this can be done for future reference.

Thanks
Mike
Re: Legend entries for curve fitting lines [message #847790 is a reply to message #847745] Tue, 17 April 2012 16:50 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike,

The curve renderer is actually a spline function on the data points, so
I do not know an easy way to do what you want. You can get access to
all the data points in the after dataset filled script and possibly come
up with your own scale at that point.

Jason

On 4/17/2012 11:59 AM, Mike Wulkan wrote:
> Thanks again Jason. The color solution is perfect.
> As for the scale, yes I realized that you can programatically set the
> min/max however what I need is a way to determine what those values are
> based on the curve fitting line; ie., the min and max values of the
> computed curve fitting line rather than actual data points. If there is
> an easy answer to this then I would like to know, however please
> consider this a lower priority for yourself as I am starting to lean
> towards not hiding the raw data after all for this specific application.
> But I would still like to know how this can be done for future reference.
>
> Thanks
> Mike
Previous Topic:Birt Bar Interval Chart
Next Topic:How to create report which will show only information from one record? (javascript needed)
Goto Forum:
  


Current Time: Fri Mar 29 07:40:43 GMT 2024

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

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

Back to the top