当前位置: 首页>>代码示例>>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;未经允许,请勿转载。