Package net.sourceforge.chart2d
Class Chart2DProperties
java.lang.Object
net.sourceforge.chart2d.Chart2DProperties
A data structure for holding the properties common to all Chart2D charts.
Chart2D charts are all capable of having a legend.
Pass this to any number of Chart2D objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default is true.static final intThe default is 5.static final intThe default is MAX_INTEGER.static final intThe number is -38.static final intThe number is 38. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a Chart2DProperties object with the documented default values.Chart2DProperties(Chart2DProperties chart2DProps) Creates a Chart2DProperties object with property values copied from another object. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanGets whether the gap between the chart and the legend exists.final intGets the thickness of the gap between the chart and the legend for the chart's model size.final intGets the look of labels that are supposed to describe the value of the data.final booleanisFontNameExists(String name) Returns true if the font name exists in the graphics enviornment.final voidsetChart2DProperties(Chart2DProperties chart2DProps) Sets all properties to be the values of another Chart2DProperties object.final voidSets all properties to their default values.final voidsetChartBetweenChartAndLegendGapExistence(boolean existence) Sets whether the gap between the chart and the legend exists.final voidsetChartBetweenChartAndLegendGapThicknessModel(int thickness) Sets the thickness of the gap between the chart and the legend for the chart's model size.final voidsetChartDataLabelsPrecision(int precision) Sets the look of labels that are supposed to describe the value of the data.
-
Field Details
-
MAX_INTEGER
public static final int MAX_INTEGERThe number is 38.- See Also:
-
MAX_FLOAT
public static final int MAX_FLOATThe number is -38.- See Also:
-
CHART_DATA_LABELS_PRECISION_DEFAULT
public static final int CHART_DATA_LABELS_PRECISION_DEFAULTThe default is MAX_INTEGER.- See Also:
-
CHART_BETWEEN_CHART_AND_LEGEND_GAP_EXISTENCE_DEFAULT
public static final boolean CHART_BETWEEN_CHART_AND_LEGEND_GAP_EXISTENCE_DEFAULTThe default is true.- See Also:
-
CHART_BETWEEN_CHART_AND_LEGEND_GAP_THICKNESS_MODEL_DEFAULT
public static final int CHART_BETWEEN_CHART_AND_LEGEND_GAP_THICKNESS_MODEL_DEFAULTThe default is 5.- See Also:
-
-
Constructor Details
-
Chart2DProperties
public Chart2DProperties()Creates a Chart2DProperties object with the documented default values. -
Chart2DProperties
Creates a Chart2DProperties object with property values copied from another object. The copying is a deep copy.- Parameters:
chart2DProps- The properties to copy.
-
-
Method Details
-
setChart2DPropertiesToDefaults
public final void setChart2DPropertiesToDefaults()Sets all properties to their default values. -
setChart2DProperties
Sets all properties to be the values of another Chart2DProperties object. The copying is a deep copy.- Parameters:
chart2DProps- The properties to copy.
-
setChartDataLabelsPrecision
public final void setChartDataLabelsPrecision(int precision) Sets the look of labels that are supposed to describe the value of the data. For example, for pie charts this method will influence the labels that surround the chart, and for charts with axes this method will influence the labels on the numbers axis. The specific labels are first determined from the greatest and least value in the data set and other factors. This method then lets you adjust whether you want integer or floating point labels and how exact you want those labels to be. You do this using the precision parameter, and passing values between 38 and -38. Nonnegative ints indicate the labels will not contain a decimal (ie will be integer labels), and the specific nonnegative number indicates how many zeroes will be to the left of the decimal if it were there (ex. for the number 1976, a precision of 0 would return 1976, a precision of 1 would return 1980, a precision of 3 would return 2000, and a precision greater than 3 would also return 2000). If the number of desired zeroes is greater than the label, then the number of zeroes is automatically scaled back to be 1 less than the number of digits. Negative ints for precision indicate the labels will contain a decimal, and the specific negative number indicates how many digits to the right of the decimal are wanted (ex. for the number 1.935, a precision of -1 would return 1.9, a precision of -2 would return 1.94, a precision of -4 would return 1.9350). If the number of desired decimal places is larger than the number of places present in the number, then zeroes are added to form as many places as are desired up to -38. MAX_INTEGER or MAX_FLOAT will always indicate the maximum number of zeroes and the maximum number of decimal places possible by Chart2D's algorithm for adjusting these labels.- Parameters:
precision- The adjustement of the precision of numbers labels.
-
setChartBetweenChartAndLegendGapExistence
public final void setChartBetweenChartAndLegendGapExistence(boolean existence) Sets whether the gap between the chart and the legend exists. If the legend doesn't exist, this gap will automatically not exist.- Parameters:
existence- If true, the gap exists.
-
setChartBetweenChartAndLegendGapThicknessModel
public final void setChartBetweenChartAndLegendGapThicknessModel(int thickness) Sets the thickness of the gap between the chart and the legend for the chart's model size.- Parameters:
thickness- The model thickness of the gap.
-
getChartDataLabelsPrecision
public final int getChartDataLabelsPrecision()Gets the look of labels that are supposed to describe the value of the data. For example, for pie charts this method will influence the labels that surround the chart, and for charts with axes this method will influence the labels on the numbers axis. The specific labels are first determined from the greatest and least value in the data set and other factors. This method then lets you adjust whether you want integer or floating point labels and how exact you want those labels to be. You do this using the precision parameter, and passing values between 8 and -8. Nonnegative ints indicate the labels will not contain a decimal (ie will be integer labels), and the specific nonnegative number indicates how many zeroes will be to the left of the decimal if it were there (ex. for the number 1976, a precision of 0 would return 1976, a precision of 1 would return 1980, a precision of 3 would return 2000, and a precision greater than 3 would also return 2000). If the number of desired zeroes is greater than the label, then the number of zeroes is automatically scaled back to be 1 less than the number of digits. Negative ints for precision indicate the labels will contain a decimal, and the specific negative number indicates how many digits to the right of the decimal are wanted (ex. for the number 1.935, a precision of -1 would return 1.9, a precision of -2 would return 1.94, a precision of -4 would return 1.9350). If the number of desired decimal places is larger than the number of places present in the number, then zeroes are added to form as many places as are desired up to -8. MAX_INTEGER or MAX_FLOAT will always indicate the maximum number of zeroes and the maximum number of decimal places possible by Chart2D's algorithm for adjusting these labels.- Returns:
- The adjustement of the precision of numbers labels.
-
getChartBetweenChartAndLegendGapExistence
public final boolean getChartBetweenChartAndLegendGapExistence()Gets whether the gap between the chart and the legend exists. If the legend doesn't exist, this gap will automatically not exist.- Returns:
- If true, the gap exists.
-
getChartBetweenChartAndLegendGapThicknessModel
public final int getChartBetweenChartAndLegendGapThicknessModel()Gets the thickness of the gap between the chart and the legend for the chart's model size.- Returns:
- The model thickness of the gap.
-
isFontNameExists
Returns true if the font name exists in the graphics enviornment.- Parameters:
name- The name of the font to determine the existence of.- Returns:
- boolean If true, then the font name exists.
-