JavaPlot 时间戳不起作用
JavaPlot timestamps not working
我有一个类似
的文件
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 的 window 没有出现,但是如果我直接在 gnuplot 中使用相同的数据和选项尝试这个文件,它会显示 xAxis 上的时间;如果在 JavaPlot 中我删除了最后的设置(xdata、timefmt、格式),它可以工作,但它只显示数字
我也尝试用程序中的数据创建手动数据集,但结果相同。
我还实现了新的数据集,日期为字符串,但似乎 xdata,time 选项不起作用
由于ParametersHolder 继承了HashMap,它生成的临时脚本文件中的数据以奇怪的顺序排列,'-' 后应该有"using" 关键字
例如:
我写了 LinkedParams extends GNUPlotParameters class with inner LinkedMap 和 overrided methods to use inner structure;
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 对象,你可以设置 'using' 选项:
DataSetPlot dataSet = new DataSetPlot( values );
dataSet.set( "using", "1:2" );
这将使用绘图命令的 'using' 选项,例如:
plot '-' using 1:2 title 'Success' with lines linetype rgb 'green'
x轴使用时间时必须有'using'选项,否则会出现这个错误:
Need full using spec for x time data
我有一个类似
的文件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 的 window 没有出现,但是如果我直接在 gnuplot 中使用相同的数据和选项尝试这个文件,它会显示 xAxis 上的时间;如果在 JavaPlot 中我删除了最后的设置(xdata、timefmt、格式),它可以工作,但它只显示数字
我也尝试用程序中的数据创建手动数据集,但结果相同。
我还实现了新的数据集,日期为字符串,但似乎 xdata,time 选项不起作用
由于ParametersHolder 继承了HashMap,它生成的临时脚本文件中的数据以奇怪的顺序排列,'-' 后应该有"using" 关键字 例如: 我写了 LinkedParams extends GNUPlotParameters class with inner LinkedMap 和 overrided methods to use inner structure;
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 对象,你可以设置 'using' 选项:
DataSetPlot dataSet = new DataSetPlot( values );
dataSet.set( "using", "1:2" );
这将使用绘图命令的 'using' 选项,例如:
plot '-' using 1:2 title 'Success' with lines linetype rgb 'green'
x轴使用时间时必须有'using'选项,否则会出现这个错误:
Need full using spec for x time data