Class HistogramPlotter
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.HistogramPlotter
-
- All Implemented Interfaces:
Plotter<HistogramPlotter.HistoStyle>
public class HistogramPlotter extends java.lang.Object implements Plotter<HistogramPlotter.HistoStyle>
Plotter for 1-dimensional histograms. This only works on plane plots.- Since:
- 8 Jan 2014
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHistogramPlotter.HistoStyleStyle subclass for histogram plots.
-
Field Summary
Fields Modifier and Type Field Description static ReportKey<BinBag>BINS_KEYReportKey for histogram bins.static ConfigKey<BinSizer>BINSIZER_KEYConfig key for bin size configuration.static ReportKey<uk.ac.starlink.table.StarTable>BINTABLE_KEYReportKey for tabular result of plot.static ReportKey<java.lang.Double>BINWIDTH_KEYReportKey for actual bin width.static ConfigKey<java.lang.Double>PHASE_KEYConfig key for bar phase.static ConfigKey<java.lang.Integer>THICK_KEYConfig key for bar line thickness.
-
Constructor Summary
Constructors Constructor Description HistogramPlotter(FloatingCoord xCoord, boolean hasWeight, PerUnitConfigKey<Unit> unitKey)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlotLayercreateLayer(DataGeom geom, DataSpec dataSpec, HistogramPlotter.HistoStyle style)The suppliedgeomis ignored.HistogramPlotter.HistoStylecreateStyle(ConfigMap config)Creates a style that can be used when creating a plot layer.CoordGroupgetCoordGroup()Returns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.java.lang.StringgetPlotterDescription()Returns an XML description of this plotter.javax.swing.IcongetPlotterIcon()Returns an icon for this plotter for use in user interface.java.lang.StringgetPlotterName()Returns the name of this plotter for use in user interface.ConfigKey<?>[]getStyleKeys()Returns the configuration keys used to configure style for this plotter.intgetWeightCoordIndex()Returns the DataSpec coord index used for the weighting data for this plotter.booleanhasReports()Indicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.
-
-
-
Field Detail
-
BINWIDTH_KEY
public static final ReportKey<java.lang.Double> BINWIDTH_KEY
ReportKey for actual bin width.
-
BINTABLE_KEY
public static final ReportKey<uk.ac.starlink.table.StarTable> BINTABLE_KEY
ReportKey for tabular result of plot.
-
BINSIZER_KEY
public static final ConfigKey<BinSizer> BINSIZER_KEY
Config key for bin size configuration.
-
THICK_KEY
public static final ConfigKey<java.lang.Integer> THICK_KEY
Config key for bar line thickness.
-
PHASE_KEY
public static final ConfigKey<java.lang.Double> PHASE_KEY
Config key for bar phase.
-
-
Constructor Detail
-
HistogramPlotter
public HistogramPlotter(FloatingCoord xCoord, boolean hasWeight, PerUnitConfigKey<Unit> unitKey)
Constructor.- Parameters:
xCoord- X axis coordinatehasWeight- true to permit histogram weightingunitKey- config key to select X axis physical units, or null if no unit selection required
-
-
Method Detail
-
getPlotterName
public java.lang.String getPlotterName()
Description copied from interface:PlotterReturns the name of this plotter for use in user interface.- Specified by:
getPlotterNamein interfacePlotter<HistogramPlotter.HistoStyle>- Returns:
- user-directed plotter name
-
getPlotterIcon
public javax.swing.Icon getPlotterIcon()
Description copied from interface:PlotterReturns an icon for this plotter for use in user interface.- Specified by:
getPlotterIconin interfacePlotter<HistogramPlotter.HistoStyle>- Returns:
- plotter icon
-
getPlotterDescription
public java.lang.String getPlotterDescription()
Description copied from interface:PlotterReturns an XML description of this plotter.Note: really this should appear at the LayerType level.
- Specified by:
getPlotterDescriptionin interfacePlotter<HistogramPlotter.HistoStyle>- Returns:
- one or more <p> elements
-
getCoordGroup
public CoordGroup getCoordGroup()
Description copied from interface:PlotterReturns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.- Specified by:
getCoordGroupin interfacePlotter<HistogramPlotter.HistoStyle>- Returns:
- coordinate group
-
getStyleKeys
public ConfigKey<?>[] getStyleKeys()
Description copied from interface:PlotterReturns the configuration keys used to configure style for this plotter. The keys in the return value are used in the map supplied to thePlotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap)method.- Specified by:
getStyleKeysin interfacePlotter<HistogramPlotter.HistoStyle>- Returns:
- keys used when creating a style for this plotter.
-
createStyle
public HistogramPlotter.HistoStyle createStyle(ConfigMap config)
Description copied from interface:PlotterCreates a style that can be used when creating a plot layer. The keys that are significant in the supplied config map are those returned byPlotter.getStyleKeys(). The return value can be used as input toPlotter.createLayer(uk.ac.starlink.ttools.plot2.DataGeom, uk.ac.starlink.ttools.plot2.data.DataSpec, S).- Specified by:
createStylein interfacePlotter<HistogramPlotter.HistoStyle>- Parameters:
config- map of style configuration items- Returns:
- plotter-specific plot style
-
hasReports
public boolean hasReports()
Description copied from interface:PlotterIndicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.- Specified by:
hasReportsin interfacePlotter<HistogramPlotter.HistoStyle>- Returns:
- true if the plot report may return interesting information
- See Also:
Drawing.getReport(java.lang.Object)
-
createLayer
public PlotLayer createLayer(DataGeom geom, DataSpec dataSpec, HistogramPlotter.HistoStyle style)
The suppliedgeomis ignored.- Specified by:
createLayerin interfacePlotter<HistogramPlotter.HistoStyle>- Parameters:
geom- indicates base position coordinates and their mapping to points in the data space; if non-null, the data geom'sDataGeom.hasPosition()method will return truedataSpec- specifies the data required for the plotstyle- data style as obtained fromcreateStyle- Returns:
- new plot layer, or null if no drawing will take place
-
getWeightCoordIndex
public int getWeightCoordIndex()
Returns the DataSpec coord index used for the weighting data for this plotter. If weighting is not supported, a negative value is returned.- Returns:
- weight coord index, or -1
-
-