Package org.jfree.chart

Examples of org.jfree.chart.ChartPanel


    meterplot.setInsets(new Insets( 2, 2, 2, 2 ));
   
    meterchart = new JFreeChart(title+" Meter",
      JFreeChart.DEFAULT_TITLE_FONT, meterplot, false);
    meterchart.setBackgroundPaint(bgColor);
    panelMeter = new ChartPanel(meterchart);
    setLayout(new BorderLayout());
    add(panelMeter, BorderLayout.CENTER);
  }
View Full Code Here


        stopThread = false;
        new MyThread().start();
    }

    public void start(){
        final ChartPanel chartPanel = new ChartPanel(chart);
        this.setContentPane(chartPanel);
    }
View Full Code Here

      plot.setDrawingSupplier(new DCDrawingSupplier(WidgetUtils.ADDITIONAL_COLOR_GREEN_BRIGHT,
          WidgetUtils.ADDITIONAL_COLOR_RED_BRIGHT, WidgetUtils.BG_COLOR_BLUE_BRIGHT));
    }

    final ChartPanel chartPanel = new ChartPanel(chart);

    chartPanel.addChartMouseListener(new ChartMouseListener() {
      @Override
      public void chartMouseMoved(ChartMouseEvent event) {
        Cursor cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
        ChartEntity entity = event.getEntity();
        if (entity instanceof PlotEntity) {
          cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
        }
        chartPanel.setCursor(cursor);
      }

      @Override
      public void chartMouseClicked(ChartMouseEvent event) {
        // do nothing
      }
    });

    final int visibleLines = Math.min(GROUPS_VISIBLE, groupNames.size());

    chartPanel.setPreferredSize(new Dimension(0, visibleLines * 50 + 200));

    final JComponent decoratedChartPanel;

    StringBuilder chartDescription = new StringBuilder();
    chartDescription.append("<html><p>The chart displays the recorded timeline based on FROM and TO dates.<br/><br/>");
    chartDescription
        .append("The <b>red items</b> represent gaps in the timeline and the <b>green items</b> represent points in the timeline where more than one record show activity.<br/><br/>");
    chartDescription
        .append("You can <b>zoom in</b> by clicking and dragging the area that you want to examine in further detail.");

    if (groupNames.size() > GROUPS_VISIBLE) {
      final JScrollBar scroll = new JScrollBar(JScrollBar.VERTICAL);
      scroll.setMinimum(0);
      scroll.setMaximum(groupNames.size());
      scroll.addAdjustmentListener(new AdjustmentListener() {

        @Override
        public void adjustmentValueChanged(AdjustmentEvent e) {
          int value = e.getAdjustable().getValue();
          slidingDataset.setFirstCategoryIndex(value);
        }
      });

      chartPanel.addMouseWheelListener(new MouseWheelListener() {

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
          int scrollType = e.getScrollType();
          if (scrollType == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
View Full Code Here

              meanMarker.setLabel("Mean");
              meanMarker.setLabelOffset(new RectangleInsets(70d, 25d, 0d, 0d));
              meanMarker.setLabelFont(WidgetUtils.FONT_SMALL);
              chart.getXYPlot().addDomainMarker(meanMarker);

              final ChartPanel chartPanel = new ChartPanel(chart);
              displayChartCallback.displayChart(chartPanel);
            }
          };

          DCPanel panel = AbstractCrosstabResultSwingRenderer.createActionableValuePanel(standardDeviation,
View Full Code Here

    }

    JFreeChart chart = ChartFactory.createBarChart("", "", "Match count", dataset, PlotOrientation.VERTICAL, true, true,
        false);
    ChartUtils.applyStyles(chart);
    displayChartCallback.displayChart(new ChartPanel(chart));
  }
View Full Code Here

      }
      plot.setSectionPaint(LabelUtils.UNIQUE_LABEL, WidgetUtils.BG_COLOR_BRIGHT);
      plot.setSectionPaint(LabelUtils.NULL_LABEL, WidgetUtils.BG_COLOR_DARKEST);
    }

    final ChartPanel chartPanel = new ChartPanel(chart);
    int chartHeight = 450;
    if (_dataset.getItemCount() > 32) {
      chartHeight += 200;
    } else if (_dataset.getItemCount() > 25) {
      chartHeight += 100;
    }

    chartPanel.setPreferredSize(new Dimension(0, chartHeight));
    chartPanel.addChartMouseListener(new ChartMouseListener() {

      @Override
      public void chartMouseMoved(ChartMouseEvent event) {
        ChartEntity entity = event.getEntity();
        if (entity instanceof PieSectionEntity) {
          PieSectionEntity pieSectionEntity = (PieSectionEntity) entity;
          String sectionKey = (String) pieSectionEntity.getSectionKey();
          if (_groups.containsKey(sectionKey)) {
            chartPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
          } else {
            chartPanel.setCursor(Cursor.getDefaultCursor());
          }
        } else {
          chartPanel.setCursor(Cursor.getDefaultCursor());
        }
      }

      @Override
      public void chartMouseClicked(ChartMouseEvent event) {
View Full Code Here

        }

        final JFreeChart chart = ChartFactory.createBarChart("", "", measureName, dataset, PlotOrientation.VERTICAL,
            true, true, false);
        ChartUtils.applyStyles(chart);
        final ChartPanel chartPanel = new ChartPanel(chart);
        displayChartCallback.displayChart(chartPanel);
      }
    };

    final DCPanel panel = createActionableValuePanel(measureName, Alignment.LEFT, action, "images/chart-types/bar.png");
View Full Code Here

    private void initialize(JFreeChart chart) {
        initComponents();
        if (chart == null) {
            throw new IllegalArgumentException("Chart panel can't be null");
        }
        this.chartPanel = new ChartPanel(chart, true);
       
        scroll.setViewportView(chartPanel);
        adaptChartPanelSizeToScrollSize();
        scroll.revalidate();
        scroll.repaint();
View Full Code Here

        plot.setInteriorGap(0);
        plot.setBackgroundPaint(null);
        plot.setBackgroundAlpha(1f);
        plot.setSectionPaint(NbBundle.getMessage(getClass(), "ContextPieChart.visible"), new Color(0x222222));
        plot.setSectionPaint(NbBundle.getMessage(getClass(), "ContextPieChart.notVisible"), new Color(0xDDDDDD));
        chartPanel = new ChartPanel(chart, 100, 100, 10, 10, 300, 300, true, false, false, false, false, false);
        ((FlowLayout) chartPanel.getLayout()).setHgap(0);
        ((FlowLayout) chartPanel.getLayout()).setVgap(0);
        chartPanel.setOpaque(false);
        chartPanel.setPopupMenu(null);
    }
View Full Code Here

        plot.setBackgroundPaint(null);
        plot.setBackgroundAlpha(1f);
        for (Part p : partition.getParts()) {
            plot.setSectionPaint(p.getDisplayName(), p.getColor());
        }
        chartPanel = new ChartPanel(chart, true);
        chartPanel.setOpaque(false);
        chartPanel.setPopupMenu(null);
        add(chartPanel, BorderLayout.CENTER);
    }
View Full Code Here

TOP

Related Classes of org.jfree.chart.ChartPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.