本文整理汇总了Java中org.jfree.data.xy.OHLCDataset.getOpen方法的典型用法代码示例。如果您正苦于以下问题:Java OHLCDataset.getOpen方法的具体用法?Java OHLCDataset.getOpen怎么用?Java OHLCDataset.getOpen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.OHLCDataset
的用法示例。
在下文中一共展示了OHLCDataset.getOpen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateToolTip
import org.jfree.data.xy.OHLCDataset; //导入方法依赖的package包/类
/**
* Generates a tooltip text item for a particular item within a series.
*
* @param dataset the dataset.
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return the tooltip text.
*/
public String generateToolTip(XYDataset dataset, int series, int item) {
String result = null;
if (dataset instanceof OHLCDataset) {
OHLCDataset d = (OHLCDataset) dataset;
Number high = d.getHigh(series, item);
Number low = d.getLow(series, item);
Number open = d.getOpen(series, item);
Number close = d.getClose(series, item);
Number x = d.getX(series, item);
result = d.getSeriesName(series);
if (x != null) {
Date date = new Date(x.longValue());
result = result + "--> Date=" + this.dateFormatter.format(date);
if (high != null) {
result = result + " High=" + this.numberFormatter.format(high.doubleValue());
}
if (low != null) {
result = result + " Low=" + this.numberFormatter.format(low.doubleValue());
}
if (open != null) {
result = result + " Open=" + this.numberFormatter.format(open.doubleValue());
}
if (close != null) {
result = result + " Close=" + this.numberFormatter.format(close.doubleValue());
}
}
}
return result;
}
示例2: generateToolTip
import org.jfree.data.xy.OHLCDataset; //导入方法依赖的package包/类
/**
* Generates a tooltip text item for a particular item within a series.
*
* @param dataset the dataset.
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return The tooltip text.
*/
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
if (!(dataset instanceof OHLCDataset)) {
return null;
}
StringBuilder sb = new StringBuilder();
OHLCDataset d = (OHLCDataset) dataset;
Number high = d.getHigh(series, item);
Number low = d.getLow(series, item);
Number open = d.getOpen(series, item);
Number close = d.getClose(series, item);
Number x = d.getX(series, item);
sb.append(d.getSeriesKey(series).toString());
if (x != null) {
Date date = new Date(x.longValue());
sb.append("--> Date=").append(this.dateFormatter.format(date));
if (high != null) {
sb.append(" High=");
sb.append(this.numberFormatter.format(high.doubleValue()));
}
if (low != null) {
sb.append(" Low=");
sb.append(this.numberFormatter.format(low.doubleValue()));
}
if (open != null) {
sb.append(" Open=");
sb.append(this.numberFormatter.format(open.doubleValue()));
}
if (close != null) {
sb.append(" Close=");
sb.append(this.numberFormatter.format(close.doubleValue()));
}
}
return sb.toString();
}
示例3: generateToolTip
import org.jfree.data.xy.OHLCDataset; //导入方法依赖的package包/类
/**
* Generates a tooltip text item for a particular item within a series.
*
* @param dataset the dataset.
* @param series the series (zero-based index).
* @param item the item (zero-based index).
*
* @return The tooltip text.
*/
public String generateToolTip(XYDataset dataset, int series, int item) {
String result = null;
if (dataset instanceof OHLCDataset) {
OHLCDataset d = (OHLCDataset) dataset;
Number high = d.getHigh(series, item);
Number low = d.getLow(series, item);
Number open = d.getOpen(series, item);
Number close = d.getClose(series, item);
Number x = d.getX(series, item);
result = d.getSeriesKey(series).toString();
if (x != null) {
Date date = new Date(x.longValue());
result = result + "--> Date=" + this.dateFormatter.format(date);
if (high != null) {
result = result + " High="
+ this.numberFormatter.format(high.doubleValue());
}
if (low != null) {
result = result + " Low="
+ this.numberFormatter.format(low.doubleValue());
}
if (open != null) {
result = result + " Open="
+ this.numberFormatter.format(open.doubleValue());
}
if (close != null) {
result = result + " Close="
+ this.numberFormatter.format(close.doubleValue());
}
}
}
return result;
}