public class BarPlot extends XYPlot
Class that displays data in a bar plot.
To create a new BarPlot
simply create a new instance
using one or more data sources. Example:
DataTable data = new DataTable(Integer.class, Double.class); data.add(2010, -5.00); data.add(2011, 3.25); data.add(2012, -0.50); data.add(2012, 4.00); BarPlot plot = new BarPlot(data);
Modifier and Type | Class and Description |
---|---|
static class |
BarPlot.BarPlotLegend
A legend implementation for bar plots that displays all values of the
data source as items.
|
static class |
BarPlot.BarRenderer
Class that renders a bar in a bar plot.
|
XYPlot.XYLegend, XYPlot.XYNavigationDirection, XYPlot.XYPlotArea2D, XYPlot.XYPlotNavigator
Constructor and Description |
---|
BarPlot(DataSource... data)
Creates a new instance and initializes it with the specified
data sources.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
DataSource source,
boolean visible)
Inserts the specified data series to the plot at a specified position.
|
void |
autoscaleAxis(java.lang.String axisName)
Tries to automatically set the ranges of the axes specified by the name
if it is set to auto-scale.
|
double |
getBarHeightMin()
Returns the minimum height of the bars in view units
(e.g. pixels on screen).
|
double |
getBarWidth()
Returns the width of the bars in axis coordinates.
|
boolean |
isPaintAllBars()
Returns whether all bars are filled as a whole, or if each bar is filled
independently.
|
void |
setBarHeightMin(double barHeightMin)
Sets the minimum height of the bars in view units
(e.g. pixels on screen).
|
void |
setBarWidth(double barWidth)
Sets the width of the bars in axis coordinates.
|
void |
setPaintAllBars(boolean paintAllBars)
Sets whether all bars will be filled as a whole, or if each bar will be
filled independently.
|
createDefaultAxes, createDefaultAxisRenderers, draw, getAreaRenderer, getLineRenderer, getNavigator, getPointRenderer, layoutAxes, rangeChanged, setAreaRenderer, setAxisRenderer, setLineRenderer, setPointRenderer
add, add, autoscaleAxes, clear, contains, dataAdded, dataChanged, dataRemoved, dataUpdated, drawAxes, drawLegend, get, getAxesNames, getAxis, getAxisComponent, getAxisMax, getAxisMin, getAxisRenderer, getBackground, getBorderColor, getBorderStroke, getData, getLegend, getLegendContainer, getLegendDistance, getLegendLocation, getMapping, getPlotArea, getTitle, getVisibleData, isLegendVisible, isVisible, layout, layoutLegend, refreshLegendLayout, remove, removeAxis, setAxis, setBackground, setBorderColor, setBorderStroke, setLegend, setLegendDistance, setLegendLocation, setLegendVisible, setMapping, setPlotArea, setVisible
add, add, drawComponents, getConstraints, getDrawableAt, getInsets, getLayout, getPreferredSize, iterator, remove, setBounds, setBounds, setInsets, setLayout, size
getBounds, getHeight, getWidth, getX, getY
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBounds, getHeight, getPreferredSize, getWidth, getX, getY, setBounds, setBounds
public BarPlot(DataSource... data)
data
- Data to be displayed.public void autoscaleAxis(java.lang.String axisName)
AbstractPlot
autoscaleAxis
in interface Plot
autoscaleAxis
in class AbstractPlot
axisName
- Name of the axis that should be scaled.Axis.setAutoscaled(boolean)
public void add(int index, DataSource source, boolean visible)
AbstractPlot
public double getBarWidth()
public void setBarWidth(double barWidth)
barWidth
- Width of the bars in axis coordinates.public double getBarHeightMin()
public void setBarHeightMin(double barHeightMin)
barHeightMin
- Minimum height of the bars in view units.public boolean isPaintAllBars()
true
if all bars are filled as a whole, or
false
if each bar is filled independently.public void setPaintAllBars(boolean paintAllBars)
paintAllBars
- true
to fill all bars as a whole, or
false
to fill each bar independently.