|
Re: NaN problem when creating a chart [message #480128 is a reply to message #480046] |
Thu, 13 August 2009 23:47 |
|
Maarten,
What version of BIRT and can you post the code?
Jason
Maarten Laurs wrote:
> When I insert Double.NaN as a value in a Y axis array (Double[ ]) I get
> an empty value at that point, which is great because that's what I was
> looking for.
>
> But I would like to have that empty value at the lowest value of the Y
> axis, and if I insert NaN as the first value in the array the chart
> engine returns a garbled graph. :(
> Bugzilla comes back with "Zarro Boogs found", so I am assuming this
> hasn't been noticed before. Am I right? Just want to make sure I'm not
> addressing any known issues here.
|
|
|
|
Re: NaN problem when creating a chart [message #480263 is a reply to message #480218] |
Fri, 14 August 2009 15:14 |
|
Maarten,
This should work. Please log a bug for this. I tried in 2.5 as well
with the same issue. As a work around can you do this
> NumberDataSet yValuesPrimary = NumberDataSetImpl
> .create(new Double[] { Double.NaN, 1d, 3d });
to
NumberDataSet yValuesPrimary = NumberDataSetImpl
.create(new Double[] { null, 1d, 3d });
Jason
Maarten Laurs wrote:
> Thanks for taking a look at this, Jason.
>
> I am using BIRT 2.3.2
>
> The example I wrote will show you the issue, but the code isn't self
> contained. You will need to take the output (an BIRT ChartWithAxis) and
> put it on a canvas. I assume this is not a problem, but let me know if i
> am mistaking about this.
> If you replace Double.NaN in line 17 for some double value the output
> will show a nice graph.
>
>
> public class ChartWithAxes {
> public final Chart createCurveFittingLine() {
>
> ChartWithAxes cwaLine = ChartWithAxesImpl.create();
> cwaLine.setType("Mixed Chart");
> cwaLine.setSubType("Overlay");
> cwaLine.getLegend().setVisible(false);
>
> Axis xAxisPrimary = cwaLine.getPrimaryBaseAxes()[0];
> xAxisPrimary.setType(AxisType.LINEAR_LITERAL);
>
> Axis yAxisPrimary = cwaLine.getPrimaryOrthogonalAxis(xAxisPrimary);
> yAxisPrimary.setType(AxisType.LINEAR_LITERAL);
>
> NumberDataSet xValuesPrimary = NumberDataSetImpl.create(new
> Double[] { 1d, 2d, 3d });
> NumberDataSet yValuesPrimary = NumberDataSetImpl
> .create(new Double[] { Double.NaN, 1d, 3d });
>
> Series seCategory = SeriesImpl.create();
> LineSeries ls = (LineSeries) LineSeriesImpl.create();
>
> seCategory.setDataSet(xValuesPrimary);
> ls.setDataSet(yValuesPrimary);
>
> SeriesDefinition sdXp = SeriesDefinitionImpl.create();
> SeriesDefinition sdYp = SeriesDefinitionImpl.create();
>
> xAxisPrimary.getSeriesDefinitions().add(sdXp);
> yAxisPrimary.getSeriesDefinitions().add(sdYp);
>
> sdXp.getSeries().add(seCategory);
> sdYp.getSeries().add(ls);
>
> ls.setCurve(true);
>
> return cwaLine;
> }
> }
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04078 seconds