本文整理汇总了Java中org.jfree.data.xy.DefaultOHLCDataset类的典型用法代码示例。如果您正苦于以下问题:Java DefaultOHLCDataset类的具体用法?Java DefaultOHLCDataset怎么用?Java DefaultOHLCDataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultOHLCDataset类属于org.jfree.data.xy包,在下文中一共展示了DefaultOHLCDataset类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataSetFromStockInfo
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的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);
}
示例2: testDataRange
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的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);
}
示例3: processNode
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的package包/类
public void processNode(Object name, Map map, Object value) throws Exception {
if(value != null && value instanceof DefaultOHLCDataset) {
this.xyDataset = (DefaultOHLCDataset)value;
}else {
// TODO
}
}
示例4: testDataRange
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的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);
}
示例5: createPredictionChart
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的package包/类
private JFreeChart createPredictionChart(DefaultOHLCDataset dataset) {
// Create the JFreeChart for prediction
JFreeChart predictionChart = ChartFactory.createHighLowChart("Stock Price Prediction",
"Time", "Price", dataset, true);
return predictionChart;
}
示例6: testPublicCloneable
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的package包/类
/**
* Verify that this class implements {@link PublicCloneable}.
*/
public void testPublicCloneable() {
DefaultOHLCDataset d1 = new DefaultOHLCDataset("Series 1",
new OHLCDataItem[0]);
assertTrue(d1 instanceof PublicCloneable);
}
示例7: getXyDataset
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的package包/类
/**
* Getter for property xyDataset.
* @return Value of property xyDataset.
*/
public DefaultOHLCDataset getXyDataset() {
return this.xyDataset;
}
示例8: setXyDataset
import org.jfree.data.xy.DefaultOHLCDataset; //导入依赖的package包/类
/**
* Setter for property xyDataset.
* @param xyDataset New value of property xyDataset.
*/
public void setXyDataset(DefaultOHLCDataset xyDataset) {
this.xyDataset = xyDataset;
}