當前位置: 首頁>>代碼示例>>Java>>正文


Java TimeSeriesCollection.setXPosition方法代碼示例

本文整理匯總了Java中org.jfree.data.time.TimeSeriesCollection.setXPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java TimeSeriesCollection.setXPosition方法的具體用法?Java TimeSeriesCollection.setXPosition怎麽用?Java TimeSeriesCollection.setXPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.data.time.TimeSeriesCollection的用法示例。


在下文中一共展示了TimeSeriesCollection.setXPosition方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDatasetNumberRequestsUntampered

import org.jfree.data.time.TimeSeriesCollection; //導入方法依賴的package包/類
private IntervalXYDataset createDatasetNumberRequestsUntampered()
{

    Date currentDate;
    long currentMsTs;
    final TimeSeries series = new TimeSeries( "Sent Untampered Requests per Second" );
    if ( model.getMapLogEntryIntervalUntampered() != null )
    {
        for ( Map.Entry<Integer, LogEntryInterval> log : model.getMapLogEntryIntervalUntampered().entrySet() )
        {
            // Create TS from model.startTime and log.getIntervalNumber();
            currentMsTs = model.getTsAttackStart() + log.getValue().getIntervalNumber();
            currentDate = new Date( currentMsTs );
            series.add( new Second( currentDate ), ( log.getValue().getNumberRequests() ) );
        }
    }

    final TimeSeriesCollection dataset = new TimeSeriesCollection( series );
    dataset.setXPosition( TimePeriodAnchor.MIDDLE );

    return dataset;
}
 
開發者ID:RUB-NDS,項目名稱:WS-Attacker,代碼行數:23,代碼來源:ChartObject.java

示例2: createDatasetNumberRequestsTampered

import org.jfree.data.time.TimeSeriesCollection; //導入方法依賴的package包/類
private IntervalXYDataset createDatasetNumberRequestsTampered()
{

    Date currentDate;
    long currentMsTs;
    final TimeSeries series = new TimeSeries( "Sent Tampered Requests per Second" );
    if ( model.getMapLogEntryIntervalTampered() != null )
    {
        for ( Map.Entry<Integer, LogEntryInterval> log : model.getMapLogEntryIntervalTampered().entrySet() )
        {
            // Create TS from model.startTime and log.getIntervalNumber();
            currentMsTs = model.getTsAttackStart() + log.getValue().getIntervalNumber();
            currentDate = new Date( currentMsTs );
            series.add( new Second( currentDate ), ( log.getValue().getNumberRequests() ) );
        }
    }

    final TimeSeriesCollection dataset = new TimeSeriesCollection( series );
    dataset.setXPosition( TimePeriodAnchor.MIDDLE );

    return dataset;
}
 
開發者ID:RUB-NDS,項目名稱:WS-Attacker,代碼行數:23,代碼來源:ChartObject.java

示例3: testGetSurroundingItems

import org.jfree.data.time.TimeSeriesCollection; //導入方法依賴的package包/類
/**
 * Test the getSurroundingItems() method to ensure it is returning the values we expect.
 */
public void testGetSurroundingItems() {
    
    final TimeSeries series = new TimeSeries("Series 1", Day.class);
    final TimeSeriesCollection collection = new TimeSeriesCollection(series);
    collection.setXPosition(TimePeriodAnchor.MIDDLE);
    
    // for a series with no data, we expect {-1, -1}...
    int[] result = collection.getSurroundingItems(0, 1000L);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == -1);
    
    // now test with a single value in the series...
    final Day today = new Day();
    final long start1 = today.getFirstMillisecond();
    final long middle1 = today.getMiddleMillisecond();
    final long end1 = today.getLastMillisecond();
    
    series.add(today, 99.9);
    result = collection.getSurroundingItems(0, start1);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, middle1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, end1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == -1);
    
    // now add a second value to the series...
    final Day tomorrow = (Day) today.next();
    final long start2 = tomorrow.getFirstMillisecond();
    final long middle2 = tomorrow.getMiddleMillisecond();
    final long end2 = tomorrow.getLastMillisecond();
    
    series.add(tomorrow, 199.9);
    result = collection.getSurroundingItems(0, start2);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);
    
    result = collection.getSurroundingItems(0, middle2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == 1);
    
    result = collection.getSurroundingItems(0, end2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == -1);
    
    // now add a third value to the series...
    final Day yesterday = (Day) today.previous();
    final long start3 = yesterday.getFirstMillisecond();
    final long middle3 = yesterday.getMiddleMillisecond();
    final long end3 = yesterday.getLastMillisecond();
    
    series.add(yesterday, 1.23);
    result = collection.getSurroundingItems(0, start3);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, middle3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, end3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:73,代碼來源:TimeSeriesCollectionTests.java

示例4: testGetSurroundingItems

import org.jfree.data.time.TimeSeriesCollection; //導入方法依賴的package包/類
/**
 * Test the getSurroundingItems() method to ensure it is returning the 
 * values we expect.
 */
public void testGetSurroundingItems() {
    
    TimeSeries series = new TimeSeries("Series 1", Day.class);
    TimeSeriesCollection collection = new TimeSeriesCollection(series);
    collection.setXPosition(TimePeriodAnchor.MIDDLE);
    
    // for a series with no data, we expect {-1, -1}...
    int[] result = collection.getSurroundingItems(0, 1000L);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == -1);
    
    // now test with a single value in the series...
    Day today = new Day();
    long start1 = today.getFirstMillisecond();
    long middle1 = today.getMiddleMillisecond();
    long end1 = today.getLastMillisecond();
    
    series.add(today, 99.9);
    result = collection.getSurroundingItems(0, start1);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, middle1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, end1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == -1);
    
    // now add a second value to the series...
    Day tomorrow = (Day) today.next();
    long start2 = tomorrow.getFirstMillisecond();
    long middle2 = tomorrow.getMiddleMillisecond();
    long end2 = tomorrow.getLastMillisecond();
    
    series.add(tomorrow, 199.9);
    result = collection.getSurroundingItems(0, start2);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);
    
    result = collection.getSurroundingItems(0, middle2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == 1);
    
    result = collection.getSurroundingItems(0, end2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == -1);
    
    // now add a third value to the series...
    Day yesterday = (Day) today.previous();
    long start3 = yesterday.getFirstMillisecond();
    long middle3 = yesterday.getMiddleMillisecond();
    long end3 = yesterday.getLastMillisecond();
    
    series.add(yesterday, 1.23);
    result = collection.getSurroundingItems(0, start3);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, middle3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);
    
    result = collection.getSurroundingItems(0, end3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:74,代碼來源:TimeSeriesCollectionTests.java

示例5: createDatasetResponseTime

import org.jfree.data.time.TimeSeriesCollection; //導入方法依賴的package包/類
private synchronized XYDataset createDatasetResponseTime( String type )
{

    Map<Integer, LogEntryInterval> currentMap = null;
    String name = null;
    if ( type.equals( "tampered" ) )
    {
        currentMap = model.getMapLogEntryIntervalTampered();
        name = "Mean Response Time Tampered Requests"; // Roundtrip Time
    }
    else if ( type.equals( "untampered" ) )
    {
        currentMap = model.getMapLogEntryIntervalUntampered();
        name = "Mean Response Time Untampered Requests"; // Roundtrip Time
    }
    else if ( type.equals( "testprobe" ) )
    {
        currentMap = model.getMapLogEntryIntervalTestProbe();
        name = "Mean Response Time Simulated 3rd Party Requests"; // Roundtrip
                                                                  // Time
    }
    else
    {
    }

    Date currentDate;
    long currentMsTs;
    final TimeSeries series = new TimeSeries( name );
    if ( currentMap != null )
    {
        for ( Map.Entry<Integer, LogEntryInterval> log : currentMap.entrySet() )
        {
            // Create TS from model.startTime and log.getIntervalNumber();
            currentMsTs = model.getTsAttackStart() + log.getValue().getIntervalNumber();
            currentDate = new Date( currentMsTs );
            // System.out.println(name+" Sekunde"+log.getValue().getIntervalNumber()+" TS: "+currentMsTs+" time "+log.getValue().getMeanResponseTime());
            series.add( new Second( currentDate ), ( log.getValue().getMeanResponseTime() ) );
        }
    }

    final TimeSeriesCollection dataset = new TimeSeriesCollection( series );
    dataset.setXPosition( TimePeriodAnchor.MIDDLE );

    return dataset;
}
 
開發者ID:RUB-NDS,項目名稱:WS-Attacker,代碼行數:46,代碼來源:ChartObject.java

示例6: testGetSurroundingItems

import org.jfree.data.time.TimeSeriesCollection; //導入方法依賴的package包/類
/**
 * Test the getSurroundingItems() method to ensure it is returning the
 * values we expect.
 */
public void testGetSurroundingItems() {

    TimeSeries series = new TimeSeries("Series 1");
    TimeSeriesCollection collection = new TimeSeriesCollection(series);
    collection.setXPosition(TimePeriodAnchor.MIDDLE);

    // for a series with no data, we expect {-1, -1}...
    int[] result = collection.getSurroundingItems(0, 1000L);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == -1);

    // now test with a single value in the series...
    Day today = new Day();
    long start1 = today.getFirstMillisecond();
    long middle1 = today.getMiddleMillisecond();
    long end1 = today.getLastMillisecond();

    series.add(today, 99.9);
    result = collection.getSurroundingItems(0, start1);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end1);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == -1);

    // now add a second value to the series...
    Day tomorrow = (Day) today.next();
    long start2 = tomorrow.getFirstMillisecond();
    long middle2 = tomorrow.getMiddleMillisecond();
    long end2 = tomorrow.getLastMillisecond();

    series.add(tomorrow, 199.9);
    result = collection.getSurroundingItems(0, start2);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, middle2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == 1);

    result = collection.getSurroundingItems(0, end2);
    assertTrue(result[0] == 1);
    assertTrue(result[1] == -1);

    // now add a third value to the series...
    Day yesterday = (Day) today.previous();
    long start3 = yesterday.getFirstMillisecond();
    long middle3 = yesterday.getMiddleMillisecond();
    long end3 = yesterday.getLastMillisecond();

    series.add(yesterday, 1.23);
    result = collection.getSurroundingItems(0, start3);
    assertTrue(result[0] == -1);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, middle3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 0);

    result = collection.getSurroundingItems(0, end3);
    assertTrue(result[0] == 0);
    assertTrue(result[1] == 1);

}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:74,代碼來源:TimeSeriesCollectionTests.java


注:本文中的org.jfree.data.time.TimeSeriesCollection.setXPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。