SourceBean sbRows=SourceBean.fromXMLString(res);
List listAtts=sbRows.getAttributeAsList("ROW");
DefaultXYZDataset dataset = new DefaultXYZDataset();
int rangex = (xMaxValue-xMinValue)/blockWidth;
int rangey = (yMaxValue-yMinValue)/blockHeight;
double[] xvalues = new double[rangey * rangex];
double[] yvalues = new double[rangey * rangex];
double[] zvalues = new double[rangey * rangex];
double[][] data = new double[][] {xvalues, yvalues, zvalues};
int xVal = 0;
int yVal = 0;
int col = 0;
int row = 0;
int cell = 0;
double zVal = 0;
boolean first=true;
for (int r = yMinValue/blockHeight; r < rangey; r++) {
for (int c = xMinValue/blockWidth; c < rangex; c ++) {
cell = c+r+(r*(rangex-1));
data[0][cell] = (new Double(((c+1)*blockWidth)).doubleValue())-(new Double(blockWidth).doubleValue()/2);
data[1][cell] = (new Double(((r+1)*blockHeight)).doubleValue())-(new Double(blockHeight).doubleValue()/2);
data[2][cell] = (new Double(zrangeMax)).doubleValue()*2;
}
}
for (Iterator iterator = listAtts.iterator(); iterator.hasNext();) {
SourceBean category = (SourceBean) iterator.next();
List atts=category.getContainedAttributes();
String nameP="";
String value="";
for (Iterator iterator2 = atts.iterator(); iterator2.hasNext();) {
SourceBeanAttribute object = (SourceBeanAttribute) iterator2.next();
nameP=new String(object.getKey());
value=new String((String)object.getValue());
if(nameP.equalsIgnoreCase("x"))
{
xVal = new Double(value).intValue();
col = (xVal/blockWidth)-1;
}
if(nameP.equalsIgnoreCase("y"))
{
yVal = new Double(value).intValue();
row = (yVal/blockHeight)-1;
}
if(nameP.equalsIgnoreCase("z"))
{
zVal = new Double(value).doubleValue();
}
}
cell=col+row+(row*(rangex-1));
if((rangex*rangey)> cell){
data[0][cell] = xVal-(new Double(blockWidth).doubleValue()/2);
data[1][cell] = yVal-(new Double(blockHeight).doubleValue()/2);
data[2][cell] = zVal;
// setValueInData(data, xMaxValue , yMinValue, xVal, yVal, zVal);
}
}
dataset.addSeries("Series 1", data);
//XYZDataset dataset = createDataset();
DatasetMap datasets=new DatasetMap();
datasets.addDataset("1",dataset);