Class Template


  • public final class Template
    extends java.lang.Object
    Represents a template.

    A template can be used when initializing the Chart framework to declare global options for all charts.
    For example, it can be used to declare the same color palate for all charts in one place without having to declare it multiple times.
    All these options can be also set in the Options class, and take precedence over the values set in the Template class.

    See Also:
    Chart, Options
    • Constructor Summary

      Constructors 
      Constructor Description
      Template()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String getLegendPosition()
      Returns the legend position.
      boolean isShowLegend()
      Returns true if legend has display.
      void setColors​(java.util.Set<java.awt.Color> colors)
      Sets the color of the charts.
      void setLegendPosition​(LegendPosition position)
      The legend's position, if it is set to show.
      void setNumberOfColumnsInTheLegend​(int noColumns)
      Deprecated.
      Since 2.5.0, the number of columns in the legend always is 1.
      void showGrid​(boolean show)
      Determines whether or not to show the grid.
      void showLegend​(boolean show)
      Determines whether to show the legend.
      void showTooltip​(boolean show)
      Determines whether or not to show a tool-tip on mouse hover.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Template

        public Template()
    • Method Detail

      • setColors

        public void setColors​(java.util.Set<java.awt.Color> colors)
        Sets the color of the charts.

        These colors are used for lines, points, bars or pie-chart slice, depending on the chart.
        If the chart contains more elements than defined colors, values are automatically chosen for the missing colors.

      • isShowLegend

        public boolean isShowLegend()
        Returns true if legend has display.
        Since:
        2.6.1
      • showLegend

        public void showLegend​(boolean show)
        Determines whether to show the legend.

        Default value: true.

      • getLegendPosition

        public java.lang.String getLegendPosition()
        Returns the legend position.
        Since:
        2.6.1
      • setLegendPosition

        public void setLegendPosition​(LegendPosition position)
        The legend's position, if it is set to show.

        Default value: NorthWest.

      • setNumberOfColumnsInTheLegend

        public void setNumberOfColumnsInTheLegend​(int noColumns)
        Deprecated.
        Since 2.5.0, the number of columns in the legend always is 1.
        Sets the number of columns for the legend.

        Legend entries are shown as part of a table with the specified number of columns.
        Note: When setting more than one column and item labels are long, the user will have to scroll to see other legend items.
        Default value: 1.

      • showGrid

        public void showGrid​(boolean show)
        Determines whether or not to show the grid.

        Note: The grid is composed of the axis, axis ticks, axis labels and the actual grid on the chart.
        Setting this value to false will not show the axis ticks and the axis labels even if the options are set to true, as no axis are being shown at all.
        Note: When this option is set to false points near the edges may not be completely drawn.
        Default value: true.

      • showTooltip

        public void showTooltip​(boolean show)
        Determines whether or not to show a tool-tip on mouse hover.

        Default value: false.