久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何僅顯示“過去 24 小時"?從“過去 72 小時

How to display only quot;last 24 hoursquot; from a quot;last 72 hoursquot; JFreeChart TimeSeries(如何僅顯示“過去 24 小時?從“過去 72 小時開始JFreeChart 時間序列)
本文介紹了如何僅顯示“過去 24 小時"?從“過去 72 小時"開始JFreeChart 時間序列的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我編寫了這兩行代碼來使用 XYDataset 創建圖表:

final XYDataset dataset = new TimeSeriesCollection(myInfo.getSeries());JFreeChart timechart = ChartFactory.createTimeSeriesChart(myInfo.getName()+ " CPU (last 72h)", "", "CPU %", dataset, false, false, false);

這些線條創建了這個漂亮的過去 72 小時"圖表:

這就是我添加信息來構建這個圖表的方式(這段代碼可以運行多次):

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd H:mm:ss");日期日期 = simpleDateFormat.parse(dateAsStringToParse);秒秒 = 新秒(日期);myInfo.getSeries().addOrUpdate(second, maxValue);//maxValue 是一個整數

我想要一個(看似)簡單的更改——將其刪減"到最后 24 小時.我的意思是在圖表中只看到最近的 24 小時,就像這樣(圖中是我使用相同技術制作的不同圖表,但信息僅存在于最近 24 小時):

我查看了 API 并找不到合適的答案,因為我相信這應該有一些聰明而簡單的解決方案.

解決方案

而不是丟棄舊數據,建議

順便說一句,請注意,自從提交補丁后,一些類已經移動:

import org.jfree.ui.ApplicationFrame;導入 org.jfree.ui.RefineryUtilities;

<塊引用>

我不能使用 setMaximumItemAge() 嗎?

不是孤立的;addOrUpdate()et al.,在通知偵聽器之前調用 removeAgedItems(false).

<塊引用>

我正在使用 Second.

Second 數據的三天,例如,將暗示 setMaximumItemAge(3 * 24 * 60 * 60).

<塊引用>

我可能無法使用滑動窗口,因為我將圖表保存為 JPEG.

您可以將所需的 firstItemIndex 作為參數傳遞給 SlidingXYDataset 構造函數;如果需要,您可以稍后通過 setFirstItemIndex() 更新索引.

I wrote these 2 lines of code to create a chart using an XYDataset:

final XYDataset dataset = new TimeSeriesCollection(myInfo.getSeries());
JFreeChart timechart = ChartFactory.createTimeSeriesChart(myInfo.getName()
    + " CPU (last 72h)", "", "CPU %", dataset, false, false, false);

These lines created this nice "last 72h" chart:

This is how I added the information to build this chart (this piece of code can run multiple times):

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd H:mm:ss");
Date date = simpleDateFormat.parse(dateAsStringToParse);
Second second = new Second(date);
myInfo.getSeries().addOrUpdate(second, maxValue); // maxValue is an Integer

I want a (seemingly) simple alteration—to "cut" this only to the last 24 hours. I mean to see only the most "recent" 24 hours in the graph, like so (in the picture is a different chart I made using the same technique, but the information exists only for the last 24hrs):

I have looked through the API and could not find an appropriate answer, as I believe this should have some clever but simple solution.

解決方案

Instead of discarding old data, as suggested here, it looks like you want to display a contiguous subset of the data, as if looking through a window. While SlidingCategoryDataset provides this feature for a CategoryDataset, there is no built-in solution for an XYDataset. SlidingXYDataset, seen here, maybe an alternative. In the variation of SliderDemo2 illustrated below, I've added three days of data to a single series with a one day window. I've retained the slider for easy review of earlier values.

static final int COUNT = 3 * 24 * 60;
public static final int WINDOW = 24 * 60;
public static final int FIRST = 2 * 24 * 60;
…
this.slider.setValue(FIRST);

As an aside, note that some classes have moved since the patch was submitted:

import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;

Can't I just use setMaximumItemAge()?

Not in isolation; addOrUpdate(), et al., calls removeAgedItems(false) before notifying listeners.

I am using Second.

Threes days of Second data, e.g., would imply setMaximumItemAge(3 * 24 * 60 * 60).

A sliding window might not be available to me since I am saving the chart as a JPEG.

You can pass the desired firstItemIndex as a parameter to the SlidingXYDataset constructor; you can update the index later via setFirstItemIndex() if needed.

這篇關于如何僅顯示“過去 24 小時"?從“過去 72 小時"開始JFreeChart 時間序列的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Upload progress listener not fired (Google drive API)(上傳進度偵聽器未觸發(Google 驅動器 API))
Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅動api服務賬戶查看上傳文件到谷歌驅動使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務帳號返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
主站蜘蛛池模板: 欧美精品网站 | 在线观看不卡av | jlzzjlzz国产精品久久 | 美女久久 | 久久精品亚洲欧美日韩精品中文字幕 | 日韩一区精品 | 免费在线一区二区三区 | 性一交一乱一伦视频免费观看 | 天堂视频中文在线 | av在线视 | 亚洲成人免费观看 | 久久国产成人 | 欧美6一10sex性hd | 亚洲视频在线观看一区二区三区 | 日韩在线小视频 | 免费看啪啪网站 | 亚洲v区| 午夜www| 九九热精品视频在线观看 | 国产精品亚洲精品日韩已方 | 精品欧美一区二区久久久伦 | 精品国产免费一区二区三区五区 | 成人精品一区 | 精品一区二区三区四区五区 | 在线观看 亚洲 | 亚洲成人精品一区二区 | 国产精品视频久久 | 国产一区日韩在线 | 欧美在线天堂 | 正在播放国产精品 | 欧美日韩一区二区在线观看 | 免费国产视频在线观看 | 亚洲精品一区二区在线观看 | 9191在线观看| 国产视频二区在线观看 | 在线中文字幕国产 | 男人av在线播放 | 免费在线一区二区 | 国产精品亚洲一区 | 不卡的av电影 | 在线观看亚洲一区二区 |