本文整理汇总了Java中org.jfree.chart.plot.IntervalMarker类的典型用法代码示例。如果您正苦于以下问题:Java IntervalMarker类的具体用法?Java IntervalMarker怎么用?Java IntervalMarker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntervalMarker类属于org.jfree.chart.plot包,在下文中一共展示了IntervalMarker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return A sample chart.
*/
private JFreeChart createChart(IntervalXYDataset dataset,String s) {
final JFreeChart chart = ChartFactory.createXYBarChart(
"Histogram Plot: "+s,
"Keyword index",
false,
"frequency",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
final IntervalMarker target = new IntervalMarker(400.0, 700.0);
//target.setLabel("Target Range");
target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
target.setLabelAnchor(RectangleAnchor.LEFT);
target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
target.setPaint(new Color(222, 222, 255, 128));
plot.addRangeMarker(target, Layer.BACKGROUND);
return chart;
}
示例2: process
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
@Override
public Data process(Data item) {
Utils.mapContainsKeys(item, key);
IntervalMarker[] marker = new IntervalMarker[Constants.N_PIXELS];
double[] arrivalTime = (double[]) item.get(key);
double[] newArrivalTime = new double[arrivalTime.length];
Random rand = new Random(Seed);
for (int i = 0; i < arrivalTime.length; i++) {
Double effStdDev = Math.sqrt(stdDevGoal * stdDevGoal - stdDevOrigin * stdDevOrigin);
Double randomArrTimeOffset = rand.nextGaussian() * effStdDev;
newArrivalTime[i] = arrivalTime[i] + randomArrTimeOffset;
marker[i] = new IntervalMarker(newArrivalTime[i], newArrivalTime[i] + 10);
}
item.put(outputKey, newArrivalTime);
item.put(outputKey + "marker", marker);
return item;
}
示例3: sd1JCheckBoxMenuItemActionPerformed
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Hides or displayes the 1SD interval marker.
*
* @param evt
*/
private void sd1JCheckBoxMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sd1JCheckBoxMenuItemActionPerformed
Iterator iterator = foldChangeplot.getDomainMarkers(Layer.BACKGROUND).iterator();
while (iterator.hasNext()) {
IntervalMarker tempMarker = (IntervalMarker) iterator.next();
if (tempMarker.getLabel().equalsIgnoreCase("1SD")) {
if (sd1JCheckBoxMenuItem.isSelected()) {
tempMarker.setAlpha(1f);
} else {
tempMarker.setAlpha(0f);
}
}
}
}
示例4: sd2JCheckBoxMenuItemActionPerformed
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Hides or displayes the 2SD interval marker.
*
* @param evt
*/
private void sd2JCheckBoxMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sd2JCheckBoxMenuItemActionPerformed
Iterator iterator = foldChangeplot.getDomainMarkers(Layer.BACKGROUND).iterator();
while (iterator.hasNext()) {
IntervalMarker tempMarker = (IntervalMarker) iterator.next();
if (tempMarker.getLabel().equalsIgnoreCase("2SD")) {
if (sd2JCheckBoxMenuItem.isSelected()) {
tempMarker.setAlpha(1f);
} else {
tempMarker.setAlpha(0f);
}
}
}
}
示例5: removeFoldChangeMarkers
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Removes the fold change markers.
*/
private void removeFoldChangeMarkers() {
if (foldChangeplot != null && foldChangeplot.getDomainMarkers(Layer.FOREGROUND) != null) {
Iterator iterator = foldChangeplot.getDomainMarkers(Layer.FOREGROUND).iterator();
// store the keys in a list first to escape a ConcurrentModificationException
ArrayList<IntervalMarker> tempMarkers = new ArrayList<IntervalMarker>();
while (iterator.hasNext()) {
tempMarkers.add((IntervalMarker) iterator.next());
}
for (int i = 0; i < tempMarkers.size(); i++) {
foldChangeplot.removeDomainMarker(tempMarkers.get(i));
}
}
}
示例6: addMarker
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* @param plot plot for the marker
* @param startVal start postion
* @param endVal end position
*/
protected void addMarker(XYPlot plot, int startVal, int endVal) {
IntervalMarker marker = new IntervalMarker(startVal, endVal);
marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
marker.setPaint(new Color(134, 254, 225));
marker.setAlpha((float) 0.60);
marker.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
marker.setLabelPaint(Color.green);
marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
plot.addDomainMarker(marker, Layer.BACKGROUND);
ValueMarker markStart = new ValueMarker(startVal, new Color(31, 254, 225),
new BasicStroke(2.0f));
ValueMarker markEnd = new ValueMarker(endVal, new Color(31, 254, 225), new BasicStroke(2.0f));
plot.addDomainMarker(markStart, Layer.BACKGROUND);
plot.addDomainMarker(markEnd, Layer.BACKGROUND);
}
示例7: addPeriodMarker
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Adds a periodicity marker.
*
* @param plot plot for the marker
* @param startVal start postion
* @param endVal end position
*/
protected void addPeriodMarker(XYPlot plot, int startVal, int endVal) {
IntervalMarker marker = new IntervalMarker(startVal, endVal);
marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
marker.setPaint(new Color(134, 254, 225));
marker.setAlpha((float) 0.60);
marker.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
marker.setLabelPaint(Color.blue);
marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
marker.setPaint(Color.blue);
plot.addDomainMarker(marker, Layer.BACKGROUND);
}
示例8: addAnomalyMarker
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Adds an anomaly marker.
*
* @param plot plot for the marker
* @param startVal start postion
* @param endVal end position
*/
protected void addAnomalyMarker(XYPlot plot, int startVal, int endVal) {
IntervalMarker marker = new IntervalMarker(startVal, endVal);
marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
marker.setPaint(new Color(134, 254, 225));
marker.setAlpha((float) 0.60);
marker.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
marker.setLabelPaint(Color.pink);
marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
marker.setPaint(Color.pink);
plot.addDomainMarker(marker, Layer.BACKGROUND);
}
示例9: createChart
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return A sample chart.
*/
private JFreeChart createChart(IntervalXYDataset dataset) {
final JFreeChart chart = ChartFactory.createXYBarChart(
"XY Series Demo",
"X",
false,
"Y",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
final IntervalMarker target = new IntervalMarker(400.0, 700.0);
target.setLabel("Target Range");
target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
target.setLabelAnchor(RectangleAnchor.LEFT);
target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
target.setPaint(new Color(222, 222, 255, 128));
plot.addRangeMarker(target, Layer.BACKGROUND);
return chart;
}
示例10: setMarker
import org.jfree.chart.plot.IntervalMarker; //导入依赖的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++;
}
}
示例11: draw
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Draws the band.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param dataArea the data area.
* @param x the x-coordinate.
* @param y the y-coordinate.
*/
public void draw(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea,
double x, double y) {
double h = getHeight(g2);
Iterator iterator = this.markers.iterator();
while (iterator.hasNext()) {
IntervalMarker marker = (IntervalMarker) iterator.next();
double start = Math.max(marker.getStartValue(), this.axis.getRange().getLowerBound());
double end = Math.min(marker.getEndValue(), this.axis.getRange().getUpperBound());
double s = this.axis.valueToJava2D(start, dataArea, RectangleEdge.BOTTOM);
double e = this.axis.valueToJava2D(end, dataArea, RectangleEdge.BOTTOM);
Rectangle2D r = new Rectangle2D.Double(
s, y + this.topOuterGap, e - s, h - this.topOuterGap - this.bottomOuterGap
);
Composite originalComposite = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
marker.getAlpha()));
g2.setPaint(marker.getPaint());
g2.fill(r);
g2.setPaint(marker.getOutlinePaint());
g2.draw(r);
g2.setComposite(originalComposite);
g2.setPaint(Color.black);
drawStringInRect(g2, r, this.font, marker.getLabel());
}
}
示例12: testGetSetStartValue
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Some checks for the getStartValue() and setStartValue() methods.
*/
public void testGetSetStartValue() {
IntervalMarker m = new IntervalMarker(1.0, 2.0);
m.addChangeListener(this);
this.lastEvent = null;
assertEquals(1.0, m.getStartValue(), EPSILON);
m.setStartValue(0.5);
assertEquals(0.5, m.getStartValue(), EPSILON);
assertEquals(m, this.lastEvent.getMarker());
}
示例13: testGetSetEndValue
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Some checks for the getEndValue() and setEndValue() methods.
*/
public void testGetSetEndValue() {
IntervalMarker m = new IntervalMarker(1.0, 2.0);
m.addChangeListener(this);
this.lastEvent = null;
assertEquals(2.0, m.getEndValue(), EPSILON);
m.setEndValue(0.5);
assertEquals(0.5, m.getEndValue(), EPSILON);
assertEquals(m, this.lastEvent.getMarker());
}
示例14: draw
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Draws the band.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param dataArea the data area.
* @param x the x-coordinate.
* @param y the y-coordinate.
*/
public void draw(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea,
double x, double y) {
double h = getHeight(g2);
Iterator iterator = this.markers.iterator();
while (iterator.hasNext()) {
IntervalMarker marker = (IntervalMarker) iterator.next();
double start = Math.max(
marker.getStartValue(), this.axis.getRange().getLowerBound()
);
double end = Math.min(
marker.getEndValue(), this.axis.getRange().getUpperBound()
);
double s = this.axis.valueToJava2D(
start, dataArea, RectangleEdge.BOTTOM
);
double e = this.axis.valueToJava2D(
end, dataArea, RectangleEdge.BOTTOM
);
Rectangle2D r = new Rectangle2D.Double(
s, y + this.topOuterGap, e - s,
h - this.topOuterGap - this.bottomOuterGap
);
Composite originalComposite = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, marker.getAlpha())
);
g2.setPaint(marker.getPaint());
g2.fill(r);
g2.setPaint(marker.getOutlinePaint());
g2.draw(r);
g2.setComposite(originalComposite);
g2.setPaint(Color.black);
drawStringInRect(g2, r, this.font, marker.getLabel());
}
}
示例15: draw
import org.jfree.chart.plot.IntervalMarker; //导入依赖的package包/类
/**
* Draws the band.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param dataArea the data area.
* @param x the x-coordinate.
* @param y the y-coordinate.
*/
public void draw(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea,
double x, double y) {
double h = getHeight(g2);
Iterator iterator = this.markers.iterator();
while (iterator.hasNext()) {
IntervalMarker marker = (IntervalMarker) iterator.next();
double start = Math.max(
marker.getStartValue(), this.axis.getRange().getLowerBound()
);
double end = Math.min(
marker.getEndValue(), this.axis.getRange().getUpperBound()
);
double s = this.axis.valueToJava2D(
start, dataArea, RectangleEdge.BOTTOM
);
double e = this.axis.valueToJava2D(
end, dataArea, RectangleEdge.BOTTOM
);
Rectangle2D r = new Rectangle2D.Double(
s, y + this.topOuterGap, e - s,
h - this.topOuterGap - this.bottomOuterGap
);
Composite originalComposite = g2.getComposite();
g2.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, marker.getAlpha())
);
g2.setPaint(marker.getPaint());
g2.fill(r);
g2.setPaint(marker.getOutlinePaint());
g2.draw(r);
g2.setComposite(originalComposite);
g2.setPaint(Color.black);
drawStringInRect(g2, r, this.font, marker.getLabel());
}
}