当前位置: 首页>>代码示例>>Java>>正文


Java OHLCDataItem类代码示例

本文整理汇总了Java中org.jfree.data.xy.OHLCDataItem的典型用法代码示例。如果您正苦于以下问题:Java OHLCDataItem类的具体用法?Java OHLCDataItem怎么用?Java OHLCDataItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OHLCDataItem类属于org.jfree.data.xy包,在下文中一共展示了OHLCDataItem类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportQuotations

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
@SuppressWarnings("unused") //Test
private void exportQuotations(String filename, ArrayList<OHLCDataItem> data) {

    File export = new File(filename);
    SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");

    try {
        FileWriter fos = new FileWriter(export);
        fos.write("DATE,QUOTE\n");
        for (int i = 0; i < data.size(); i++) {
            fos.write(df.format(data.get(i).getDate()) + "," + data.get(i).getClose() + "\n");
        }
        fos.close();
    } catch (IOException e) {
        LOGGER.error("", e);
    }

}
 
开发者ID:premiummarkets,项目名称:pm,代码行数:19,代码来源:ChartMain.java

示例2: createDataSetFromStockInfo

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
private DefaultOHLCDataset createDataSetFromStockInfo(StockInfo[][] dataList) {
    int totalLength = 0;
    for (int index = 0; index < dataList.length; index++) {
        logger.log("running on datalist index " + index + " value is null? " + (dataList[index]==null) );
        totalLength += dataList[index].length;
    }

    SimpleDateFormat dateFormat = new SimpleDateFormat();
    dateFormat.applyPattern("dd/MM/YYYY");

    OHLCDataItem[] ohlcData = new OHLCDataItem[totalLength];
    int OHLCIndex = 0;
    for (int dataListIndex = 0; dataListIndex < dataList.length; dataListIndex++) {
        StockInfo[] data = dataList[dataListIndex];
        for (int index = 0; index < data.length; index++) {
            logger.log("data in index " + index + " is null? " + (data[index] == null) );
            ohlcData[OHLCIndex] = new OHLCDataItem(data[index].date, data[index].open, data[index].high, data[index].low, data[index].close, data[index].volume);

            logger.log("<R> stock chart " + dateFormat.format(data[index].date.getTime()) + " open: " + data[index].open + " high: " + data[index].high + " low: " + data[index].low + " close: " + data[index].close);
            OHLCIndex++;
        }
    }

    return new DefaultOHLCDataset("Stock", ohlcData);
}
 
开发者ID:rrodrigoa,项目名称:SmartStocks,代码行数:26,代码来源:StockAnalysisPanel.java

示例3: testDataRange

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * A small test for the data range calculated on this dataset.
 */
public void testDataRange() {
    OHLCDataItem[] data = new OHLCDataItem[3];
    data[0] = new OHLCDataItem(new Date(11L), 2.0, 4.0, 1.0, 3.0, 100.0);
    data[1] = new OHLCDataItem(new Date(22L), 4.0, 9.0, 2.0, 5.0, 120.0);
    data[2] = new OHLCDataItem(new Date(33L), 3.0, 7.0, 3.0, 6.0, 140.0);
    DefaultOHLCDataset d = new DefaultOHLCDataset("S1", data);
    Range r = DatasetUtilities.findRangeBounds(d, false);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(9.0, r.getUpperBound(), EPSILON);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:DefaultOHLCDatasetTests.java

示例4: testEquals

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {     
    OHLCDataItem i1 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    OHLCDataItem i2 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:OHLCDataItemTests.java

示例5: testCloning

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * Instances of this class are immutable - cloning not required.
 */
public void testCloning() {
    OHLCDataItem i1 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    assertFalse(i1 instanceof Cloneable);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:OHLCDataItemTests.java

示例6: testDataRange

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * A small test for the data range calculated on this dataset.
 */
public void testDataRange() {
    OHLCDataItem[] data = new OHLCDataItem[3];
    data[0] = new OHLCDataItem(new Date(11L), 2.0, 4.0, 1.0, 3.0, 100.0);
    data[1] = new OHLCDataItem(new Date(22L), 4.0, 9.0, 2.0, 5.0, 120.0);
    data[2] = new OHLCDataItem(new Date(33L), 3.0, 7.0, 3.0, 6.0, 140.0);
    DefaultOHLCDataset d = new DefaultOHLCDataset("S1", data);
    Range r = DatasetUtilities.findRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(9.0, r.getUpperBound(), EPSILON);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:DefaultOHLCDatasetTests.java

示例7: testEquals

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    OHLCDataItem i1 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    OHLCDataItem i2 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:OHLCDataItemTests.java

示例8: testPublicCloneable

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * Verify that this class implements {@link PublicCloneable}.
 */
public void testPublicCloneable() {
    DefaultOHLCDataset d1 = new DefaultOHLCDataset("Series 1",
            new OHLCDataItem[0]);
    assertTrue(d1 instanceof PublicCloneable);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:DefaultOHLCDatasetTests.java

示例9: SeriesOHLCDataset

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * Creates a new dataset.
 * 
 * @param serieReference the series key.
 * @param data the data items.
 */
public SeriesOHLCDataset(Comparable<PortfolioShare> serieReference, ArrayList<OHLCDataItem> data) {
  this.key = serieReference;
  this.data = data;
}
 
开发者ID:premiummarkets,项目名称:pm,代码行数:11,代码来源:SeriesOHLCDataset.java

示例10: getData

import org.jfree.data.xy.OHLCDataItem; //导入依赖的package包/类
/**
 * Gets the data.
 * 
 * @return the data
 */
public List<OHLCDataItem> getData() {
  return this.data;
}
 
开发者ID:premiummarkets,项目名称:pm,代码行数:9,代码来源:SeriesOHLCDataset.java


注:本文中的org.jfree.data.xy.OHLCDataItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。