#8 Model of all 0's will hang render

v0.9
closed
nobody
rendering (6)
5
2003-12-15
2002-07-12
Giao Phan
No

This seems to hang and take up all the CPU on a solaris
jdk 1.4 box.
Pretty much the same as the tutorial except that the
model is all 0's. This is the same on the .93 release
and a CVS release. Though it may seem pointless to
graph all 0 it is actually necessary if you are say
graphing the activity of a webserver that isn't doing
anything. (Actually I think passing in an empty model
will also break, which also should be allowable,
showing a empty graph with just the x labels)

import java.awt.*;
import java.io.*;
import de.progra.charting.*;
import de.progra.charting.model.*;
import de.progra.charting.render.*;

public class GraphTest {

public static void makeFirstChart() {

int[][] model = {{0, 0, 0}}; // Create data
array

String[] columns = {"23:00", "24:00", "01:00"};
// Create x-axis values

String[] rows = {"(none)"}; // Create
data set title

Title title = new Title("A First Test");
// Create diagram title

int width = 640; //
Image size
int height = 480;

// Create data model
ObjectChartDataModel data = new
ObjectChartDataModel(model, columns, rows);

// Create chart with default coordinate system
DefaultChart c = new DefaultChart(data, "",
DefaultChart.LINEAR_X_LINEAR_Y);
c.setTitle(title);

// Add a line chart renderer
c.addChartRenderer(new
LineChartRenderer(c.getCoordSystem(), data,
RowColorModel.getInstance(data)), 1);

// Set the chart size
c.setBounds(new Rectangle(0, 0, width, height));

// Export the chart as a PNG image
try {
ChartEncoder.createEncodedImage(new
FileOutputStream("first.png"), c, "png");
} catch(Exception e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
makeFirstChart();
}
}

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Thanks,

    this bug has been reported a couple of times to me. I will
    fix it in the next few weeks.

    Regards,
    Sebastian

     
  • S. Müller

    S. Müller - 2002-10-01
    • status: open --> closed
     
  • S. Müller

    S. Müller - 2003-12-15
    • status: closed --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks