Example usage for org.jfree.chart.plot XYPlot setRangePannable

List of usage examples for org.jfree.chart.plot XYPlot setRangePannable

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setRangePannable.

Prototype

public void setRangePannable(boolean pannable) 

Source Link

Document

Sets the flag that enables or disables panning of the plot along the range axis/axes.

Usage

From source file:com.intel.stl.ui.configuration.view.LFTHistogramPanel.java

@Override
public void initComponents() {
    dataset = new HistogramDataset();
    JFreeChart chart = ComponentFactory.createHistogramChart(K0427_PORT_NUMBER.getValue(),
            K0390_NUM_LIDS.getValue(), dataset);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainPannable(true);//  w  w w .  j av  a  2s .  c o m
    plot.setRangePannable(true);
    final String portLabel = "<html>" + K0427_PORT_NUMBER.getValue() + ": ";
    final String lidCountLabel = "<br>" + K0390_NUM_LIDS.getValue() + ": ";
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int portNum = (int) dataset.getXValue(arg1, arg2);
            int lidCount = (int) dataset.getYValue(arg1, arg2);
            return portLabel + portNum + lidCountLabel + lidCount + "</html>";
        }
    });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
}

From source file:com.intel.stl.ui.configuration.view.VLStallCountByVLBarChartPanel.java

@Override
public void initComponents() {
    dataset = new XYSeriesCollection();

    JFreeChart chart = ComponentFactory.createXYBarChart(K0342_PORT_VL_TITLE.getValue(),
            K0347_PORT_VL_STALL_COUNT.getValue(), dataset, (XYItemLabelGenerator) null);

    XYPlot plot = chart.getXYPlot();
    plot.setDomainPannable(true);//from   w  w  w . j  a  v a  2 s .c  o  m
    plot.setRangePannable(true);
    final String vlLabel = "<html>" + K0342_PORT_VL_TITLE.getValue() + ": ";
    final String mtuLabel = "<br>" + K0347_PORT_VL_STALL_COUNT.getValue() + ": ";

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarAlignmentFactor(0);
    renderer.setMargin(0.2);

    renderer.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int vlNum = (int) dataset.getXValue(arg1, arg2);
            int mtuCount = (int) dataset.getYValue(arg1, arg2);
            return vlLabel + vlNum + mtuLabel + mtuCount + "</html>";
        }
    });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
}

From source file:com.intel.stl.ui.configuration.view.HoQLifeBarChartPanel.java

@Override
public void initComponents() {
    dataset = new XYSeriesCollection();

    JFreeChart chart = ComponentFactory.createXYBarChart(K0342_PORT_VL_TITLE.getValue(),
            K1069_HOQLIFE.getValue(), dataset, (XYItemLabelGenerator) null);

    XYPlot plot = chart.getXYPlot();
    plot.setDomainPannable(true);//from  w  ww .  j ava2 s. c  om
    plot.setRangePannable(true);
    final String vlLabel = "<html>" + K0342_PORT_VL_TITLE.getValue() + ": ";
    final String hoqLabel = "<br>" + K1069_HOQLIFE.getValue() + ": ";

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarAlignmentFactor(0);
    renderer.setMargin(0.2);

    renderer.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int vlNum = (int) dataset.getXValue(arg1, arg2);
            int hoqCount = (int) dataset.getYValue(arg1, arg2);
            return vlLabel + vlNum + hoqLabel + hoqCount + "</html>";
        }
    });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
}

From source file:com.intel.stl.ui.configuration.view.SC2SLMTBarChartPanel.java

@Override
public void initComponents() {
    dataset = new XYSeriesCollection();

    JFreeChart chart = ComponentFactory.createXYBarChart(K1105_SC.getValue(), K1106_SL.getValue(), dataset,
            (XYItemLabelGenerator) null);

    XYPlot plot = chart.getXYPlot();
    plot.setDomainPannable(true);/*from   w  w w.j  a va  2 s . c  o m*/
    plot.setRangePannable(true);
    final String scLabel = "<html>" + K1105_SC.getValue() + ": ";
    final String slLabel = "<br>" + K1106_SL.getValue() + ": ";

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarAlignmentFactor(0);
    renderer.setMargin(0.2);

    renderer.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int scNum = (int) dataset.getXValue(arg1, arg2);
            int slCount = (int) dataset.getYValue(arg1, arg2);
            return scLabel + scNum + slLabel + slCount + "</html>";
        }
    });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
}

From source file:com.intel.stl.ui.configuration.view.SC2VLTMTBarChartPanel.java

@Override
public void initComponents() {
    dataset = new XYSeriesCollection();

    JFreeChart chart = ComponentFactory.createXYBarChart(K1105_SC.getValue(), K1109_VLT.getValue(), dataset,
            (XYItemLabelGenerator) null);

    XYPlot plot = chart.getXYPlot();
    plot.setDomainPannable(true);//w  w  w . j  ava 2 s. c  o m
    plot.setRangePannable(true);
    final String scLabel = "<html>" + K1105_SC.getValue() + ": ";
    final String vltLabel = "<br>" + K1109_VLT.getValue() + ": ";

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarAlignmentFactor(0);
    renderer.setMargin(0.2);

    renderer.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int scNum = (int) dataset.getXValue(arg1, arg2);
            int vltCount = (int) dataset.getYValue(arg1, arg2);
            return scLabel + scNum + vltLabel + vltCount + "</html>";
        }
    });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
}

From source file:com.intel.stl.ui.configuration.view.SC2VLNTMTBarChartPanel.java

@Override
public void initComponents() {
    dataset = new XYSeriesCollection();

    JFreeChart chart = ComponentFactory.createXYBarChart(K1105_SC.getValue(), K1110_VLNT.getValue(), dataset,
            (XYItemLabelGenerator) null);

    XYPlot plot = chart.getXYPlot();
    plot.setDomainPannable(true);/*w  ww.  j a v a 2s .co m*/
    plot.setRangePannable(true);
    final String scLabel = "<html>" + K1105_SC.getValue() + ": ";
    final String vlntLabel = "<br>" + K1110_VLNT.getValue() + ": ";

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarAlignmentFactor(0);
    renderer.setMargin(0.2);

    renderer.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int scNum = (int) dataset.getXValue(arg1, arg2);
            int vlntCount = (int) dataset.getYValue(arg1, arg2);
            return scLabel + scNum + vlntLabel + vlntCount + "</html>";
        }
    });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
}

From source file:com.intel.stl.ui.configuration.view.MTUByVLBarChartPanel.java

@Override
public void initComponents() {
    dataset = new XYSeriesCollection();

    JFreeChart chart = ComponentFactory.createXYBarChart(K0342_PORT_VL_TITLE.getValue(), K1068_MTU.getValue(),
            dataset, (XYItemLabelGenerator) null);

    XYPlot plot = chart.getXYPlot();
    plot.setDomainPannable(true);/*from   w  ww  .jav a  2s. co  m*/
    plot.setRangePannable(true);
    final String vlLabel = "<html>" + K0342_PORT_VL_TITLE.getValue() + ": ";
    final String mtuLabel = "<br>" + K1068_MTU.getValue() + ": ";

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setBarAlignmentFactor(0);
    renderer.setMargin(0.2);

    renderer.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {
        @Override
        public String generateToolTip(XYDataset dataset, int arg1, int arg2) {
            int vlNum = (int) dataset.getXValue(arg1, arg2);
            int mtuCount = (int) dataset.getYValue(arg1, arg2);
            return vlLabel + vlNum + mtuLabel + mtuCount + "</html>";
        }
    });
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    chartPanel = new ChartPanel(chart);
    chartPanel.setMouseWheelEnabled(true);
    chartPanel.setPreferredSize(PREFERRED_CHART_SIZE);
    propsPanel.add(chartPanel);
}

From source file:com.att.aro.ui.view.diagnostictab.CreateBarPlot.java

public XYPlot drawStepChartPlot() {
    XYStepRenderer renderer = new XYStepRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setSeriesStroke(0, new BasicStroke(2.0f));
    renderer.setSeriesStroke(1, new BasicStroke(2.0f));
    renderer.setDefaultEntityRadius(6);//from   www.ja v  a 2s .com
    XYPlot plot = new XYPlot(null, null, new NumberAxis(), renderer);
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    return plot;
}

From source file:de.hs.mannheim.modUro.diagram.JTimeSeriesDiagram.java

protected JFreeChart createChart(XYDataset dataset, String name) {
    String title = name;//  w  ww  . jav a2s  .  c o m

    JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title
            "t", // x-axis label
            "f", // y-axis label
            dataset);

    String fontName = "Palatino";
    xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));

    XYPlot plot = (XYPlot) xyLineChart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.getRangeAxis().setLowerMargin(0.0);
    if (isMetric) {
        plot.getRangeAxis().setRange(0.0, 1.01);
    }
    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.gray);
    xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    xyLineChart.getLegend().setFrame(BlockBorder.NONE);
    xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(false);
        renderer.setDrawSeriesLineAsPath(true);
        // set the default stroke for all series
        renderer.setAutoPopulateSeriesStroke(false);
        renderer.setSeriesPaint(0, Color.blue);
        renderer.setSeriesPaint(1, new Color(24, 123, 58));
        renderer.setSeriesPaint(2, new Color(149, 201, 136));
        renderer.setSeriesPaint(3, new Color(1, 62, 29));
        renderer.setSeriesPaint(4, new Color(81, 176, 86));
        renderer.setSeriesPaint(5, new Color(0, 55, 122));
        renderer.setSeriesPaint(6, new Color(0, 92, 165));
    }

    return xyLineChart;
}

From source file:net.nosleep.superanalyzer.analysis.views.LikesView.java

private void createChart() {
    _chart = ChartFactory.createScatterPlot(Misc.getString("LIKES_VS_PLAYS"),
            Misc.getString("ALBUM_PLAY_COUNT"), Misc.getString("ALBUM_RATING"), _dataset,
            PlotOrientation.VERTICAL, false, true, false);

    _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("LIKES_VS_PLAYS_SUBTITLE")));

    XYPlot plot = (XYPlot) _chart.getPlot();

    ChartUtilities.applyCurrentTheme(_chart);

    plot.setDomainPannable(true);//  w  ww.  ja  v a2 s .  c  o m
    plot.setRangePannable(true);
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);

    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);

    // get rid of the little line above/next to the axis
    plot.setDomainZeroBaselinePaint(Color.white);
    plot.setRangeZeroBaselinePaint(Color.white);

    /*
     * NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
     * domainAxis.setAutoRangeIncludesZero(false);
     * 
     * domainAxis.setTickMarkInsideLength(2.0f);
     * domainAxis.setTickMarkOutsideLength(2.0f);
     * 
     * domainAxis.setMinorTickCount(2);
     * domainAxis.setMinorTickMarksVisible(true);
     */
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    /*
     * rangeAxis.setTickMarkInsideLength(2.0f);
     * rangeAxis.setTickMarkOutsideLength(2.0f);
     * rangeAxis.setMinorTickCount(2);
     * rangeAxis.setMinorTickMarksVisible(true);
     */
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // format the line renderer after applying the theme
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();

    renderer.setBaseShapesVisible(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseFillPaint(Color.white);
    renderer.setSeriesStroke(0, new BasicStroke(3.0f));
    renderer.setSeriesOutlineStroke(0, new BasicStroke(2.0f));
    renderer.setSeriesShape(0, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));

    Misc.formatChart(plot);
    renderer.setSeriesPaint(0, Theme.getColorSet()[1]);

}