main
黄海 8 months ago
parent a298c9dd0a
commit 70bfe97327

@ -47,9 +47,9 @@ public class TestXml {
Document document = reader.read(new File(xmlPath));
Element root = document.getRootElement();// 获取根元素
//行数据库不管是X轴的年份还是Y轴的数值都按行保存到一个二维列表中
List<List<String>> tList = new ArrayList<>();
List<Element> children = root.element("chart").element("plotArea").elements();//工作区
boolean hadReadXList = false;//是不是已经读取过横坐标也就是年份的数据了
for (Element child : children) {
@ -104,10 +104,10 @@ public class TestXml {
}
}
}
//下面要实现行与列的转置
//实现行列转置
// 创建一个一维列表,用于存储转换后的列
List<List<String>> res = new ArrayList<>();
//上面生成的数据格式需要行转列,横坐标是年份,纵坐标是数据
int rowCount = tList.size();// 计算行数和列数
int colCount = tList.getFirst().size();

Loading…
Cancel
Save