Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#9 createEncodeImage(UnknownSource) - code included

open
Vivek Verma
None
9
2004-03-04
2004-03-03
chikodi echeta
No

Hi,

I have tried to make charts with JDBCPlotter but when I
run the program it gives the error message:

...ChartEncoder.createEncodeImage(UnknownSource)

caused by java.lang.OutOfMemoryError.

The relevant code is as follows:

{
...........
..............

int y = 0;
while(sqlResult.next())
{
y++;
}

int [][] model = new int[1][y];
double [] columns = new double[y];

Statement stm = conn.createStatement();

ResultSet sqlR = stm.executeQuery("select distinct
col_name from data_table order by col_name");

int x = 0;
for(int i=0; i<1; i++)
{
while(sqlR.next())
{
model[i] = new int .getInt
("amdi_data")];
columns[x] = x++;
}
}

DefaultChartDataModel data = new
DefaultChartDataModel(model, columns, rows);

DefaultChart c = new DefaultChart(data, title,
DefaultChart.LINEAR_X_LINEAR_Y);

c.addChartRenderer(new LineChartRenderer
(c.getCoordSystem(), data), 1);
c.setBounds(new Rectangle(0,0, width, height));

try
{
ChartEncoder.createEncodedImage(new
FileOutputStream(System.getProperty("user.home")
+"/my_array.png"), c, "png");
}
catch(Exception e)
{
e.printStackTrace();
}
}

Please help.

Discussion

  • chikodi echeta
    chikodi echeta
    2004-03-04

    • priority: 5 --> 9
    • assigned_to: nobody --> vverma