Package visualizationElements
Klasse BarChart
java.lang.Object
visualizationElements.VisualizationElement
visualizationElements.BarChart
Represents a bar chart to visualize sort algorithms.
-
Feldübersicht
Modifizierer und TypFeldBeschreibungprivate int
private static final int
private int
private Vector
<BarChartElement> private int
-
Konstruktorübersicht
KonstruktorBeschreibungBarChart
(Vector<BarChartElement> values, int width, int heigth) Creates a new BarChart.BarChart
(BarChartElement[] values, int width, int heigth) Creates a new BarChart. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprivate int
calculateBarHeight
(BarChartElement barChartElement) Calculates the height of the bar dependent of the height and value.void
Draws the visualization element.int
int
getWidth()
void
setHeight
(int height) void
setValues
(Vector<BarChartElement> values) void
setWidth
(int width)
-
Felddetails
-
START_X_POS
private static final int START_X_POS- Siehe auch:
-
values
-
width
private int width -
height
private int height -
startYPos
private int startYPos
-
-
Konstruktordetails
-
BarChart
Creates a new BarChart.- Parameter:
values
- Vector with values to show as bars in the BarChart.width
- Width of the BarChart.heigth
- Height of the BarChart.
-
BarChart
Creates a new BarChart.- Parameter:
values
- Array with values to show as bars in the BarChart.width
- Width of the BarChart.heigth
- Height of the BarChart.
-
-
Methodendetails
-
draw
Beschreibung aus Klasse kopiert:VisualizationElement
Draws the visualization element.- Angegeben von:
draw
in KlasseVisualizationElement
- Parameter:
g
- The Graphics object to draw the element to the DrawArea.
-
calculateBarHeight
Calculates the height of the bar dependent of the height and value. Ensures that no bar is drawn downwards if the window is resized.- Parameter:
barChartElement
- The BarChartElement the height is calculated for.- Gibt zurück:
- Returns how high the bar should be drawn.
-
setValues
- Parameter:
values
- the values to set
-
getValues
- Gibt zurück:
- the values
-
setWidth
public void setWidth(int width) - Parameter:
width
- the width to set
-
getWidth
public int getWidth()- Gibt zurück:
- the width
-
setHeight
public void setHeight(int height) - Parameter:
height
- the height to set
-
getHeight
public int getHeight()- Gibt zurück:
- the height
-