/** Builds a HistogramGenerator not attached to any MASON simulation. */ public static HistogramGenerator buildHistogramGenerator(String title, String rangeAxisLabel) { HistogramGenerator chart = new HistogramGenerator(); if (title == null) title = ""; chart.setTitle(title); if (rangeAxisLabel == null) rangeAxisLabel = ""; chart.setYAxisLabel(rangeAxisLabel); return chart; }
/** Builds a HistogramGenerator and attaches it as a display in a MASON simulation. */ public static HistogramGenerator buildHistogramGenerator( GUIState state, String title, String rangeAxisLabel) { HistogramGenerator chart = buildHistogramGenerator(title, rangeAxisLabel); JFrame frame = chart.createFrame(); frame.setVisible(true); frame.pack(); state.controller.registerFrame(frame); return chart; }
/** * Adds a series to the HistogramGenerator. You also provide the default number of histogram bins. */ public static HistogramSeriesAttributes addSeries( final HistogramGenerator chart, String seriesName, final int bins) { return (HistogramSeriesAttributes) (chart.addSeries(new double[0], bins, seriesName, null)); }