Class Legend_<ST extends Styler, S extends Series>

java.lang.Object
org.knowm.xchart.internal.chartpart.Legend_<ST,S>
All Implemented Interfaces:
ChartPart
Direct Known Subclasses:
Legend_Bubble, Legend_HeatMap, Legend_Marker, Legend_OHLC, Legend_Pie

public abstract class Legend_<ST extends Styler, S extends Series> extends Object implements ChartPart
  • Field Details

  • Constructor Details

    • Legend_

      Legend_(Chart<ST,S> chart)
      Constructor
      Parameters:
      chart -
  • Method Details

    • getSeriesLegendRenderGraphicHeight

      protected abstract double getSeriesLegendRenderGraphicHeight(S series)
    • doPaint

      protected abstract void doPaint(Graphics2D g)
    • paint

      public void paint(Graphics2D g)
      Specified by:
      paint in interface ChartPart
    • getBoundsHintVertical

      private Rectangle2D getBoundsHintVertical()
      determine the width and height of the chart legend
    • getBoundsHintHorizontal

      private Rectangle2D getBoundsHintHorizontal()
      determine the width and height of the chart legend with horizontal layout
    • getSeriesTextBounds

      Map<String, Rectangle2D> getSeriesTextBounds(S series)
      Normally each legend entry just has one line of text, but it can be made multi-line by adding "\\n". This method returns a Map for each single legend entry, which is normally just a Map with one single entry.
      Parameters:
      series -
      Returns:
    • getLegendEntryHeight

      float getLegendEntryHeight(Map<String, Rectangle2D> seriesTextBounds, int markerSize)
    • getLegendEntryWidth

      float getLegendEntryWidth(Map<String, Rectangle2D> seriesTextBounds, int markerSize)
    • paintSeriesText

      void paintSeriesText(Graphics2D g, Map<String, Rectangle2D> seriesTextBounds, int markerSize, double x, double starty)
    • getBounds

      public Rectangle2D getBounds()
      Specified by:
      getBounds in interface ChartPart