JavaPlot时间戳不工作

JavaPlot时间戳不工作,java,javaplot,Java,Javaplot,我有一个像这样的文件 1429520881 15.0 1429520882 3.0 1429520883 340.0 我尝试在JavaPlot中使用它 JavaPlot plot=new JavaPlot(); GenericDataSet dataset=new GenericDataSet(); filling dataset with data ... plot.set("xdata","time"); plot.set("timefmt","'%s'"); plot.set("form

我有一个像这样的文件

1429520881 15.0
1429520882 3.0
1429520883 340.0
我尝试在JavaPlot中使用它

JavaPlot plot=new JavaPlot();
GenericDataSet dataset=new GenericDataSet();
filling dataset with data
...
plot.set("xdata","time");
plot.set("timefmt","'%s'");
plot.set("format x","'%H:%M:%S'");
plot.plot();
结果是gnuplot的窗口没有出现,但如果我用相同的数据和选项直接在gnuplot中尝试这个文件,它会显示我在xAxis上的时间;如果在JavaPlot中我删除了最后的设置(扩展数据、timemt、格式),它可以工作,但只显示数字

我还尝试用程序中的数据手动创建数据集,但结果相同


我还实现了以日期作为字符串的新数据集,但扩展数据、时间选项似乎不起作用

它生成的临时脚本文件中的数据顺序很奇怪,因为ParametersHolder继承了HashMap,并且在“-”之后应该有“using”关键字 例如: 我编写了LinkedParams,用内部LinkedMap扩展了GNUPlotParameters类,并重写了使用内部结构的方法

set ... ...(xrange,yrange etc)
set xdata time
set timefmt '%s'
set format x '%H:%M:%S'
plot '-' using 1:2 title 'ololo' with linesploints lineType 2 lineWidth 3
1429520881 15.0
1429520882 3.0
1429520883 340.0
e
quit
但确实如此

set xdata time
set ... ...(xrange,yrange etc)
set format x '%H:%M:%S'
set timefmt '%s'
plot '-' title 'ololo' with linesploints lineType 2 lineWidth 3
1429520881 15.0
1429520882 3.0
1429520883 340.0
e
quit

这件事花了很长时间才弄明白。我发现,如果您有DataSetPlot对象,可以设置“使用”选项:

DataSetPlot dataSet = new DataSetPlot( values );
dataSet.set( "using", "1:2" );
这将利用绘图命令的“使用”选项,例如:

plot '-' using 1:2 title 'Success' with lines linetype rgb 'green'
在使用x轴的时间时,必须使用“using”(使用)选项,否则将看到此错误:

需要使用x时间数据的完整规范


如果属性在内部存储在一个有序的列表中会怎么样?这能解决这个问题吗?@Panayotis,我相信,这是对的。不幸的是,Gnuplot的设置顺序非常重要。我还编写了一个扩展的GNUPlotParameters,当
entrySet()
put()
remove
被覆盖以使用内部
LinkedHashMap
时,命令的顺序保持不变。不幸的是,
propertieshalder
继承自
HashMap
,这是一个糟糕的设计,这就是我问的原因。如果更改为LinkedHashMap?设计太旧,无法判断:)