本文整理汇总了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);
}
}
示例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);
}
}
示例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()
);
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}
示例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++;
}
}
示例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));
}
示例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));
}
示例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));
}
示例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 );
}
}
示例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);
}
}
}
示例13: addMarker
import org.jfree.chart.plot.Marker; //导入依赖的package包/类
@Override
protected void addMarker(Plot plot, Marker marker)
{
((XYPlot)plot).addDomainMarker(
marker,
getLayer()
);
}
示例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);
}
示例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);
}
}
}