Package org.knowm.xchart.style
Class PieStyler
- java.lang.Object
-
- org.knowm.xchart.style.Styler
-
- org.knowm.xchart.style.PieStyler
-
public class PieStyler extends Styler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPieStyler.ClockwiseDirectionTypestatic classPieStyler.LabelType-
Nested classes/interfaces inherited from class org.knowm.xchart.style.Styler
Styler.ChartButtonPosition, Styler.ChartTheme, Styler.LegendLayout, Styler.LegendPosition, Styler.ToolTipType, Styler.YAxisPosition
-
-
Field Summary
Fields Modifier and Type Field Description private PieSeries.PieSeriesRenderStylechartPieSeriesRenderStyleprivate PieStyler.ClockwiseDirectionTypeclockwiseDirectionTypeprivate doubledonutThicknessprivate booleanisCircularprivate booleanisForceAllLabelsVisibleprivate booleanisLabelsFontColorAutomaticEnabledprivate booleanisLabelsVisibleprivate booleanisSumVisibleprivate doublelabelsDistanceprivate java.awt.FontlabelsFontprivate java.awt.ColorlabelsFontColorprivate java.awt.ColorlabelsFontColorAutomaticDarkprivate java.awt.ColorlabelsFontColorAutomaticLightprivate PieStyler.LabelTypelabelTypeprivate floatsliceBorderWidthprivate doublestartAngleInDegreesprivate java.awt.FontsumFontprivate java.lang.StringsumFormat
-
Constructor Summary
Constructors Constructor Description PieStyler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PieStyler.ClockwiseDirectionTypegetClockwiseDirectionType()PieSeries.PieSeriesRenderStylegetDefaultSeriesRenderStyle()doublegetDonutThickness()doublegetLabelsDistance()java.awt.FontgetLabelsFont()java.awt.ColorgetLabelsFontColor()java.awt.ColorgetLabelsFontColor(java.awt.Color backgroundColor)java.awt.ColorgetLabelsFontColorAutomaticDark()java.awt.ColorgetLabelsFontColorAutomaticLight()PieStyler.LabelTypegetLabelType()floatgetSliceBorderWidth()doublegetStartAngleInDegrees()java.awt.FontgetSumFont()java.lang.StringgetSumFormat()Access the current sumFormat value, a value of "" or null implies use the original sum formatted using the PieStyler DecimalFormat.booleanisCircular()booleanisForceAllLabelsVisible()booleanisLabelsFontColorAutomaticEnabled()booleanisLabelsVisible()booleanisSumVisible()(package private) voidsetAllStyles()PieStylersetCircular(boolean isCircular)Sets whether or not the pie chart is forced to be circular.PieStylersetClockwiseDirectionType(PieStyler.ClockwiseDirectionType clockwiseDirectionType)PieStylersetDefaultSeriesRenderStyle(PieSeries.PieSeriesRenderStyle chartPieSeriesRenderStyle)Sets the default series render style for the chart (line, scatter, area, etc.) You can override the series render style individually on each Series object.PieStylersetDonutThickness(double donutThickness)Sets the thickness of the donut ring for donut style pie chart series.PieStylersetForceAllLabelsVisible(boolean forceAllLabelsVisible)By default, only the labels that will "fit", as determined algorithmically, will be drawn.PieStylersetLabelsDistance(double labelsDistance)Sets the distance of the pie chart's annotation where 0 is the center, 1 is at the edge and greater than 1 is outside of the pie chart.PieStylersetLabelsFont(java.awt.Font labelsFont)Sets the Font used for chart annotationsPieStylersetLabelsFontColor(java.awt.Color labelsFontColor)Sets the color of the Font used for chart annotationsPieStylersetLabelsFontColorAutomaticDark(java.awt.Color labelsFontColorAutomaticDark)PieStylersetLabelsFontColorAutomaticEnabled(boolean isLabelsFontColorAutomaticEnabled)PieStylersetLabelsFontColorAutomaticLight(java.awt.Color labelsFontColorAutomaticLight)PieStylersetLabelsVisible(boolean labelsVisible)Sets if annotations should be added to charts.PieStylersetLabelType(PieStyler.LabelType labelType)Sets the Pie chart's annotation typePieStylersetSliceBorderWidth(double sliceBorderWidth)PieStylersetStartAngleInDegrees(double startAngleInDegrees)Sets the start angle in degrees.PieStylersetSumFont(java.awt.Font sumFont)Sets the font for the sum.PieStylersetSumFontSize(float sumFontSize)Sets the font size for the sum.PieStylersetSumFormat(java.lang.String sumFormat)Set the Format to be applied to the sum, the default is just to display the sum as a number using the PieStyler DecimalFormat.PieStylersetSumVisible(boolean isSumVisible)Sets whether or not the sum is visible in the centre of the pie chart.PieStylersetTheme(Theme theme)Set the theme the styler should use-
Methods inherited from class org.knowm.xchart.style.Styler
getAnnotationLineColor, getAnnotationLineStroke, getAnnotationTextFont, getAnnotationTextFontColor, getAnnotationTextPanelBackgroundColor, getAnnotationTextPanelBorderColor, getAnnotationTextPanelFont, getAnnotationTextPanelFontColor, getAnnotationTextPanelPadding, getAntiAlias, getBaseFont, getChartBackgroundColor, getChartButtonBackgroundColor, getChartButtonBorderColor, getChartButtonFont, getChartButtonFontColor, getChartButtonMargin, getChartButtonPosition, getChartFontColor, getChartPadding, getChartTitleBoxBackgroundColor, getChartTitleBoxBorderColor, getChartTitleFont, getChartTitlePadding, getDecimalPattern, getLegendBackgroundColor, getLegendBorderColor, getLegendFont, getLegendLayout, getLegendPadding, getLegendPosition, getLegendSeriesLineLength, getMarkerSize, getPlotBackgroundColor, getPlotBorderColor, getPlotContentSize, getSeriesColors, getSeriesLines, getSeriesMarkers, getShowWithinAreaPoint, getTheme, getToolTipBackgroundColor, getToolTipBorderColor, getToolTipFont, getToolTipHighlightColor, getToolTipType, getXAxisTitleColor, getYAxisGroupPosistion, getYAxisGroupTitleColor, getYAxisLeftWidthHint, getYAxisTitleColor, isChartTitleBoxVisible, isChartTitleVisible, isLegendVisible, isPlotBorderVisible, isToolTipsAlwaysVisible, isToolTipsEnabled, setAnnotationLineColor, setAnnotationLineStroke, setAnnotationTextFont, setAnnotationTextFontColor, setAnnotationTextPanelBackgroundColor, setAnnotationTextPanelBorderColor, setAnnotationTextPanelFont, setAnnotationTextPanelFontColor, setAnnotationTextPanelPadding, setAntiAlias, setBaseFont, setChartBackgroundColor, setChartButtonBackgroundColor, setChartButtonBorderColor, setChartButtonFont, setChartButtonFontColor, setChartButtonMargin, setChartButtonPosition, setChartFontColor, setChartPadding, setChartTitleBoxBackgroundColor, setChartTitleBoxBorderColor, setChartTitleBoxVisible, setChartTitleFont, setChartTitlePadding, setChartTitleVisible, setDecimalPattern, setLegendBackgroundColor, setLegendBorderColor, setLegendFont, setLegendLayout, setLegendPadding, setLegendPosition, setLegendSeriesLineLength, setLegendVisible, setMarkerSize, setPlotBackgroundColor, setPlotBorderColor, setPlotBorderVisible, setPlotContentSize, setSeriesColors, setSeriesLines, setSeriesMarkers, setShowWithinAreaPoint, setToolTipBackgroundColor, setToolTipBorderColor, setToolTipFont, setToolTipHighlightColor, setToolTipsAlwaysVisible, setToolTipsEnabled, setToolTipType, setXAxisTitleColor, setYAxisGroupPosition, setYAxisGroupTitleColor, setYAxisLeftWidthHint, setYAxisTitleColor
-
-
-
-
Field Detail
-
chartPieSeriesRenderStyle
private PieSeries.PieSeriesRenderStyle chartPieSeriesRenderStyle
-
isCircular
private boolean isCircular
-
startAngleInDegrees
private double startAngleInDegrees
-
donutThickness
private double donutThickness
-
isSumVisible
private boolean isSumVisible
-
sumFont
private java.awt.Font sumFont
-
sumFormat
private java.lang.String sumFormat
-
clockwiseDirectionType
private PieStyler.ClockwiseDirectionType clockwiseDirectionType
-
sliceBorderWidth
private float sliceBorderWidth
-
isLabelsVisible
private boolean isLabelsVisible
-
labelsFont
private java.awt.Font labelsFont
-
labelsFontColor
private java.awt.Color labelsFontColor
-
labelsDistance
private double labelsDistance
-
labelType
private PieStyler.LabelType labelType
-
isForceAllLabelsVisible
private boolean isForceAllLabelsVisible
-
isLabelsFontColorAutomaticEnabled
private boolean isLabelsFontColorAutomaticEnabled
-
labelsFontColorAutomaticLight
private java.awt.Color labelsFontColorAutomaticLight
-
labelsFontColorAutomaticDark
private java.awt.Color labelsFontColorAutomaticDark
-
-
Method Detail
-
setAllStyles
void setAllStyles()
- Overrides:
setAllStylesin classStyler
-
getDefaultSeriesRenderStyle
public PieSeries.PieSeriesRenderStyle getDefaultSeriesRenderStyle()
-
setDefaultSeriesRenderStyle
public PieStyler setDefaultSeriesRenderStyle(PieSeries.PieSeriesRenderStyle chartPieSeriesRenderStyle)
Sets the default series render style for the chart (line, scatter, area, etc.) You can override the series render style individually on each Series object.- Parameters:
chartPieSeriesRenderStyle-
-
isCircular
public boolean isCircular()
-
setCircular
public PieStyler setCircular(boolean isCircular)
Sets whether or not the pie chart is forced to be circular. Otherwise it's shape is oval, matching the containing plot.- Parameters:
isCircular-
-
getStartAngleInDegrees
public double getStartAngleInDegrees()
-
setStartAngleInDegrees
public PieStyler setStartAngleInDegrees(double startAngleInDegrees)
Sets the start angle in degrees. Zero degrees is straight up.- Parameters:
startAngleInDegrees-
-
getLabelsDistance
public double getLabelsDistance()
-
setLabelsDistance
public PieStyler setLabelsDistance(double labelsDistance)
Sets the distance of the pie chart's annotation where 0 is the center, 1 is at the edge and greater than 1 is outside of the pie chart.- Parameters:
labelsDistance-
-
getLabelType
public PieStyler.LabelType getLabelType()
-
setLabelType
public PieStyler setLabelType(PieStyler.LabelType labelType)
Sets the Pie chart's annotation type- Parameters:
labelType-
-
isForceAllLabelsVisible
public boolean isForceAllLabelsVisible()
-
setForceAllLabelsVisible
public PieStyler setForceAllLabelsVisible(boolean forceAllLabelsVisible)
By default, only the labels that will "fit", as determined algorithmically, will be drawn. Otherwise, you can end up with annotations drawn overlapping. If `drawAllAnnotations` is set true with this method, it will override the algorithmic determination, and always draw all the annotations, one for each slice. You can also try playing around with the method `setStartAngleInDegrees` so the the slices are orientated in a more optimal way. You can also try changing the font size. Also, you can order the slices so that a small slice is followed by a larger slice, while setting this method with `true`.- Parameters:
forceAllLabelsVisible-
-
getDonutThickness
public double getDonutThickness()
-
setDonutThickness
public PieStyler setDonutThickness(double donutThickness)
Sets the thickness of the donut ring for donut style pie chart series.- Parameters:
donutThickness- - Valid range is between 0 and 1.
-
isSumVisible
public boolean isSumVisible()
-
setSumFormat
public PieStyler setSumFormat(java.lang.String sumFormat)
Set the Format to be applied to the sum, the default is just to display the sum as a number using the PieStyler DecimalFormat. This allows a separate Formatter @see java.util.Formatter#format()- Parameters:
sumFormat- Format to use for the sum display, the Double sum value will be passed to this to generate the overall sum string.- Returns:
- PieStyler so that modifiers can be chained.
-
getSumFormat
public java.lang.String getSumFormat()
Access the current sumFormat value, a value of "" or null implies use the original sum formatted using the PieStyler DecimalFormat.- Returns:
- Formatter string to be used when displaying the sum value or
null
-
setSumVisible
public PieStyler setSumVisible(boolean isSumVisible)
Sets whether or not the sum is visible in the centre of the pie chart.- Parameters:
isSumVisible-
-
getSumFont
public java.awt.Font getSumFont()
-
setSumFont
public PieStyler setSumFont(java.awt.Font sumFont)
Sets the font for the sum.- Parameters:
sumFont- font
-
setSumFontSize
public PieStyler setSumFontSize(float sumFontSize)
Sets the font size for the sum.- Parameters:
sumFontSize-
-
isLabelsVisible
public boolean isLabelsVisible()
-
setLabelsVisible
public PieStyler setLabelsVisible(boolean labelsVisible)
Sets if annotations should be added to charts. Each chart type has a different annotation type- Parameters:
labelsVisible-
-
getLabelsFont
public java.awt.Font getLabelsFont()
-
setLabelsFont
public PieStyler setLabelsFont(java.awt.Font labelsFont)
Sets the Font used for chart annotations- Parameters:
labelsFont-
-
getLabelsFontColor
public java.awt.Color getLabelsFontColor()
-
getLabelsFontColor
public java.awt.Color getLabelsFontColor(java.awt.Color backgroundColor)
-
setLabelsFontColor
public PieStyler setLabelsFontColor(java.awt.Color labelsFontColor)
Sets the color of the Font used for chart annotations- Parameters:
labelsFontColor-
-
isLabelsFontColorAutomaticEnabled
public boolean isLabelsFontColorAutomaticEnabled()
-
setLabelsFontColorAutomaticEnabled
public PieStyler setLabelsFontColorAutomaticEnabled(boolean isLabelsFontColorAutomaticEnabled)
-
getLabelsFontColorAutomaticLight
public java.awt.Color getLabelsFontColorAutomaticLight()
-
setLabelsFontColorAutomaticLight
public PieStyler setLabelsFontColorAutomaticLight(java.awt.Color labelsFontColorAutomaticLight)
-
getLabelsFontColorAutomaticDark
public java.awt.Color getLabelsFontColorAutomaticDark()
-
setLabelsFontColorAutomaticDark
public PieStyler setLabelsFontColorAutomaticDark(java.awt.Color labelsFontColorAutomaticDark)
-
setTheme
public PieStyler setTheme(Theme theme)
Set the theme the styler should use- Parameters:
theme-
-
getClockwiseDirectionType
public PieStyler.ClockwiseDirectionType getClockwiseDirectionType()
-
setClockwiseDirectionType
public PieStyler setClockwiseDirectionType(PieStyler.ClockwiseDirectionType clockwiseDirectionType)
-
setSliceBorderWidth
public PieStyler setSliceBorderWidth(double sliceBorderWidth)
-
getSliceBorderWidth
public float getSliceBorderWidth()
-
-