我有3列数据:(如下所示
答案 0 :(得分:0)
尝试一下:
//order define here
List<Integer> statusOrder= Arrays.asList(1,0,5,2);
//define sort by status
Comparator<User> byStatus = (u1, u2) -> {
return Integer.compare(statusOrder.indexOf(u1.getStatus()), statusOrder.indexOf(u2.getStatus()));
};
//define sort by name
Comparator<User> byName = Comparator.comparing(User::getUsername);
//actualy sort
users.sort(byStatus.thenComparing(byName));
要为问题中提供的样本数据生成文件,请尝试此操作;但是,只有一点,您就不会在折线图上看到任何东西。
library(zoo)
z <- read.zoo("myfile.dat", header = TRUE, index = 1:2, format = "%Y%m%d %H:%M", tz = "")
# classic graphics
plot(z)
# ggplot2 graphics
autoplot(z)