本文整理匯總了Java中org.jfree.data.time.Minute類的典型用法代碼示例。如果您正苦於以下問題:Java Minute類的具體用法?Java Minute怎麽用?Java Minute使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Minute類屬於org.jfree.data.time包,在下文中一共展示了Minute類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: plotTradeBubblesOnChart
import org.jfree.data.time.Minute; //導入依賴的package包/類
private void plotTradeBubblesOnChart(ArrayList<Integer> toPlot, String p, int k, int j)
{
final Plot main_plot = (Plot)((CombinedDomainXYPlot)this.candlestickChart.getPlot()).getSubplots().get(0);
final XYPlot plot = (XYPlot) main_plot;
final TimeSeries series = new TimeSeries(p);
///*
for(Integer i: toPlot)
{
switch(j)
{
case 0:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getOpen());
break;
case 1:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getHigh());
break;
case 2:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getLow());
break;
case 3:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getClose());
break;
}
}
/*
for (int i = 0; i < defaultHighLowDataset.getSeriesCount(); i++)
{
series.add(new Minute(defaultHighLowDataset.getXDate(0, i)),plot[i]);
}
*/
XYDataset dataSet = new TimeSeriesCollection(series);
plot.setDataset(k, dataSet);
XYItemRenderer ir = new XYShapeRenderer();
//ir.s
plot.setRenderer(k, ir);
}
示例2: createIndicatorPlot
import org.jfree.data.time.Minute; //導入依賴的package包/類
private XYDataset createIndicatorPlot(String name, Double[] plot)
{
final TimeSeries series = new TimeSeries(name);
///*
for (int i = 0; i < chartDatas.size(); i++)
{
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),plot[i]);
}
/*
for (int i = 0; i < defaultHighLowDataset.getSeriesCount(); i++)
{
series.add(new Minute(defaultHighLowDataset.getXDate(0, i)),plot[i]);
}
*/
return new TimeSeriesCollection(series);
}
示例3: addBuySellSignals
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Runs a strategy over a time series and adds the value markers
* corresponding to buy/sell signals to the plot.
* @param series a time series
* @param strategy a trading strategy
* @param plot the plot
*/
private static void addBuySellSignals(TimeSeries series, Strategy strategy, XYPlot plot) {
// Running the strategy
TimeSeriesManager seriesManager = new TimeSeriesManager(series);
List<Trade> trades = seriesManager.run(strategy).getTrades();
// Adding markers to plot
for (Trade trade : trades) {
// Buy signal
double buySignalTickTime = new Minute(Date.from(series.getTick(trade.getEntry().getIndex()).getEndTime().toInstant())).getFirstMillisecond();
Marker buyMarker = new ValueMarker(buySignalTickTime);
buyMarker.setPaint(Color.GREEN);
buyMarker.setLabel("B");
plot.addDomainMarker(buyMarker);
// Sell signal
double sellSignalTickTime = new Minute(Date.from(series.getTick(trade.getExit().getIndex()).getEndTime().toInstant())).getFirstMillisecond();
Marker sellMarker = new ValueMarker(sellSignalTickTime);
sellMarker.setPaint(Color.RED);
sellMarker.setLabel("S");
plot.addDomainMarker(sellMarker);
}
}
示例4: addBuySellSignals
import org.jfree.data.time.Minute; //導入依賴的package包/類
private static void addBuySellSignals(TimeSeries series, Strategy strategy, XYPlot plot) {
// Running the strategy
TimeSeriesManager seriesManager = new TimeSeriesManager(series);
List<Trade> trades = seriesManager.run(strategy).getTrades();
// Adding markers to plot
for (Trade trade : trades) {
// Buy signal
double buySignalTickTime = new Minute(
Date.from(series.getTick(trade.getEntry().getIndex()).getEndTime().toInstant()))
.getFirstMillisecond();
Marker buyMarker = new ValueMarker(buySignalTickTime);
buyMarker.setPaint(Color.GREEN);
buyMarker.setLabel("B");
plot.addDomainMarker(buyMarker);
// Sell signal
double sellSignalTickTime = new Minute(
Date.from(series.getTick(trade.getExit().getIndex()).getEndTime().toInstant()))
.getFirstMillisecond();
Marker sellMarker = new ValueMarker(sellSignalTickTime);
sellMarker.setPaint(Color.RED);
sellMarker.setLabel("S");
plot.addDomainMarker(sellMarker);
}
}
示例5: testGetFirstMillisecondWithTimeZone
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithTimeZone() {
Minute m = new Minute(59, 15, 1, 4, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
assertEquals(-623289660000L, m.getFirstMillisecond(zone));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((TimeZone) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例6: testGetFirstMillisecondWithCalendar
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithCalendar() {
Minute m = new Minute(40, 2, 15, 4, 2000);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
assertEquals(955762800000L, m.getFirstMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例7: testGetLastMillisecondWithTimeZone
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithTimeZone() {
Minute m = new Minute(1, 2, 7, 7, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
assertEquals(-614962680001L, m.getLastMillisecond(zone));
// try null calendar
boolean pass = false;
try {
m.getLastMillisecond((TimeZone) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例8: testGetLastMillisecondWithCalendar
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithCalendar() {
Minute m = new Minute(45, 21, 21, 4, 2001);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
assertEquals(987885959999L, m.getLastMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
m.getLastMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例9: createDataset
import org.jfree.data.time.Minute; //導入依賴的package包/類
private XYDataset createDataset() throws JDependException {
TimeSeries scoreSeries = new TimeSeries("總分");
TimeSeries dSeries = new TimeSeries("抽象程度合理性");
TimeSeries balanceSeries = new TimeSeries("內聚性");
TimeSeries relationSeries = new TimeSeries("關係合理性");
AnalysisResult result;
for (ExecuteResultSummry summary : this.results.keySet()) {
result = this.results.get(summary);
scoreSeries.add(new Minute(summary.getCreateDate()), result.getScore());
dSeries.add(new Minute(summary.getCreateDate()), result.getDistance());
balanceSeries.add(new Minute(summary.getCreateDate()), result.getBalance());
relationSeries.add(new Minute(summary.getCreateDate()), result.getRelationRationality());
}
TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
timeseriescollection.addSeries(scoreSeries);
timeseriescollection.addSeries(dSeries);
timeseriescollection.addSeries(balanceSeries);
timeseriescollection.addSeries(relationSeries);
return timeseriescollection;
}
示例10: testGetFirstMillisecondWithTimeZone
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithTimeZone() {
Minute m = new Minute(59, 15, 1, 4, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
Calendar c = new GregorianCalendar(zone);
assertEquals(-623289660000L, m.getFirstMillisecond(c));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例11: testGetFirstMillisecondWithCalendar
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getFirstMillisecond(TimeZone) method.
*/
public void testGetFirstMillisecondWithCalendar() {
Minute m = new Minute(40, 2, 15, 4, 2000);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
assertEquals(955766400000L, m.getFirstMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
m.getFirstMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例12: testGetLastMillisecondWithTimeZone
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithTimeZone() {
Minute m = new Minute(1, 2, 7, 7, 1950);
TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
Calendar c = new GregorianCalendar(zone);
assertEquals(-614962680001L, m.getLastMillisecond(c));
// try null calendar
boolean pass = false;
try {
m.getLastMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例13: testGetLastMillisecondWithCalendar
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Some checks for the getLastMillisecond(TimeZone) method.
*/
public void testGetLastMillisecondWithCalendar() {
Minute m = new Minute(45, 21, 21, 4, 2001);
GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
assertEquals(987889559999L, m.getLastMillisecond(calendar));
// try null calendar
boolean pass = false;
try {
m.getLastMillisecond((Calendar) null);
}
catch (NullPointerException e) {
pass = true;
}
assertTrue(pass);
}
示例14: plotSeperatePosition
import org.jfree.data.time.Minute; //導入依賴的package包/類
private void plotSeperatePosition(HashMap<Integer,Double> toPlot)
{
final TimeSeries series = new TimeSeries("Position");
double curVal = 0.0;
for(int i=0;i<chartDatas.size();i++)
{
if(toPlot.get(i)!=null)
{
curVal=toPlot.get(i);
}
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),curVal);
}
plotSeperate(new TimeSeriesCollection(series),"Position");
}
示例15: buildChartTimeSeries
import org.jfree.data.time.Minute; //導入依賴的package包/類
/**
* Builds a JFreeChart time series from a Ta4j time series and an indicator.
* @param tickSeries the ta4j time series
* @param indicator the indicator
* @param name the name of the chart time series
* @return the JFreeChart time series
*/
private static org.jfree.data.time.TimeSeries buildChartTimeSeries(TimeSeries tickSeries, Indicator<Decimal> indicator, String name) {
org.jfree.data.time.TimeSeries chartTimeSeries = new org.jfree.data.time.TimeSeries(name);
for (int i = 0; i < tickSeries.getTickCount(); i++) {
Tick tick = tickSeries.getTick(i);
chartTimeSeries.add(new Minute(Date.from(tick.getEndTime().toInstant())), indicator.getValue(i).toDouble());
}
return chartTimeSeries;
}