mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-04-14 14:43:33 +02:00
Dokumentation
This commit is contained in:
@@ -2,53 +2,133 @@ package schule.ngb.zm.charts;
|
|||||||
|
|
||||||
import schule.ngb.zm.Color;
|
import schule.ngb.zm.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basisimplemenation eines {@link ChartValue}.
|
||||||
|
* <p>
|
||||||
|
* Die Klasse implementiert das Interface auf die einfachste mögliche Weise als
|
||||||
|
* reine Datenhaltungsklasse. Sie wird von den Diagrammen verwendet, um reine
|
||||||
|
* Double Werte als {@code ChartValue} zu speichern.
|
||||||
|
* <p>
|
||||||
|
* Um einfach einen Datenpunkt zu erstellen, wird eine umfassende Auswahl an
|
||||||
|
* Konstruktoren angeboten.
|
||||||
|
*/
|
||||||
public class BasicChartValue implements ChartValue {
|
public class BasicChartValue implements ChartValue {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Der x-Wert diese Datenpunktes.
|
||||||
|
*/
|
||||||
private double xValue = 0;
|
private double xValue = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Der Datenwert des Datenpunktes.
|
||||||
|
*/
|
||||||
private double value;
|
private double value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Beschriftung des Datenpunktes.
|
||||||
|
*/
|
||||||
private String label = null;
|
private String label = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Farbe des Datenpunktes.
|
||||||
|
*/
|
||||||
private Color color = null;
|
private Color color = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen Datenwert.
|
||||||
|
*
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
*/
|
||||||
public BasicChartValue( double value ) {
|
public BasicChartValue( double value ) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen x- und Datenwert.
|
||||||
|
*
|
||||||
|
* @param xValue Der x-Wert.
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
*/
|
||||||
public BasicChartValue( double xValue, double value ) {
|
public BasicChartValue( double xValue, double value ) {
|
||||||
this.xValue = xValue;
|
this.xValue = xValue;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen Datenwert und der
|
||||||
|
* angegebenen Beschriftung.
|
||||||
|
*
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
* @param label Die Beschriftung.
|
||||||
|
*/
|
||||||
public BasicChartValue( double value, String label ) {
|
public BasicChartValue( double value, String label ) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen x- und Datenwert und
|
||||||
|
* der angegebenen Beschriftung.
|
||||||
|
*
|
||||||
|
* @param xValue Der x-Wert.
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
* @param label Die Beschriftung.
|
||||||
|
*/
|
||||||
public BasicChartValue( double xValue, double value, String label ) {
|
public BasicChartValue( double xValue, double value, String label ) {
|
||||||
this.xValue = xValue;
|
this.xValue = xValue;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen Datenwert und der
|
||||||
|
* angegebenen Farbe.
|
||||||
|
*
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
* @param color Die Farbe.
|
||||||
|
*/
|
||||||
public BasicChartValue( double value, Color color ) {
|
public BasicChartValue( double value, Color color ) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen x- und Datenwert und
|
||||||
|
* der angegebenen Farbe.
|
||||||
|
*
|
||||||
|
* @param xValue Der x-Wert.
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
* @param color Die Farbe.
|
||||||
|
*/
|
||||||
public BasicChartValue( double xValue, double value, Color color ) {
|
public BasicChartValue( double xValue, double value, Color color ) {
|
||||||
this.xValue = xValue;
|
this.xValue = xValue;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen Datenwert, der
|
||||||
|
* angegebenen Beschriftung und Farbe.
|
||||||
|
*
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
* @param label Die Beschriftung.
|
||||||
|
* @param color Die Farbe.
|
||||||
|
*/
|
||||||
public BasicChartValue( double value, String label, Color color ) {
|
public BasicChartValue( double value, String label, Color color ) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstellt einen neuen Datenpunkt mit dem angegebenen x- und Datenwert, der
|
||||||
|
* angegebenen Beschriftung und Farbe.
|
||||||
|
*
|
||||||
|
* @param xValue Der x-Wert.
|
||||||
|
* @param value Der Datenwert.
|
||||||
|
* @param label Die Beschriftung.
|
||||||
|
* @param color Die Farbe.
|
||||||
|
*/
|
||||||
public BasicChartValue( double xValue, double value, String label, Color color ) {
|
public BasicChartValue( double xValue, double value, String label, Color color ) {
|
||||||
this.xValue = xValue;
|
this.xValue = xValue;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
@@ -56,36 +136,57 @@ public class BasicChartValue implements ChartValue {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public double getX() {
|
public double getX() {
|
||||||
return xValue;
|
return xValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public double getValue() {
|
public double getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setValue( double pValue ) {
|
public void setValue( double pValue ) {
|
||||||
this.value = pValue;
|
this.value = pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setLabel( String pLabel ) {
|
public void setLabel( String pLabel ) {
|
||||||
this.label = pLabel;
|
this.label = pLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setColor( Color pColor ) {
|
public void setColor( Color pColor ) {
|
||||||
this.color = pColor;
|
this.color = pColor;
|
||||||
|
|||||||
@@ -12,16 +12,23 @@ public interface ChartValue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt den x-Wert des Datenpunktes zurück. Nicht alle Diagrammarten
|
* Gibt den x-Wert des Datenpunktes zurück. Nicht alle Diagrammarten
|
||||||
* benötigen einen x-Wert und ignorieren diesen. Soll die Klasse nur in
|
* benötigen einen x-Wert und ignorieren diesen dann gegebenenfalls. Soll
|
||||||
* Diagrammen ohne x-Wert (zum Beispiel Kreis- oder Balkendiagramm)
|
* die Klasse nur in Diagrammen ohne x-Wert (zum Beispiel
|
||||||
* dargestellt werden, wird empfohlen, dass immer 0 zurückgegeben wird.
|
* {@link PieChart Kreis-} oder {@link BarChart Balkendiagramm}) dargestellt
|
||||||
|
* werden, wird empfohlen, dass immer {@code 0} zurückgegeben wird.
|
||||||
*
|
*
|
||||||
* @return Der x-Wert des Datenpunktes.
|
* @return Der x-Wert des Datenpunktes.
|
||||||
*/
|
*/
|
||||||
double getX();
|
double getX();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt den Datenwertert des Datenpunktes zurück.
|
* Gibt den Datenwert des Datenpunktes zurück.
|
||||||
|
* <p>
|
||||||
|
* Der Datenwert wird je nach Diagrammtyp anders interpretiert. In
|
||||||
|
* {@link LineChart}s wird er im Zusammenhang mit dem {@link #getX() x-Wert}
|
||||||
|
* als y-Wert eines Datenpunktes genommen. In
|
||||||
|
* {@link PieChart Kreisdiagrammen} wird er als Anteil des Datums im Kreis
|
||||||
|
* verstanden.
|
||||||
*
|
*
|
||||||
* @return Der Wert des Datenpunktes.
|
* @return Der Wert des Datenpunktes.
|
||||||
*/
|
*/
|
||||||
@@ -29,6 +36,7 @@ public interface ChartValue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ändert den Datenwert dieses Datenpunktes.
|
* Ändert den Datenwert dieses Datenpunktes.
|
||||||
|
*
|
||||||
* @param pValue
|
* @param pValue
|
||||||
*/
|
*/
|
||||||
void setValue( double pValue );
|
void setValue( double pValue );
|
||||||
@@ -44,6 +52,7 @@ public interface ChartValue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ändert die Beschriftung dieses Datenpunktes.
|
* Ändert die Beschriftung dieses Datenpunktes.
|
||||||
|
*
|
||||||
* @param pLabel Die neue Beschriftung.
|
* @param pLabel Die neue Beschriftung.
|
||||||
*/
|
*/
|
||||||
void setLabel( String pLabel );
|
void setLabel( String pLabel );
|
||||||
@@ -59,6 +68,7 @@ public interface ChartValue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ändert die Farbe dieses Datenpunktes.
|
* Ändert die Farbe dieses Datenpunktes.
|
||||||
|
*
|
||||||
* @param pColor Die neue Farbe.
|
* @param pColor Die neue Farbe.
|
||||||
*/
|
*/
|
||||||
void setColor( Color pColor );
|
void setColor( Color pColor );
|
||||||
|
|||||||
Reference in New Issue
Block a user