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


Java XYPlot.addDomainMarker方法代码示例

本文整理汇总了Java中org.jfree.chart.plot.XYPlot.addDomainMarker方法的典型用法代码示例。如果您正苦于以下问题:Java XYPlot.addDomainMarker方法的具体用法?Java XYPlot.addDomainMarker怎么用?Java XYPlot.addDomainMarker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.plot.XYPlot的用法示例。


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

示例1: addBuySellSignals

import org.jfree.chart.plot.XYPlot; //导入方法依赖的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);
    }
}
 
开发者ID:ta4j,项目名称:ta4j,代码行数:28,代码来源:BuyAndSellSignalsToChart.java

示例2: addBuySellSignals

import org.jfree.chart.plot.XYPlot; //导入方法依赖的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);
	}
}
 
开发者ID:jnidzwetzki,项目名称:crypto-bot,代码行数:25,代码来源:Chart.java

示例3: testListenersWithXYPlot

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
public void testListenersWithXYPlot() {
    XYPlot plot = new XYPlot();
    ValueMarker marker1 = new ValueMarker(1.0);
    ValueMarker marker2 = new ValueMarker(2.0);
    plot.addDomainMarker(marker1);
    plot.addRangeMarker(marker2);
    EventListener[] listeners1 = marker1.getListeners(
            MarkerChangeListener.class);
    assertTrue(Arrays.asList(listeners1).contains(plot));
    EventListener[] listeners2 = marker1.getListeners(
            MarkerChangeListener.class);
    assertTrue(Arrays.asList(listeners2).contains(plot));
    plot.clearDomainMarkers();
    plot.clearRangeMarkers();
    listeners1 = marker1.getListeners(MarkerChangeListener.class);
    assertFalse(Arrays.asList(listeners1).contains(plot));
    listeners2 = marker1.getListeners(MarkerChangeListener.class);
    assertFalse(Arrays.asList(listeners2).contains(plot));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:MarkerTests.java

示例4: testAddDomainMarker

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
 * Some tests for the addDomainMarker() method(s).
 */
public void testAddDomainMarker() {
    XYPlot plot = new XYPlot();
    Marker m = new ValueMarker(1.0);
    plot.addDomainMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearDomainMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:XYPlotTests.java


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