📄 jfreechart.java
字号:
public void setBorderVisible(boolean visible) {
this.borderVisible = visible;
fireChartChanged();
}
/**
* Returns the stroke used to draw the chart border (if visible).
*
* @return The border stroke.
*/
public Stroke getBorderStroke() {
return this.borderStroke;
}
/**
* Sets the stroke used to draw the chart border (if visible).
*
* @param stroke the stroke.
*/
public void setBorderStroke(Stroke stroke) {
this.borderStroke = stroke;
fireChartChanged();
}
/**
* Returns the paint used to draw the chart border (if visible).
*
* @return The border paint.
*/
public Paint getBorderPaint() {
return this.borderPaint;
}
/**
* Sets the paint used to draw the chart border (if visible).
*
* @param paint the paint.
*/
public void setBorderPaint(Paint paint) {
this.borderPaint = paint;
fireChartChanged();
}
/**
* Returns the chart title.
*
* @return the chart title (possibly <code>null</code>).
*/
public TextTitle getTitle() {
return this.title;
}
/**
* Sets the title for the chart. If you do not want a title for the chart, set it
* to <code>null</code>.
*
* @param title the title (<code>null</code> permitted).
*/
public void setTitle(TextTitle title) {
this.title = title;
fireChartChanged();
}
/**
* Sets the chart title. This is a convenience method that ends up calling the
* {@link #setTitle(TextTitle)} method.
*
* @param title the new title (<code>null</code> permitted).
*/
public void setTitle(String title) {
if (title != null) {
if (this.title == null) {
setTitle(new TextTitle(title, JFreeChart.DEFAULT_TITLE_FONT));
}
else {
this.title.setText(title);
}
}
else {
setTitle((TextTitle) null);
}
}
/**
* Returns the list of subtitles.
*
* @return the subtitle list.
*/
public List getSubtitles() {
return this.subtitles;
}
/**
* Sets the title list for the chart (completely replaces any existing titles).
*
* @param subtitles the new list of subtitles.
*/
public void setSubtitles(List subtitles) {
if (subtitles == null) {
throw new NullPointerException("JFreeChart.setSubtitles(..): argument is null.");
}
this.subtitles = subtitles;
fireChartChanged();
}
/**
* Returns the number of titles for the chart.
*
* @return the number of titles for the chart.
*/
public int getSubtitleCount() {
return this.subtitles.size();
}
/**
* Returns a chart subtitle.
*
* @param index the index of the chart subtitle (zero based).
*
* @return a chart subtitle.
*/
public Title getSubtitle(int index) {
// check arguments...
if ((index < 0) || (index == getSubtitleCount())) {
throw new IllegalArgumentException("JFreeChart.getSubtitle(...): index out of range.");
}
return (Title) this.subtitles.get(index);
}
/**
* Adds a chart subtitle, and notifies registered listeners that the chart has been modified.
*
* @param subtitle the subtitle.
*/
public void addSubtitle(Title subtitle) {
if (subtitle != null) {
this.subtitles.add(subtitle);
subtitle.addChangeListener(this);
fireChartChanged();
}
}
/**
* Returns the chart legend.
*
* @return the chart legend (possibly <code>null</code>).
*/
public Legend getLegend() {
return this.legend;
}
/**
* Sets the chart legend. Registered listeners are notified that the chart
* has been modified. The legends chart reference is updated.
*
* @param legend the new chart legend (null permitted).
*/
public void setLegend(Legend legend) {
// if there is an existing legend, remove the chart from the list of
// change listeners...
Legend existing = this.legend;
if (existing != null) {
existing.removeChangeListener(this);
existing.registerChart(null);
}
// set the new legend, and register the chart as a change listener...
this.legend = legend;
if (legend != null) {
legend.registerChart(this);
legend.addChangeListener(this);
}
// notify chart change listeners...
fireChartChanged();
}
/**
* Returns the plot for the chart. The plot is a class responsible for
* coordinating the visual representation of the data, including the axes
* (if any).
*
* @return the plot.
*/
public Plot getPlot() {
return this.plot;
}
/**
* Returns the plot cast as a {@link CategoryPlot}.
* <p>
* NOTE: if the plot is not an instance of {@link CategoryPlot}, then a
* <code>ClassCastException</code> is thrown.
*
* @return the plot.
*/
public CategoryPlot getCategoryPlot() {
return (CategoryPlot) this.plot;
}
/**
* Returns the plot cast as an {@link XYPlot}.
* <p>
* NOTE: if the plot is not an instance of {@link XYPlot}, then a
* <code>ClassCastException</code> is thrown.
*
* @return the plot.
*/
public XYPlot getXYPlot() {
return (XYPlot) this.plot;
}
/**
* Returns a flag that indicates whether or not anti-aliasing is used when
* the chart is drawn.
*
* @return the flag.
*/
public boolean getAntiAlias() {
Object o = this.renderingHints.get(RenderingHints.KEY_ANTIALIASING);
if (o == null) {
return false;
}
return (o.equals(RenderingHints.VALUE_ANTIALIAS_ON));
}
/**
* Sets a flag that indicates whether or not anti-aliasing is used when the
* chart is drawn.
* <P>
* Anti-aliasing usually improves the appearance of charts, but is slower.
*
* @param flag the new value of the flag.
*/
public void setAntiAlias(boolean flag) {
Object o = this.renderingHints.get(RenderingHints.KEY_ANTIALIASING);
if (o == null) {
o = RenderingHints.VALUE_ANTIALIAS_DEFAULT;
}
if (!flag && RenderingHints.VALUE_ANTIALIAS_OFF.equals(o)
|| flag && RenderingHints.VALUE_ANTIALIAS_ON.equals(o)) {
// no change, do nothing
return;
}
if (flag) {
this.renderingHints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
else {
this.renderingHints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
}
fireChartChanged();
}
/**
* Returns the paint used for the chart background.
*
* @return The paint (possibly <code>null</code>).
*/
public Paint getBackgroundPaint() {
return this.backgroundPaint;
}
/**
* Sets the paint used to fill the chart background and sends a {@link ChartChangeEvent} to
* all registered listeners.
*
* @param paint the paint (<code>null</code> permitted).
*/
public void setBackgroundPaint(Paint paint) {
if (this.backgroundPaint != null) {
if (!this.backgroundPaint.equals(paint)) {
this.backgroundPaint = paint;
fireChartChanged();
}
}
else {
if (paint != null) {
this.backgroundPaint = paint;
fireChartChanged();
}
}
}
/**
* Returns the background image for the chart, or <code>null</code> if there is no image.
*
* @return The image (possibly <code>null</code>).
*/
public Image getBackgroundImage() {
return this.backgroundImage;
}
/**
* Sets the background image for the chart and sends a {@link ChartChangeEvent} to all
* registered listeners.
*
* @param image the image (<code>null</code> permitted).
*/
public void setBackgroundImage(Image image) {
if (this.backgroundImage != null) {
if (!this.backgroundImage.equals(image)) {
this.backgroundImage = image;
fireChartChanged();
}
}
else {
if (image != null) {
this.backgroundImage = image;
fireChartChanged();
}
}
}
/**
* Returns the background image alignment. Alignment constants are defined in the
* <code>com.jrefinery.ui.Align</code> class in the JCommon class library.
*
* @return The alignment.
*/
public int getBackgroundImageAlignment() {
return this.backgroundImageAlignment;
}
/**
* Sets the background alignment. Alignment options are defined by the
* {@link org.jfree.ui.Align} class.
*
* @param alignment the alignment.
*/
public void setBackgroundImageAlignment(int alignment) {
if (this.backgroundImageAlignment != alignment) {
this.backgroundImageAlignment = alignment;
fireChartChanged();
}
}
/**
* Returns the alpha-transparency for the chart's background image.
*
* @return The alpha-transparency.
*/
public float getBackgroundImageAlpha() {
return this.backgroundImageAlpha;
}
/**
* Sets the alpha-transparency for the chart's background image.
* Registered listeners are notified that the chart has been changed.
*
* @param alpha the alpha value.
*/
public void setBackgroundImageAlpha(float alpha) {
if (this.backgroundImageAlpha != alpha) {
this.backgroundImageAlpha = alpha;
fireChartChanged();
}
}
/**
* Returns a flag that controls whether or not change events are sent to registered listeners.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -