Hi all,
how can series, categories and the data be derived from a JDBCCategoryDataset?
Thank You
Tom
Data
Re: Data
Hi Tom,
I'm not sure I completely understand your question. If you want to know how to access the values, then the JDBCCategoryDataset class implements the CategoryDataset interface, so you can use all the methods in that interface:
public int getSeriesCount();
public String getSeriesName(int series);
public List getCategories();
public Number getValue(int series, Object category);
etc...
If you are looking for an example of how to use that class, there is one included with the JFreeChart Developer Guide.
Regards,
DG
I'm not sure I completely understand your question. If you want to know how to access the values, then the JDBCCategoryDataset class implements the CategoryDataset interface, so you can use all the methods in that interface:
public int getSeriesCount();
public String getSeriesName(int series);
public List getCategories();
public Number getValue(int series, Object category);
etc...
If you are looking for an example of how to use that class, there is one included with the JFreeChart Developer Guide.
Regards,
DG
Re: Data
Hi Dave,
Thanks for your Mail
I did it like this:
public static void writeThePieDataOutput ( JspWriter out, PieDataset dataset, Collection t)
{
try
{
out.print("<CENTER>");
out.print("<TABLE border='0' width='100%' cellpadding=0 cellspacing=0>");
out.print("<!-- heading row -->");
out.print(displayTitles(t));
String strZwischensp;
String strZwischenspcat;
int rowCount = 0;
List categories = dataset.getCategories();
Iterator iter = categories.listIterator();
while (iter.hasNext())
{
out.write("<TR height='17' style='height:12.75pt'>");
strZwischenspcat = " ";
strZwischensp = " ";
strZwischenspcat = (String)iter.next();
strZwischensp = dataset.getValue(strZwischenspcat).toString();
if ( rowCount%2 == 1 )
{
out.write("<TD class='xl31'>" + strZwischenspcat + "</TD>");
out.write("<TD class='xl30'>" + strZwischensp + "</TD>");
}
else
{
out.write("<TD class='xl27'>" + strZwischenspcat + "</TD>");
out.write("<TD class='xl28'>" + strZwischensp + "</TD>");
}
out.print("</TR>");
++rowCount;
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try { out.print("</TABLE>");} catch (Exception e) {}
try { out.print("</CENTER>");} catch (Exception e) {}
}
}
Regards,
Tom
Thanks for your Mail
I did it like this:
public static void writeThePieDataOutput ( JspWriter out, PieDataset dataset, Collection t)
{
try
{
out.print("<CENTER>");
out.print("<TABLE border='0' width='100%' cellpadding=0 cellspacing=0>");
out.print("<!-- heading row -->");
out.print(displayTitles(t));
String strZwischensp;
String strZwischenspcat;
int rowCount = 0;
List categories = dataset.getCategories();
Iterator iter = categories.listIterator();
while (iter.hasNext())
{
out.write("<TR height='17' style='height:12.75pt'>");
strZwischenspcat = " ";
strZwischensp = " ";
strZwischenspcat = (String)iter.next();
strZwischensp = dataset.getValue(strZwischenspcat).toString();
if ( rowCount%2 == 1 )
{
out.write("<TD class='xl31'>" + strZwischenspcat + "</TD>");
out.write("<TD class='xl30'>" + strZwischensp + "</TD>");
}
else
{
out.write("<TD class='xl27'>" + strZwischenspcat + "</TD>");
out.write("<TD class='xl28'>" + strZwischensp + "</TD>");
}
out.print("</TR>");
++rowCount;
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try { out.print("</TABLE>");} catch (Exception e) {}
try { out.print("</CENTER>");} catch (Exception e) {}
}
}
Regards,
Tom