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

將 JFreeChart TimeSeries 限制為營業時間

Limit JFreeChart TimeSeries to Business Hours(將 JFreeChart TimeSeries 限制為營業時間)
本文介紹了將 JFreeChart TimeSeries 限制為營業時間的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

使用包含 24 小時數據的數據集呈現幾天的圖表,但它僅在 M-F、早上 7 點到下午 5 點有用.如果我使用下面的代碼設置時間序列,我會得到一個包含每周 7 天、所有 24 小時的圖表.有道理,但不適用于我的用例.

Rendering a chart over several days, with a dataset that has 24 hour data, but it's only useful during M-F, 7AM to 5PM. If I setup a time series with the code below, I get a chart that contains all 24 hours, 7 days a week. Makes sense, but not for my use case.

有沒有辦法定義時間序列顯示的間隔?或者我是否需要使用不同的圖表類型并嘗試將我的數據適合定期周期?我希望不是后者,雖然我收到的數據通常以 30 秒為間隔,但很容易出現差距.

Is there a way to define what interval the time series displays? Or do I need to use a different chart type and attempt to fit my data into regular periods? I hope not the latter, while the data I receive is usually in 30 second intervals, there can easily be gaps.

幾乎不可能發布帶有圖表的工作 UI 的 SSCE,動態地從服務器請求數據,但下面是一些亮點,以了解我正在使用的圖表類型.

It's pretty impossible to post an SSCE of a working UI with a chart dynamically asking for data from a server, but some highlights are below to get an idea of the chart types I'm using.

某些 plot.add、CombinedDomainXY、index 0 代碼可能看起來很奇怪.我有三個共享時間值的子圖,我在這里將其縮減為一個以保持簡短.我認為有一種方法可以為一個圖做我需要的事情,它適用于具有多個子圖的圖表.

Some of the plot.add, CombinedDomainXY, index 0 code may seem strange. I have three subplots with the shared time values, I've pared it down to one here to keep it short. I assume there is a way to do what I need for one plot it would work for a chart with multiple subplots.

public ChartPanel extends JPanel
{
    private final MyDataset _myDataset = new MyDataset();
    private final XYPlot _myPlot = new XYPlot();
    _chartPanel = new ChartPanel( createChart() );
    private JFreeChart createChart()
    {
            CombinedDomainXYPlot plot = new CombinedDomainXYPlot(
                    timeAxis );
            plot.setGap( 10.0 );
            plot.setDomainPannable( true );

            plot.setDataset( index, dataset );
            NumberAxis axis = new NumberAxis();

            axis.setAutoRangeIncludesZero( false );
            plot.setRangeAxis( 0, axis );
            plot.setRangeAxisLocation( 0, axisLocation );
            plot.setRenderer( 0, new StandardXYItemRenderer() );
            plot.mapDatasetToRangeAxis( 0, index );

            // add the subplots...
            plot.add( _myPlot, 1 );
    }
}
public class MyDataset implements XYDataset
{
    @Override
    public double getYValue( int series, int item )
    {
        return getMyData(item);
    }
    @Override
    public double getXValue( int series, int item )
    {
        return _bars.get( item ).DateTime.toInstant().toEpochMilli();
    }
    //other basic overloaded methods left out for brevity
}

推薦答案

您也許可以使用 DateAxis 與自定義 時間線.SegmentedTimeline,檢查here,是一個具體的實現;雖然 已棄用,但它可以作為指南.基于這個 示例,您的概念 newWorkdayTimeline() 可能如下所示:

You may be able to use a DateAxis with a custom Timeline. SegmentedTimeline, examined here, is a concrete implementation; although deprecated, it may serve as a guide. Based on this example, your notional newWorkdayTimeline() might look something like this:

public static SegmentedTimeline newWorkdayTimeline() {
    SegmentedTimeline timeline = new SegmentedTimeline(
        SegmentedTimeline.HOUR_SEGMENT_SIZE, 10, 14);
    timeline.setStartTime(SegmentedTimeline.firstMondayAfter1900()
        + 7 * timeline.getSegmentSize());
    timeline.setBaseTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
    return timeline;
}

此示例說明了一種減輕您遇到的任何渲染偽影的方法.

This example illustrates one way to mitigate any rendering artifacts you encounter.

這篇關于將 JFreeChart TimeSeries 限制為營業時間的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 示例中缺少)
主站蜘蛛池模板: 天天综合网7799精品 | 久久国产精品一区二区三区 | 国产亚洲精品美女久久久久久久久久 | 国产精品久久久久久52avav | 91免费电影 | 久久免费看 | 日韩毛片免费看 | 欧美一区二区三区免费在线观看 | 日韩在线免费电影 | 国产精品久久久久久久久久不蜜臀 | 天天操 天天操 | 中文字幕高清av | 免费国产一区 | 在线视频a| 久久91视频| 久久综合99 | www久久久| 久久久国产精品视频 | 欧美 日本 国产 | 免费在线观看一区二区三区 | 久久99精品久久久久久国产越南 | 视频一区二区中文字幕 | 日韩在线欧美 | 日韩精品一区二区三区在线观看 | 国产精品视频网站 | 亚洲精品久久久一区二区三区 | 色婷婷av一区二区三区软件 | 欧美黑人国产人伦爽爽爽 | 成人免费大片黄在线播放 | 精品国产一区二区三区av片 | 国产精品视频久久久久久 | 男人的天堂在线视频 | 亚洲毛片| 国产精品3区 | 国产欧美精品在线观看 | 伊人网在线看 | 性大毛片视频 | 久久专区| 91免费版在线观看 | 午夜精品久久久久久久久久久久久 | 免费在线观看一区二区三区 |