我从另一种方法获得XYZ点,我想将它们添加到
private static XYZDataset createDataset()
我得到的错误是
incompatible types: float cannot be converted to XYZDataItem
如何解决错误?
这是我的代码:
private static XYZDataset createDataset() {
// current directory to read all the .txt files
File currentDir = new File("C:\\Users\\user\\Desktop\\folder");
String Sresult[];
Sresult = displayContents(currentDir);
String var = Sresult[0];
float result[];
result = readfile(var); //readfile to get the XYZ and I
float xx = 0; float yy = 0; float zz = 0; float ii=0;
for (int i = 0; i < var.length(); i++){
//System.out.println(result[0]);
xx = result[0];
yy = result[1];
zz = result[2];
ii = result[3];
}
XYZSeries s1 = new XYZSeries("S1");
for (int i = 0; i < 10000; i++) {
s1.add(xx); //here is where the error occur.
}
XYZSeriesCollection dataset = new XYZSeriesCollection();
dataset.add(s1);
return dataset;
}