當前位置: 首頁>>代碼示例>>Java>>正文


Java Marker類代碼示例

本文整理匯總了Java中org.jfree.chart.plot.Marker的典型用法代碼示例。如果您正苦於以下問題:Java Marker類的具體用法?Java Marker怎麽用?Java Marker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Marker類屬於org.jfree.chart.plot包,在下文中一共展示了Marker類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addBuySellSignals

import org.jfree.chart.plot.Marker; //導入依賴的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.Marker; //導入依賴的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: addMarker

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
@Override
protected void addMarker(Plot plot, Marker marker)
{
	if (plot instanceof XYPlot)
	{
		((XYPlot)plot).addRangeMarker(
			marker, 
			getLayer()
			);
	}
	else if (plot instanceof CategoryPlot)
	{
		((CategoryPlot)plot).addRangeMarker(
			marker, 
			getLayer()
			);
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:19,代碼來源:RangeIntervalMarkerCustomizer.java

示例4: attachLabels

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
/**
 * replaces the marker keys with their message labels from the resource bundle. Also sets the subTitle of the graph.
 */
private void attachLabels(final StatisticalResultDTO rawDataObject, final ConversionSimulationDTO dto, final ActionContext context) {
    final Marker[] markers = rawDataObject.getDomainMarkers();
    if (markers != null) {
        for (final Marker marker : markers) {
            final String key = marker.getLabel();
            if (key != null) {
                final String title = context.message(key);
                marker.setLabel(title);
            }
        }
    }
    final LocalSettings localSettings = settingsService.getLocalSettings();
    TransferType transferType = dto.getTransferType();
    transferType = transferTypeService.load(transferType.getId(), TransferType.Relationships.TRANSACTION_FEES, RelationshipHelper.nested(TransferType.Relationships.FROM, AccountType.Relationships.CURRENCY));
    final String unitsPattern = transferType.getFrom().getCurrency().getPattern();
    final NumberConverter<BigDecimal> numberConverter = localSettings.getUnitsConverter(unitsPattern);
    final String numberString = numberConverter.toString(dto.getAmount());
    final String subTitle = context.message("conversionSimulation.result.graph.subtitle", numberString);
    rawDataObject.setSubTitle(subTitle);
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:24,代碼來源:SimulateConversionAction.java

示例5: setMarkers

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
private void setMarkers(final CategoryPlot plot, final Map params) {
    final Marker[] domainMarkers = (Marker[]) params.get("domainMarkers");
    // this method may be extended for range markers in future.
    if (domainMarkers != null && domainMarkers.length > 0) {
        for (final Marker marker : domainMarkers) {
            final CategoryMarker cmarker = (CategoryMarker) marker;
            cmarker.setDrawAsLine(true);
            if (cmarker.getLabel() != null) {
                cmarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
                cmarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
            }
            plot.addDomainMarker(cmarker);
        }
    }
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:17,代碼來源:ChartPostProcessorImpl.java

示例6: addMarkers

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
@Override
public void addMarkers(List<Marker> markers) {
    if (getChart() != null) {
        XYPlot plot = getChart().getXYPlot();

        plot.clearDomainMarkers();
        plot.clearRangeMarkers();

        for (Marker marker : markers) {
            if (marker instanceof RangeValueMarker) {
                plot.addRangeMarker(marker);
            }
            else if (marker instanceof DomainValueMarker) {
                plot.addDomainMarker(marker);
            }

            firePropertyChange("annotation", null, marker);
        }
    }
}
 
開發者ID:nmonvisualizer,項目名稱:nmonvisualizer,代碼行數:21,代碼來源:LineChartPanel.java

示例7: setMarker

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
@SuppressWarnings("unused")
private void setMarker(XYPlot plot) {
	Iterator<Date> ir = m_dateMarkerMap.keySet().iterator();
	int index = 1;
	while (ir.hasNext()) {

		Date key = ir.next();

		final Marker marker = new IntervalMarker(key.getTime(),
				m_dateMarkerMap.get(key).getTime());

		if (this.m_visualMarkerLabel)
			marker.setLabel("#" + index);
		// marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
		// marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);

		marker.setAlpha(0.3f);
		//marker.setPaint(this.m_markerColor);

		plot.addDomainMarker(marker);
		index++;
	}
}
 
開發者ID:ezScrum,項目名稱:ezScrum,代碼行數:24,代碼來源:ChartUtil.java

示例8: testAddDomainMarker

import org.jfree.chart.plot.Marker; //導入依賴的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

示例9: testAddRangeMarker

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
/**
 * Some tests for the addRangeMarker() method(s).
 */
public void testAddRangeMarker() {
    XYPlot plot = new XYPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:15,代碼來源:XYPlotTests.java

示例10: testAddRangeMarker

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
/**
 * Some tests for the addRangeMarker() method(s).
 */
public void testAddRangeMarker() {
    CategoryPlot plot = new CategoryPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:15,代碼來源:CategoryPlotTests.java

示例11: addRegionMarker

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
private void addRegionMarker( double x ) {

        Marker marker = new ValueMarker( x );
        marker.setPaint( _markerColor );
        marker.setStroke( QTConstants.REGION_MARKER_STROKE );
        
        Iterator i = _plots.iterator();
        while ( i.hasNext() ) {
            XYPlot plot = (XYPlot) i.next();
            plot.addDomainMarker( marker );
        }
    }
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:13,代碼來源:QTRegionMarkerManager.java

示例12: customize

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
@Override
public void customize(JFreeChart jfc, JRChart jrc) 
{
	if (jfc.getPlot() instanceof XYPlot)
	{
		Marker marker = createMarker();
		if (marker != null)
		{
			addMarker(jfc.getPlot(), marker);
		}
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:13,代碼來源:DomainIntervalMarkerCustomizer.java

示例13: addMarker

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
@Override
protected void addMarker(Plot plot, Marker marker)
{
	((XYPlot)plot).addDomainMarker(
		marker, 
		getLayer()
		);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:9,代碼來源:DomainIntervalMarkerCustomizer.java

示例14: configureStroke

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
protected void configureStroke(Marker marker)
{
	Float strokeWidth = getFloatProperty(PROPERTY_STROKE_WIDTH);
	if (strokeWidth == null)
	{
		strokeWidth = 1f;
	}

	BasicStroke basicStroke = getStroke(strokeWidth);

	marker.setStroke(basicStroke);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:13,代碼來源:AbstractMarkerCustomizer.java

示例15: customize

import org.jfree.chart.plot.Marker; //導入依賴的package包/類
@Override
public void customize(JFreeChart jfc, JRChart jrc) 
{
	if (jfc.getPlot() instanceof XYPlot)
	{
		Marker marker = createMarker();
		if (marker != null)
		{
			addMarker(jfc.getXYPlot(), marker);
		}
	}
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:13,代碼來源:RangeValueMarkerCustomizer.java


注:本文中的org.jfree.chart.plot.Marker類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。