Example usage for org.jfree.chart ChartPanel setDomainZoomable

List of usage examples for org.jfree.chart ChartPanel setDomainZoomable

Introduction

In this page you can find the example usage for org.jfree.chart ChartPanel setDomainZoomable.

Prototype

public void setDomainZoomable(boolean flag) 

Source Link

Document

Sets the flag that controls whether or not zooming is enabled for the domain axis.

Usage

From source file:org.jfree.chart.demo.BubbleChartDemo1.java

public static JPanel createDemoPanel() {
    JFreeChart jfreechart = createChart(createDataset());
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setDomainZoomable(true);
    chartpanel.setRangeZoomable(true);/*from  w  w  w.j  a v  a2s  .  co m*/
    return chartpanel;
}

From source file:cv.mikusher.freechart.BubbleChart.java

public static JPanel createDemoPanel() {
    JFreeChart jfreechart = createChart(createDataset());
    ChartPanel chartpanel = new ChartPanel(jfreechart);

    chartpanel.setDomainZoomable(true);
    chartpanel.setRangeZoomable(true);//from w  ww  . j ava2 s  . c o m

    return chartpanel;
}

From source file:br.unicamp.cst.util.ChartViewerUtil.java

public static synchronized ChartPanel createChart(DefaultCategoryDataset dataset, String title,
        String categoryAxisLabel, String valueAxisLabel, PlotOrientation chartType) {

    final JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            chartType, true, true, false);

    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    chart.setBackgroundPaint(Color.lightGray);

    ChartPanel localChartPanel = new ChartPanel(chart);
    localChartPanel.setVisible(true);//ww w  .  j  a  v a  2s . co m
    localChartPanel.setDomainZoomable(true);

    return localChartPanel;
}

From source file:br.unicamp.cst.util.ChartViewerUtil.java

public static synchronized ChartPanel createLineXYChart(XYSeriesCollection dataset, String title,
        String categoryAxisLabel, String valueAxisLabel, long timeRefresh) {

    final JFreeChart chart = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            PlotOrientation.VERTICAL, true, true, false);

    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.getDomainAxis().setFixedAutoRange(timeRefresh * 100);
    chart.setBackgroundPaint(Color.lightGray);

    ChartPanel localChartPanel = new ChartPanel(chart);
    localChartPanel.setVisible(true);/*from   w  ww  .  j a v  a  2 s . com*/
    localChartPanel.setDomainZoomable(true);

    return localChartPanel;
}

From source file:org.jfree.chart.demo.ScatterPlotDemo1.java

public static JPanel createDemoPanel() {
    JFreeChart jfreechart = createChart(new SampleXYDataset2());
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setVerticalAxisTrace(true);
    chartpanel.setHorizontalAxisTrace(true);
    chartpanel.setPopupMenu(null);//  www  .j  a  va  2s .c o m
    chartpanel.setDomainZoomable(true);
    chartpanel.setRangeZoomable(true);
    return chartpanel;
}

From source file:max.hubbard.Factoring.Graphing.java

public static void graph(String equation) {
    LinkedList<LinkedHashMap<Float, Integer>> list = Separate.separate(equation);

    XYDataset set = createDataset(list, equation);
    final JFreeChart chart = createChart(set, equation);
    final ChartPanel chartPanel = new ChartPanel(chart);

    chartPanel.setVisible(true);//ww  w .  j  a  va  2s  . com
    chartPanel.setDomainZoomable(true);
    chartPanel.setRangeZoomable(true);
    chartPanel.setMouseWheelEnabled(true);

    chartPanel.setPreferredSize(new java.awt.Dimension(Main.label.getWidth(), Main.label.getHeight()));

    Main.getPanel().removeAll();
    Main.getPanel().updateUI();
    Main.getPanel().add(chartPanel, BorderLayout.CENTER);
    Main.getPanel().add(Interface.box, BorderLayout.EAST);

    Main.getFrame().pack();
}

From source file:com.porepw.porli.frame.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(60, "Marks", "Student 1");
    dataset.setValue(40, "Marks", "Student 2");
    dataset.setValue(90, "Marks", "Student 3");
    dataset.setValue(50, "Marks", "Student 4");
    dataset.setValue(70, "Marks", "Student 5");
    dataset.setValue(30, "Marks", "Student 6");

    JFreeChart chart = ChartFactory.createLineChart("Student Marks", "Student Name", "Marks", dataset,
            PlotOrientation.HORIZONTAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartPanel panel = new ChartPanel(chart);
    panel.setDomainZoomable(true);
    jPanel2.add(panel, BorderLayout.CENTER);
    panel.setPreferredSize(new java.awt.Dimension(500, 270));
}

From source file:Classes_Home.CriarGrafico.java

public void criargrafico(JPanel jPanel3) {
        String pcs[] = { "'HP'", "'IBM'", "'LENOVO'", "'POSITIVO'", "'NACIONAL'" };
        for (int i = 0; i <= 4; i++) {
            String query = "SELECT * FROM `cpu` WHERE marca = " + pcs[i];

            try {
                st = connection.createStatement();
                rs = st.executeQuery(query);
                if (rs.last()) {
                    int aux = rs.getRow();
                    vetorParaGrafico[i] = aux;
                }/*w ww. jav  a 2  s  . c  o  m*/
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.setValue(vetorParaGrafico[0], "Quantidade", "HP");
        dataset.setValue(vetorParaGrafico[1], "Quantidade", "IBM");
        dataset.setValue(vetorParaGrafico[2], "Quantidade", "LENOVO");
        dataset.setValue(vetorParaGrafico[3], "Quantidade", "POSITIVO");
        dataset.setValue(vetorParaGrafico[4], "Quantidade", "NACIONAL");

        JFreeChart chart = ChartFactory.createBarChart3D(null, null, "Quantidade", dataset,
                PlotOrientation.VERTICAL, false, true, false);
        CategoryPlot p = chart.getCategoryPlot();
        CategoryItemRenderer renderer = p.getRenderer();
        renderer.setSeriesPaint(0, new Color(80, 151, 204));
        p.setRangeGridlinePaint(Color.BLACK);
        ChartPanel panel = new ChartPanel(chart);
        panel.setDomainZoomable(true);
        panel.setVisible(true);
        jPanel3.setLayout(new BorderLayout());
        jPanel3.add(panel, BorderLayout.CENTER);
        jPanel3.revalidate();
        jPanel3.repaint();
        System.gc();
    }

From source file:app.Plot.java

public void showElements(List<WordStatistic> was, JComboBox cb) {

    JFreeChart chart = createPlot(was, cb.getSelectedItem());
    plotDesign(chart);//ww w . ja  va 2s. c  om
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setDomainZoomable(false);
    PlotWindow plot = new PlotWindow();
    plot.setVisible(true);
    JPanel panetJTitle = new JPanel();
    JPanel panelJPanel = new JPanel();
    JPanel panelJComboBox = new JPanel();
    panelJPanel.removeAll();
    panelJComboBox.removeAll();
    JLabel title = new JLabel();
    title.setText(
            " ?? ? ? ??  '"
                    + cb.getSelectedItem().toString() + "'   ?");
    chartPanel.setPreferredSize(new java.awt.Dimension(600, 400));
    JLabel label = new JLabel();
    label.setText(" ?? ");
    panetJTitle.add(title);
    panelJPanel.add(chartPanel);
    panelJComboBox.add(label);
    panelJComboBox.add(cb);
    JPanel panelWindow = new JPanel();
    panelWindow.add(panetJTitle);
    panelWindow.add(panelJPanel);
    panelWindow.add(panelJComboBox);
    plot.setContentPane(panelWindow);

}

From source file:org.jfree.chart.demo.MarkerDemo2.java

public MarkerDemo2(String s) {
    super(s);/*from  w w  w.  j  av  a  2s.com*/
    XYDataset xydataset = createDataset();
    JFreeChart jfreechart = createChart(xydataset);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(500, 270));
    chartpanel.setDomainZoomable(true);
    chartpanel.setRangeZoomable(true);
    setContentPane(chartpanel);
}