Class PieStyler

java.lang.Object
org.knowm.xchart.style.Styler
org.knowm.xchart.style.PieStyler

public class PieStyler extends Styler
  • Constructor Details

    • PieStyler

      public PieStyler()
  • Method Details

    • 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 void 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(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 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 Font getSumFont()
    • setSumFont

      public PieStyler setSumFont(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 Font getLabelsFont()
    • setLabelsFont

      public PieStyler setLabelsFont(Font labelsFont)
      Sets the Font used for chart annotations
      Parameters:
      labelsFont -
    • getLabelsFontColor

      public Color getLabelsFontColor()
    • getLabelsFontColor

      public Color getLabelsFontColor(Color backgroundColor)
    • setLabelsFontColor

      public PieStyler setLabelsFontColor(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 Color getLabelsFontColorAutomaticLight()
    • setLabelsFontColorAutomaticLight

      public PieStyler setLabelsFontColorAutomaticLight(Color labelsFontColorAutomaticLight)
    • getLabelsFontColorAutomaticDark

      public Color getLabelsFontColorAutomaticDark()
    • setLabelsFontColorAutomaticDark

      public PieStyler setLabelsFontColorAutomaticDark(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()