2017-06-29 3 views
0

私は時間に応じて平均を示すグラフを作成しています。私はx軸が時間であり、y軸が平均であるXYdataset(TimeSeries)を構築しました。私はこのクエリから平均値を取得する:私は、グラフ上でマウスオーバー、私が見ることができるときにCNT変数を維持したいXYdataset第3の値を持つJfreechartラベルのプロット

TimeSeries beacons_local = new TimeSeries("beacons-localizations"); 
String sql= "select hour, avg(localizations) as avg, count(distinct tag) as 
cnt from hourly_tag_summaries where hour >= ? and tag in ("+ids+") group by 
hour;"; 

    ResultSet rs1 = my_db.selectQuery(sql, Main.NOW - Main.DAYS); 


    while (rs1.next()) { 
     int avg = rs1.getInt("avg"); 
     long hour = rs1.getLong("hour"); 
     int cnt= rs1.getInt("cnt"); 
     beacons_local.add(new Millisecond(new Date(hour)),avg); 

    } 

select hour, avg(localizations) as avg, count(distinct tag) as cnt from hourly_tag_summaries where hour >= ? and tag in ("+ids+") group by hour; 

これは私が私のデータセットを作成する方法であります各プロットの数。これはどうすればいいですか?

答えて

関連する問題