Java 类org.jfree.chart.renderer.xy.XYBarRenderer 实例源码

项目:iveely.ml    文件:ChartUtils.java   
public static void setTimeSeriesBarRender(Plot plot, boolean isShowDataLabels) {

        XYPlot xyplot = (XYPlot) plot;
        xyplot.setNoDataMessage(NO_DATA_MSG);

        XYBarRenderer xyRenderer = new XYBarRenderer(0.1D);
        xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());

        if (isShowDataLabels) {
            xyRenderer.setBaseItemLabelsVisible(true);
            xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        }

        StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
        xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);
        setXY_XAixs(xyplot);
        setXY_YAixs(xyplot);

    }
项目:rapidminer    文件:DateTimeAttributeStatisticsModel.java   
/**
 * Creates the histogram chart.
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(final ExampleSet exampleSet) {
    JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
            PlotOrientation.VERTICAL, false, false, false);
    AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
    chart.setBackgroundPaint(null);
    chart.setBackgroundImageAlpha(0.0f);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);
    plot.setOutlineVisible(false);
    plot.setRangeZeroBaselineVisible(false);
    plot.setDomainZeroBaselineVisible(false);
    plot.getDomainAxis().setTickLabelsVisible(false);
    plot.setBackgroundPaint(COLOR_INVISIBLE);
    plot.setBackgroundImageAlpha(0.0f);

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.DATE_TIME));
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setDrawBarOutline(true);
    renderer.setShadowVisible(false);

    return chart;
}
项目:rapidminer    文件:NumericalAttributeStatisticsModel.java   
/**
 * Creates the histogram chart.
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(ExampleSet exampleSet) {
    JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
            PlotOrientation.VERTICAL, false, false, false);
    AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
    chart.setBackgroundPaint(null);
    chart.setBackgroundImageAlpha(0.0f);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);
    plot.setOutlineVisible(false);
    plot.setRangeZeroBaselineVisible(false);
    plot.setDomainZeroBaselineVisible(false);
    plot.setBackgroundPaint(COLOR_INVISIBLE);
    plot.setBackgroundImageAlpha(0.0f);

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NUMERICAL));
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setDrawBarOutline(true);
    renderer.setShadowVisible(false);

    return chart;
}
项目:ccu-historian    文件:XYPlotTest.java   
/**
 * Tests cloning for a more complex plot.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
            new NumberAxis("Range Axis"), new StandardXYItemRenderer());
    p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
    List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
            new Integer(1)});
    p1.mapDatasetToDomainAxes(0, axisIndices);
    p1.mapDatasetToRangeAxes(0, axisIndices);
    p1.setRenderer(1, new XYBarRenderer());
    XYPlot p2 = (XYPlot) p1.clone();
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));
}
项目:ccu-historian    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:jfreechart    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme ({@code null} not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtils#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    Args.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:jfreechart    文件:XYPlotTest.java   
/**
 * Tests cloning for a more complex plot.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
            new NumberAxis("Range Axis"), new StandardXYItemRenderer());
    p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
    List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
            new Integer(1)});
    p1.mapDatasetToDomainAxes(0, axisIndices);
    p1.mapDatasetToRangeAxes(0, axisIndices);
    p1.setRenderer(1, new XYBarRenderer());
    XYPlot p2 = (XYPlot) p1.clone();
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));
}
项目:hmftools    文件:CopyNumberCharts.java   
@NotNull
static JFreeChart copyNumberPDF(@NotNull final List<PurpleCopyNumber> copyNumbers) {
    final XYDataset dataset = ploidyPDF(copyNumbers, PurpleCopyNumber::averageTumorCopyNumber, PurpleCopyNumber::bafCount);
    JFreeChart chart =
            ChartFactory.createScatterPlot("Copy Number PDF", "Ploidy", "BAF Count", dataset, PlotOrientation.VERTICAL, false, false,
                    false);

    XYBarRenderer renderer = new XYBarRenderer(0.9);
    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setSeriesPaint(0, Color.BLUE);

    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.getDomainAxis().setRange(0, 10);
    xyPlot.setRenderer(renderer);
    return chart;
}
项目:jasperreports    文件:EyeCandySixtiesChartTheme.java   
@Override
protected JFreeChart createXYBarChart() throws JRException
{
    JFreeChart jfreeChart = super.createXYBarChart();
    XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
    XYBarRenderer renderer = (XYBarRenderer)xyPlot.getRenderer();
    renderer.setMargin(0.1);
    renderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)
            );
    XYDataset xyDataset = xyPlot.getDataset();
    if (xyDataset != null)
    {
        for (int i = 0; i < xyDataset.getSeriesCount(); i++)
        {
            renderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
        }
    }
    return jfreeChart;
}
项目:aya-lang    文件:XYPlotTest.java   
/**
 * Tests cloning for a more complex plot.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
            new NumberAxis("Range Axis"), new StandardXYItemRenderer());
    p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
    List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
            new Integer(1)});
    p1.mapDatasetToDomainAxes(0, axisIndices);
    p1.mapDatasetToRangeAxes(0, axisIndices);
    p1.setRenderer(1, new XYBarRenderer());
    XYPlot p2 = (XYPlot) p1.clone();
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));
}
项目:aya-lang    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:rapidminer-studio    文件:DateTimeAttributeStatisticsModel.java   
/**
 * Creates the histogram chart.
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(final ExampleSet exampleSet) {
    JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
            PlotOrientation.VERTICAL, false, false, false);
    AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
    chart.setBackgroundPaint(null);
    chart.setBackgroundImageAlpha(0.0f);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);
    plot.setOutlineVisible(false);
    plot.setRangeZeroBaselineVisible(false);
    plot.setDomainZeroBaselineVisible(false);
    plot.getDomainAxis().setTickLabelsVisible(false);
    plot.setBackgroundPaint(COLOR_INVISIBLE);
    plot.setBackgroundImageAlpha(0.0f);

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.DATE_TIME));
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setDrawBarOutline(true);
    renderer.setShadowVisible(false);

    return chart;
}
项目:rapidminer-studio    文件:NumericalAttributeStatisticsModel.java   
/**
 * Creates the histogram chart.
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(ExampleSet exampleSet) {
    JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
            PlotOrientation.VERTICAL, false, false, false);
    AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
    chart.setBackgroundPaint(null);
    chart.setBackgroundImageAlpha(0.0f);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);
    plot.setOutlineVisible(false);
    plot.setRangeZeroBaselineVisible(false);
    plot.setDomainZeroBaselineVisible(false);
    plot.setBackgroundPaint(COLOR_INVISIBLE);
    plot.setBackgroundImageAlpha(0.0f);

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NUMERICAL));
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setDrawBarOutline(true);
    renderer.setShadowVisible(false);

    return chart;
}
项目:eurocarbdb    文件:PeakListChartPanel.java   
protected void initComponents() {
setLayout(new BorderLayout());

// create chart
theDataset = new DefaultXYDataset();
theIsotopesDataset = new DefaultXYDataset();

theChart = org.jfree.chart.ChartFactory.createScatterPlot("PeakList", "m/z ratio", "Intensity", new XYBarDataset(theDataset,0.001), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false);
thePlot = (XYPlot)theChart.getPlot();
thePlot.setRenderer(new XYBarRenderer());

thePlot.setDataset(1, theIsotopesDataset);
thePlot.setRenderer(1,new StandardXYItemRenderer(StandardXYItemRenderer.LINES));

theChartPanel = new ChartPanel(theChart);    
theChartPanel.setDomainZoomable(false);
theChartPanel.setRangeZoomable(false);    
theChartPanel.setPopupMenu(null);
add(theChartPanel,BorderLayout.CENTER);

// create toolbar
theToolBar = createToolBar(); 
add(theToolBar,BorderLayout.SOUTH);    
}
项目:HTML5_WebSite    文件:StandardChartTheme.java   
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToXYItemRenderer(XYItemRenderer renderer) {
    if (renderer == null) {
        throw new IllegalArgumentException("Null 'renderer' argument.");
    }
    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }
    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);
    if (renderer instanceof XYBarRenderer) {
        XYBarRenderer br = (XYBarRenderer) renderer;
        br.setBarPainter(this.xyBarPainter);
        br.setShadowVisible(this.shadowVisible);
    }
}
项目:SMVHunter    文件:DisplaySyncHistogram.java   
/**
 * Resets the display.
 */
@Override
void resetUI() {
    super.resetUI();
    XYPlot xyPlot = mChart.getXYPlot();

    AbstractXYItemRenderer br = new XYBarRenderer();
    mDatasetsSyncHist = new TimePeriodValues[NUM_AUTHS+1];

    @SuppressWarnings("unchecked")
    Map<SimpleTimePeriod, Integer> mTimePeriodMapTmp[] = new HashMap[NUM_AUTHS + 1];
    mTimePeriodMap = mTimePeriodMapTmp;

    TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection();
    xyPlot.setDataset(tpvc);
    xyPlot.setRenderer(br);

    for (int i = 0; i < NUM_AUTHS + 1; i++) {
        br.setSeriesPaint(i, AUTH_COLORS[i]);
        mDatasetsSyncHist[i] = new TimePeriodValues(AUTH_NAMES[i]);
        tpvc.addSeries(mDatasetsSyncHist[i]);
        mTimePeriodMap[i] = new HashMap<SimpleTimePeriod, Integer>();

    }
}
项目:populus    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:openreports    文件:ChartReportEngine.java   
private JFreeChart createXYBarChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
    XYDataset dataset = createXYDataset(values);

    NumberAxis xAxis = new NumberAxis(reportChart.getXAxisLabel());
    NumberAxis yAxis = new NumberAxis(reportChart.getYAxisLabel());

    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setToolTipGenerator(new StandardXYToolTipGenerator());

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);
    if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
    {
        plot.setOrientation(PlotOrientation.HORIZONTAL);
    }

    return new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());
}
项目:openreports    文件:ChartReportEngine.java   
private JFreeChart createTimeBarChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
    JFreeChart chart = null;

    XYDataset dataset = createTimeDataset(values);

    ValueAxis timeAxis = new DateAxis(reportChart.getXAxisLabel());
    NumberAxis valueAxis = new NumberAxis(reportChart.getYAxisLabel());

    XYItemRenderer renderer = new XYBarRenderer();
    renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());

    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);
    if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
    {
        plot.setOrientation(PlotOrientation.HORIZONTAL);
    }

    chart = new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());

    return chart;
}
项目:solrmeter    文件:QueryTimeHistoryPanel.java   
/**
 * Creates and initializes the chart panel.
 */
public ChartPanel createChartPanel() {
    XYBarDataset barDataset = new XYBarDataset(dataset, BAR_WIDTH);
    NumberAxis xaxis = new NumberAxis(I18n.get("statistic.queryTimeHistoryPanel.time"));
    NumberAxis yaxis = new NumberAxis(I18n.get("statistic.queryTimeHistoryPanel.averageQueryTime"));

    xaxis.setStandardTickUnits(new ChartUtils.LowerBoundedTickUnitSource(xaxis.getStandardTickUnits(), LOWER_TICK_UNIT));

    XYPlot plot = new XYPlot(barDataset, xaxis, yaxis, new XYBarRenderer());

    JFreeChart chart = new JFreeChart(I18n.get("statistic.queryTimeHistoryPanel.queryHistory"),
            null, plot, false);

    ChartPanel chartPanel = new ChartPanel(chart);

    chartPanel.setBorder(CHART_BORDER);
    chartPanel.setMinimumDrawHeight(0);
    chartPanel.setMinimumDrawWidth(0);
    chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
    chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);

    return chartPanel;
}
项目:solrmeter    文件:HistogramChartPanel.java   
private Component createChartPanel() {
    XYBarDataset xyBarDataset = new XYBarDataset(xyDataset, BAR_WIDTH);
    NumberAxis xaxis = new NumberAxis(I18n.get("statistic.histogramChartPanel.time"));
    NumberAxis yaxis = new NumberAxis(I18n.get("statistic.histogramChartPanel.numberOfQueries"));

    xaxis.setStandardTickUnits(new ChartUtils.LowerBoundedTickUnitSource(xaxis.getStandardTickUnits(), LOWER_TICK_UNIT));

    XYPlot plot = new XYPlot(xyBarDataset, xaxis, yaxis, new XYBarRenderer());

    JFreeChart chart = new JFreeChart(I18n.get(
            "statistic.histogramChartPanel.title"),
            null, plot, false);

    ChartPanel chartPanel = new ChartPanel(chart);

    chartPanel.setBorder(CHART_BORDER);
    chartPanel.setMinimumDrawHeight(0);
    chartPanel.setMinimumDrawWidth(0);
    chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
    chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);

    return chartPanel;
}
项目:PI    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    if (theme == null) {
        throw new IllegalArgumentException("Null 'theme' argument.");
    }
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:PI    文件:StandardChartTheme.java   
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToXYItemRenderer(XYItemRenderer renderer) {
    if (renderer == null) {
        throw new IllegalArgumentException("Null 'renderer' argument.");
    }
    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }
    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);
    if (renderer instanceof XYBarRenderer) {
        XYBarRenderer br = (XYBarRenderer) renderer;
        br.setBarPainter(this.xyBarPainter);
        br.setShadowVisible(this.shadowVisible);
    }
}
项目:gama    文件:ChartJFreeChartOutputHistogram.java   
public static void enableFlatLook(final boolean flat) {
    if (flat) {
        BarRenderer.setDefaultBarPainter(new StandardBarPainter());
        BarRenderer.setDefaultShadowsVisible(false);
        XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        XYBarRenderer.setDefaultShadowsVisible(false);
        StackedBarRenderer.setDefaultBarPainter(new StandardBarPainter());
        StackedBarRenderer.setDefaultShadowsVisible(false);
    } else {
        BarRenderer.setDefaultBarPainter(new GradientBarPainter());
        BarRenderer.setDefaultShadowsVisible(true);
        XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        XYBarRenderer.setDefaultShadowsVisible(true);
        StackedBarRenderer.setDefaultBarPainter(new GradientBarPainter());
        StackedBarRenderer.setDefaultShadowsVisible(true);
    }
}
项目:PSimulacion    文件:dlgGraf.java   
private JFreeChart crearHistograma(IntervalXYDataset datos) {
    JFreeChart jfreechart = ChartFactory.
            createHistogram("Histograma", "X","Y", datos, PlotOrientation.VERTICAL, false, false, false);
            //createHistogram("Histograma", "X","Y", datos, PlotOrientation.VERTICAL, false, false, false);
           //createXYBarChart("Histograma", "X", false, "Y", datos, PlotOrientation.VERTICAL, false, false, false);

    //jfreechart.getCategoryPlot();
    jfreechart.getPlot().setOutlinePaint(Color.black);
    XYPlot cp=(XYPlot)jfreechart.getPlot();
    XYBarRenderer renderer=(XYBarRenderer)cp.getRenderer();

    cp.setWeight(80);


    renderer.setSeriesPaint(0,Color.GRAY);
    jfreechart.setAntiAlias(true);
    jfreechart.setBackgroundPaint(Color.white);

    return jfreechart;
}
项目:nabs    文件:XYPlotTests.java   
/**
 * Tests cloning for a more complex plot.
 */
public void testCloning2() {
    XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"), 
            new NumberAxis("Range Axis"), new StandardXYItemRenderer());
    p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
    p1.setRenderer(1, new XYBarRenderer());
    XYPlot p2 = null;
    try {
        p2 = (XYPlot) p1.clone();
    }
    catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));
}
项目:ECG-Viewer    文件:XYPlotTest.java   
/**
 * Tests cloning for a more complex plot.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
            new NumberAxis("Range Axis"), new StandardXYItemRenderer());
    p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
    List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
            new Integer(1)});
    p1.mapDatasetToDomainAxes(0, axisIndices);
    p1.mapDatasetToRangeAxes(0, axisIndices);
    p1.setRenderer(1, new XYBarRenderer());
    XYPlot p2 = (XYPlot) p1.clone();
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));
}
项目:ECG-Viewer    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:astor    文件:XYBarRendererTests.java   
/**
 * A simple test for the findRangeBounds() method.
 */
public void testFindRangeBounds() {
    DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
    double[] x = {1.0, 2.0, 3.0, 4.0};
    double[] startx = {0.9, 1.8, 2.7, 3.6};
    double[] endx = {1.1, 2.2, 3.3, 4.4};
    double[] y = {1.0, 2.0, 3.0, 4.0};
    double[] starty = {0.9, 1.8, 2.7, 3.6};
    double[] endy = {1.1, 2.2, 3.3, 4.4};
    double[][] data = new double[][] {x, startx, endx, y, starty, endy};
    dataset.addSeries("Series 1", data);
    XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    Range r = renderer.findRangeBounds(dataset);
    assertEquals(0.9, r.getLowerBound(), EPSILON);
    assertEquals(4.4, r.getUpperBound(), EPSILON);

    renderer.setUseYInterval(false);
    r = renderer.findRangeBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(4.0, r.getUpperBound(), EPSILON);
}
项目:astor    文件:XYPlotTests.java   
/**
 * Tests cloning for a more complex plot.
 */
public void testCloning2() {
    XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
            new NumberAxis("Range Axis"), new StandardXYItemRenderer());
    p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
    List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
            new Integer(1)});
    p1.mapDatasetToDomainAxes(0, axisIndices);
    p1.mapDatasetToRangeAxes(0, axisIndices);
    p1.setRenderer(1, new XYBarRenderer());
    XYPlot p2 = null;
    try {
        p2 = (XYPlot) p1.clone();
    }
    catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));
}
项目:astor    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    if (theme == null) {
        throw new IllegalArgumentException("Null 'theme' argument.");
    }
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:astor    文件:ChartFactory.java   
/**
 * Creates a histogram chart.  This chart is constructed with an
 * {@link XYPlot} using an {@link XYBarRenderer}.  The domain and range
 * axes are {@link NumberAxis} instances.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  the x axis label (<code>null</code> permitted).
 * @param yAxisLabel  the y axis label (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param legend  create a legend?
 *
 * @return The chart.
 */
public static JFreeChart createHistogram(String title, String xAxisLabel,
        String yAxisLabel, IntervalXYDataset dataset, boolean legend) {

    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);
    XYItemRenderer renderer = new XYBarRenderer();
    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
项目:astor    文件:StandardChartTheme.java   
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToXYItemRenderer(XYItemRenderer renderer) {
    if (renderer == null) {
        throw new IllegalArgumentException("Null 'renderer' argument.");
    }
    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }
    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);
    if (renderer instanceof XYBarRenderer) {
        XYBarRenderer br = (XYBarRenderer) renderer;
        br.setBarPainter(this.xyBarPainter);
        br.setShadowVisible(this.shadowVisible);
    }
}
项目:ControlAndroidDeviceFromPC    文件:DisplaySyncHistogram.java   
/**
 * Resets the display.
 */
@Override
void resetUI() {
    super.resetUI();
    XYPlot xyPlot = mChart.getXYPlot();

    AbstractXYItemRenderer br = new XYBarRenderer();
    mDatasetsSyncHist = new TimePeriodValues[NUM_AUTHS+1];

    @SuppressWarnings("unchecked")
    Map<SimpleTimePeriod, Integer> mTimePeriodMapTmp[] = new HashMap[NUM_AUTHS + 1];
    mTimePeriodMap = mTimePeriodMapTmp;

    TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection();
    xyPlot.setDataset(tpvc);
    xyPlot.setRenderer(br);

    for (int i = 0; i < NUM_AUTHS + 1; i++) {
        br.setSeriesPaint(i, AUTH_COLORS[i]);
        mDatasetsSyncHist[i] = new TimePeriodValues(AUTH_NAMES[i]);
        tpvc.addSeries(mDatasetsSyncHist[i]);
        mTimePeriodMap[i] = new HashMap<SimpleTimePeriod, Integer>();

    }
}
项目:imagej-ui-swing    文件:SwingHistogramWidget.java   
private final void setTheme(final JFreeChart chart) {
    final XYPlot plot = (XYPlot) chart.getPlot();
    final XYBarRenderer r = (XYBarRenderer) plot.getRenderer();
    final StandardXYBarPainter bp = new StandardXYBarPainter();
    r.setBarPainter(bp);
    r.setSeriesOutlinePaint(0, Color.lightGray);
    r.setShadowVisible(false);
    r.setDrawBarOutline(false);
    setBackgroundDefault(chart);
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();

    // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setTickLabelsVisible(false);
    rangeAxis.setTickMarksVisible(false);
    final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setTickLabelsVisible(false);
    domainAxis.setTickMarksVisible(false);
}
项目:group-five    文件:XYPlotTest.java   
/**
 * Tests cloning for a more complex plot.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"),
            new NumberAxis("Range Axis"), new StandardXYItemRenderer());
    p1.setRangeAxis(1, new NumberAxis("Range Axis 2"));
    List axisIndices = Arrays.asList(new Integer[] {new Integer(0),
            new Integer(1)});
    p1.mapDatasetToDomainAxes(0, axisIndices);
    p1.mapDatasetToRangeAxes(0, axisIndices);
    p1.setRenderer(1, new XYBarRenderer());
    XYPlot p2 = (XYPlot) p1.clone();
    assertTrue(p1 != p2);
    assertTrue(p1.getClass() == p2.getClass());
    assertTrue(p1.equals(p2));
}
项目:group-five    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:pm    文件:ChartMain.java   
public ChartMain(Date startDate, JFreeChartTimePeriod jFreeTimePeriod) {
    super();

    this.jFreeTimePeriod = jFreeTimePeriod;
    UIManager.put("ToolTip.background", new java.awt.Color(239, 203, 152, 255));
    UIManager.put("ToolTip.foreground", java.awt.Color.BLACK);

    //ToolTipManager.sharedInstance().setInitialDelay(100);
    ToolTipManager.sharedInstance().setInitialDelay(20);
    //ToolTipManager.sharedInstance().setReshowDelay(0);
    ToolTipManager.sharedInstance().setDismissDelay(120000);

    XYBarRenderer.setDefaultShadowsVisible(false);
    XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());

    barChartDisplayStrategy = new ChartBarSquare(this);

    lineAnnotations = new HashMap<Long, XYTextAnnotation>();

}
项目:manydesigns.cn    文件:ChartFactory.java   
/**
 * Sets the current chart theme.  This will be applied to all new charts
 * created via methods in this class.
 *
 * @param theme  the theme (<code>null</code> not permitted).
 *
 * @see #getChartTheme()
 * @see ChartUtilities#applyCurrentTheme(JFreeChart)
 *
 * @since 1.0.11
 */
public static void setChartTheme(ChartTheme theme) {
    ParamChecks.nullNotPermitted(theme, "theme");
    currentTheme = theme;

    // here we do a check to see if the user is installing the "Legacy"
    // theme, and reset the bar painters in that case...
    if (theme instanceof StandardChartTheme) {
        StandardChartTheme sct = (StandardChartTheme) theme;
        if (sct.getName().equals("Legacy")) {
            BarRenderer.setDefaultBarPainter(new StandardBarPainter());
            XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
        }
        else {
            BarRenderer.setDefaultBarPainter(new GradientBarPainter());
            XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter());
        }
    }
}
项目:SPIM_Registration    文件:Histogram.java   
protected JFreeChart createChart( final IntervalXYDataset dataset, final String title, final String units )
{
    final JFreeChart chart = ChartFactory.createXYBarChart(
        title,
        "Distance [" + units + "]",
        false,
        "Count",
        dataset,
        PlotOrientation.VERTICAL,
        false, // legend
        false,
        false );

    final NumberAxis range = (NumberAxis) chart.getXYPlot().getDomainAxis();
    range.setRange( getMin(), getMax() );

    final XYPlot plot = chart.getXYPlot();
    final XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();

    renderer.setSeriesPaint( 0, Color.red );
    renderer.setDrawBarOutline( true );
    renderer.setSeriesOutlinePaint( 0, Color.black );
    renderer.setBarPainter( new StandardXYBarPainter() );

    return chart;
}