本文整理汇总了Java中org.jfree.chart.plot.IntervalMarker.setLabel方法的典型用法代码示例。如果您正苦于以下问题:Java IntervalMarker.setLabel方法的具体用法?Java IntervalMarker.setLabel怎么用?Java IntervalMarker.setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.IntervalMarker
的用法示例。
在下文中一共展示了IntervalMarker.setLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) {
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;
}
示例2: getDateIntervalMarker
import org.jfree.chart.plot.IntervalMarker; //导入方法依赖的package包/类
public static Marker getDateIntervalMarker(Date paramDate1, Date paramDate2, String paramString) {
double d1 = paramDate1.getTime();
double d2 = paramDate2.getTime();
BasicStroke localBasicStroke = new BasicStroke(0.3F);
IntervalMarker localIntervalMarker = new IntervalMarker(d1, d2, Color.pink, localBasicStroke, Color.black, localBasicStroke, 0.5F);
localIntervalMarker.setLabel(paramString);
localIntervalMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
localIntervalMarker.setLabelTextAnchor(TextAnchor.BOTTOM_CENTER);
return localIntervalMarker;
}
示例3: addRangeMarker
import org.jfree.chart.plot.IntervalMarker; //导入方法依赖的package包/类
public void addRangeMarker(CategoryPlot plot, cfCHARTRANGEMARKERData rmData) throws cfmRunTimeException {
IntervalMarker rangeMarker = new IntervalMarker(rmData.getStart(), rmData.getEnd());
rangeMarker.setPaint(convertStringToColor(rmData.getColor()));
if (rmData.getLabel() != null) {
rangeMarker.setLabel(rmData.getLabel());
rangeMarker.setLabelPaint(convertStringToColor(rmData.getLabelColor()));
String labelPos = rmData.getLabelPosition();
if (labelPos.equals("top_left")) {
rangeMarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
rangeMarker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
} else if (labelPos.equals("top")) {
rangeMarker.setLabelAnchor(RectangleAnchor.TOP);
rangeMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER);
} else if (labelPos.equals("top_right")) {
rangeMarker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
rangeMarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
} else if (labelPos.equals("left")) {
rangeMarker.setLabelAnchor(RectangleAnchor.LEFT);
rangeMarker.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
} else if (labelPos.equals("center")) {
rangeMarker.setLabelAnchor(RectangleAnchor.CENTER);
rangeMarker.setLabelTextAnchor(TextAnchor.CENTER);
} else if (labelPos.equals("right")) {
rangeMarker.setLabelAnchor(RectangleAnchor.RIGHT);
rangeMarker.setLabelTextAnchor(TextAnchor.CENTER_RIGHT);
} else if (labelPos.equals("bottom_left")) {
rangeMarker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
rangeMarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
} else if (labelPos.equals("bottom")) {
rangeMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
rangeMarker.setLabelTextAnchor(TextAnchor.BOTTOM_CENTER);
} else if (labelPos.equals("bottom_right")) {
rangeMarker.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT);
rangeMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
}
rangeMarker.setLabelOffsetType(LengthAdjustmentType.NO_CHANGE);
rangeMarker.setLabelFont(getFont(rmData.getFont(), rmData.getFontBold(), rmData.getFontItalic(), rmData.getFontSize()));
}
plot.addRangeMarker(rangeMarker, Layer.BACKGROUND);
}