@Override
  public void display(HashBasedTable<String, String, Double> data) {

    roomToCodeMapping = generateNewRoomToCodeMapping();
    dataSet = createDataSet(data);
    final JFreeChart chart = createChart(dataSet);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(1000, 540));
    createNewFrameAndSetLocation();
    currentFrame.setTitle(this.getTitle());
    currentFrame.setContentPane(chartPanel);
    currentFrame.setVisible(true);
    currentFrame.setSize(new Dimension(1020, 560));
    currentFrame.addWindowListener(this);

    if (type == MarkovDataDialog.HeatMapType.COMPARISON) {
      unscaledDifferenceSlider.setLabelTable(unscaledDifferenceSlider.createStandardLabels(5, 5));
      differenceSelectorFrame = new JFrame("Choose Size of difference");
      differenceSelectorFrame.setLayout(new BorderLayout());
      differenceSelectorFrame.add(unscaledDifferenceSlider, BorderLayout.NORTH);

      statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
      statusLabel.setText("Current difference size:" + this.unscaledDifference);

      differenceSelectorFrame.add(statusLabel, BorderLayout.CENTER);

      differenceSelectorFrame.add(regenerate, BorderLayout.SOUTH);

      regenerate.addActionListener(this);

      differenceSelectorFrame.setLocation(100, 10);
      differenceSelectorFrame.setSize(300, 200);
      differenceSelectorFrame.setVisible(true);
    }
  }
Ejemplo n.º 2
0
  /**
   * @param title - tite of the window when we instantiate the BarChart
   * @param timeTaken - long: the time taken for the cleaning process since the ON button has been
   *     pressed
   * @param cellsCovered - int count of the cells that have been covered so far
   * @param time - the current system time
   */
  public BarChart(String title, long timeTaken, int cellsCovered, String time) {
    super(title);

    saveLoad = new SaveLoad();
    if (saveLoad.deserializeStatistics()) {
      System.out.println("Statistics de-serialized.");
      statistics = saveLoad.getStatistics();
      if (timeTaken != 0) {
        statistics.addCycle(timeTaken, cellsCovered, time);
      }
      saveLoad.serializeStatistics(statistics);
    } else {
      System.out.println("Statistics did not de-serialize.");
      statistics = new Statistics();
      if (timeTaken != 0) {
        statistics.addCycle(timeTaken, cellsCovered, time);
      }
      saveLoad.serializeStatistics(statistics);
    }

    if (statistics.getListOfCycles().size() > 0) {
      System.out.println("BarChart - condition for displayin the chart passed!");
      CategoryDataset dataset = createDataset();
      JFreeChart chart = createChart(dataset);
      ChartPanel chartPanel = new ChartPanel(chart);
      chartPanel.setFillZoomRectangle(true);
      chartPanel.setMouseWheelEnabled(true);
      chartPanel.setPreferredSize(new Dimension(500, 270));
      setContentPane(chartPanel);
    } else {
      JOptionPane.showMessageDialog(this, "No Statistics data. Please run the robot first.");
    }
  }
Ejemplo n.º 3
0
 public GraficoProdotto(int id) throws Exception {
   super("Grafico PRODOTTO");
   //        GraficoProdotto.this.windowClosing(event);
   ChartPanel chartPanel = (ChartPanel) createDemoPanel(id);
   chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   setContentPane(chartPanel);
 }
Ejemplo n.º 4
0
  private void init() {
    timeSeriesList = new LinkedList<TimeSeries>();
    m_average = new TimeSeries(AVERANGE, Millisecond.class);
    m_tps = new TimeSeries(TPS, Millisecond.class);
    m_deviation = new TimeSeries(DEVIATION, Millisecond.class);
    stateMap.put(AVERANGE, m_average);
    stateMap.put(DEVIATION, m_deviation);
    stateMap.put(TPS, m_tps);
    timeSeriesList.add(m_average);
    timeSeriesList.add(m_tps);
    timeSeriesList.add(m_deviation);
    timeseriescollection = new TimeSeriesCollection();
    for (Iterator<TimeSeries> iterator = timeSeriesList.iterator(); iterator.hasNext(); ) {
      timeseriescollection.addSeries(iterator.next());
    }
    jfc =
        ChartFactory.createTimeSeriesChart(
            "Title", "unit", "yaxisName", timeseriescollection, true, true, false);
    // jfc.setTitle(new TextTitle("图表", new Font("黑体", Font.BOLD, 20)));
    // 取得统计图表
    XYPlot xyplot = jfc.getXYPlot();

    xylinerenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylinerenderer.setSeriesPaint(0, Color.BLUE);
    xylinerenderer.setSeriesPaint(1, Color.GREEN);
    xylinerenderer.setSeriesPaint(2, Color.RED);

    ValueAxis valueaxis = xyplot.getDomainAxis();
    valueaxis.setAutoRange(true);
    valueaxis.setFixedAutoRange(30000D);
    valueaxis = xyplot.getRangeAxis();
    chartPanel = new ChartPanel(jfc);
    chartPanel.setPreferredSize(new Dimension(600, 450));
  }
Ejemplo n.º 5
0
  /** Places all components (graphs) in the panel. */
  private void placeComponents() {
    final GridBagConstraints constraints = new GridBagConstraints();

    int numberOfComponentsPlaced = 0;
    int currXPos = 0;
    final int graphHeight = 150;
    final int graphWidth = 100;

    final Collection<String> datastreams = statisticsManager.getAvailableDatastreams();
    for (final String streamname : datastreams) {
      LOG.info("drawing stream");
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.weightx = 0.5;
      constraints.gridx = currXPos;
      constraints.gridy = numberOfComponentsPlaced / 2;
      constraints.insets = new Insets(10, 0, 0, 0);

      final DecoratedGraph graph =
          new DecoratedGraph((long) 10 * 60 * 1000, statisticsManager.getDatastream(streamname));
      graph.registerRelativeDatastream(server, streamname, Color.GREEN);
      graph.addServerToRefresh(server);
      final ChartPanel chartPanel = graph.getChartPanel();
      chartPanel.setPreferredSize(new Dimension(graphWidth, graphHeight));
      add(chartPanel, constraints);

      if (currXPos == 0) {
        currXPos = 1;
      } else {
        currXPos = 0;
      }
      numberOfComponentsPlaced++;
    }
  }
 public StatisticalLineChartDemo1(String s) {
   super(s);
   CategoryDataset categorydataset = createDataset();
   JFreeChart jfreechart = createChart(categorydataset);
   ChartPanel chartpanel = new ChartPanel(jfreechart);
   chartpanel.setPreferredSize(new Dimension(500, 270));
   setContentPane(chartpanel);
 }
Ejemplo n.º 7
0
 public LineChartDemo2(String s) {
   super(s);
   XYDataset xydataset = createDataset();
   JFreeChart jfreechart = createChart(xydataset);
   ChartPanel chartpanel = new ChartPanel(jfreechart);
   chartpanel.setPreferredSize(new Dimension(500, 270));
   setContentPane(chartpanel);
 }
Ejemplo n.º 8
0
 /**
  * Creates a new demo.
  *
  * @param title the frame title.
  */
 public LineChartDemo5(final String title) {
   super(title);
   final CategoryDataset dataset = createDataset();
   final JFreeChart chart = createChart(dataset);
   final ChartPanel chartPanel = new ChartPanel(chart);
   chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   setContentPane(chartPanel);
 }
Ejemplo n.º 9
0
 /**
  * Creates a new demo.
  *
  * @param title the frame title.
  */
 public AbsoluteAccurcyChart(final String title) {
   super(title);
   final XYDataset dataset = createDataset();
   final JFreeChart chart = createChart(dataset);
   final ChartPanel chartPanel = new ChartPanel(chart);
   chartPanel.setPreferredSize(new Dimension(900, 570));
   setContentPane(chartPanel);
 }
Ejemplo n.º 10
0
 public AccelPlot(String titulo, String eixoX, String eixoY, XYDataset dados) {
   super(titulo);
   final XYDataset dataset = dados;
   final JFreeChart chart = createChart(titulo, eixoX, eixoY, dataset);
   final ChartPanel chartPanel = new ChartPanel(chart);
   chartPanel.setPreferredSize(new java.awt.Dimension(1400, 800));
   setContentPane(chartPanel);
 }
Ejemplo n.º 11
0
 public XySplineChart(final String title, double[][] dataMatrix, String[] names) {
   super(title);
   IntervalXYDataset dataset = createDataset(dataMatrix, names);
   JFreeChart chart = createChart(dataset);
   final ChartPanel chartPanel = new ChartPanel(chart);
   chartPanel.setPreferredSize(new java.awt.Dimension(1280, 800));
   setContentPane(chartPanel);
 }
 /**
  * Creates a new demo.
  *
  * @param title the frame title.
  */
 public HistogramDemo2(final String title) {
   super(title);
   final IntervalXYDataset dataset = createDataset();
   final JFreeChart chart = createChart(dataset);
   final ChartPanel chartPanel = new ChartPanel(chart);
   chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   setContentPane(chartPanel);
 }
Ejemplo n.º 13
0
  public Chart(float[] data, int size) {
    super("title");

    final XYDataset dataset = createDataset(data, size);
    final JFreeChart chart = createChart(dataset);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);
  }
Ejemplo n.º 14
0
 private ApplicationFrame createFrame(final GraphBuilder builder) {
   final ApplicationFrame frame = new ApplicationFrame(builder.windowTitle());
   final ChartPanel chartPanel = new ChartPanel(chart);
   chartPanel.setPreferredSize(new java.awt.Dimension(XDIM, YDIM));
   frame.setContentPane(chartPanel);
   frame.pack();
   RefineryUtilities.positionFrameRandomly(frame);
   return frame;
 }
Ejemplo n.º 15
0
 public PeriodAxisDemo2(String s) {
   super(s);
   XYDataset xydataset = createDataset();
   JFreeChart jfreechart = createChart(xydataset);
   ChartPanel chartpanel = new ChartPanel(jfreechart);
   chartpanel.setPreferredSize(new Dimension(500, 270));
   chartpanel.setMouseZoomable(true, true);
   setContentPane(chartpanel);
 }
  /**
   * Constructs a new demonstration application.
   *
   * @param title the frame title.
   */
  public DynamicDataDemo3(String title) {

    super(title);

    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
    this.datasets = new TimeSeriesCollection[SUBPLOT_COUNT];

    for (int i = 0; i < SUBPLOT_COUNT; i++) {
      this.lastValue[i] = 100.0;
      TimeSeries series = new TimeSeries("Random " + i, Millisecond.class);
      this.datasets[i] = new TimeSeriesCollection(series);
      NumberAxis rangeAxis = new NumberAxis("Y" + i);
      rangeAxis.setAutoRangeIncludesZero(false);
      XYPlot subplot = new XYPlot(this.datasets[i], null, rangeAxis, new StandardXYItemRenderer());
      subplot.setBackgroundPaint(Color.lightGray);
      subplot.setDomainGridlinePaint(Color.white);
      subplot.setRangeGridlinePaint(Color.white);
      plot.add(subplot);
    }

    JFreeChart chart = new JFreeChart("Dynamic Data Demo 3", plot);
    chart.getLegend().setAnchor(Legend.EAST);
    chart.setBorderPaint(Color.black);
    chart.setBorderVisible(true);
    chart.setBackgroundPaint(Color.white);

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4));
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(60000.0); // 60 seconds

    JPanel content = new JPanel(new BorderLayout());

    ChartPanel chartPanel = new ChartPanel(chart);
    content.add(chartPanel);

    JPanel buttonPanel = new JPanel(new FlowLayout());

    for (int i = 0; i < SUBPLOT_COUNT; i++) {
      JButton button = new JButton("Series " + i);
      button.setActionCommand("ADD_DATA_" + i);
      button.addActionListener(this);
      buttonPanel.add(button);
    }
    JButton buttonAll = new JButton("ALL");
    buttonAll.setActionCommand("ADD_ALL");
    buttonAll.addActionListener(this);
    buttonPanel.add(buttonAll);

    content.add(buttonPanel, BorderLayout.SOUTH);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 470));
    chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setContentPane(content);
  }
Ejemplo n.º 17
0
 public media(String title) throws Exception {
   super(title);
   ResultSet dt = nucleo.getMedia();
   CategoryDataset dataset = media.createDataset(dt);
   JFreeChart chart = media.createBarChart(dataset);
   ChartPanel panel = new ChartPanel(chart);
   panel.setPreferredSize(new Dimension(400, 300));
   setContentPane(panel);
   dt.close();
 }
Ejemplo n.º 18
0
  public BarChartDemo1(String title) {

    // super(title);
    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    chartPanel = new ChartPanel(chart, false);
    chartPanel.setPreferredSize(new Dimension(300, 170));
    // setContentPane(chartPanel);

  }
Ejemplo n.º 19
0
  /**
   * Creates a new demo instance.
   *
   * @param title the frame title.
   */
  public BarChartDemo8(String title) {

    super(title);

    CategoryDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(chartPanel);
  }
Ejemplo n.º 20
0
  public BarChart_AWT(String applicationTitle, String chartTitle, int nbpers) {
    JFreeChart barChart =
        ChartFactory.createBarChart(
            chartTitle,
            "Rôles",
            "Fréquence",
            createDataset(nbpers),
            PlotOrientation.VERTICAL,
            true,
            true,
            false);

    ChartPanel chartPanel = new ChartPanel(barChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    this.setTitle(applicationTitle);
    this.dispose();

    JPanel top = new JPanel();
    JPanel body = new JPanel();

    body.add(chartPanel);
    top.add(prec);
    top.add(next);

    this.getContentPane().add(top, BorderLayout.NORTH);
    this.getContentPane().add(body, BorderLayout.CENTER);

    prec.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (increment > 0) {
              increment--;
            }
            chart = new BarChart_AWT("Statistiques", iofile.nb_to_name(increment), increment);
            chart.pack();
            chart.setLocationRelativeTo(null);
            hidden();
            chart.setVisible(true);
          }
        });

    next.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (increment < 11) {
              increment++;
            }
            chart = new BarChart_AWT("Statistiques", iofile.nb_to_name(increment), increment);
            chart.pack();
            chart.setLocationRelativeTo(null);
            hidden();
            chart.setVisible(true);
          }
        });
  }
Ejemplo n.º 21
0
 public media(Nucleo nuc) throws Exception {
   super("Classificações");
   initComponents();
   nucleo = nuc;
   ResultSet dt = nucleo.getMedia();
   CategoryDataset dataset = media.createDataset(dt);
   JFreeChart chart = media.createBarChart(dataset);
   ChartPanel panel = new ChartPanel(chart);
   panel.setPreferredSize(new Dimension(400, 300));
   setContentPane(panel);
 }
 // private static double daycount_c;
 // 因为这是出入场图,所以传入的type没有用到,所以这里的type的意思是按日统计(0)还是按月统计(1)
 public CopyOfParkingSystemChartZhu_test(String title, String timefrom, String timeto, int type) {
   super(title);
   this.timefrom = timefrom;
   this.timeto = timeto;
   this.type = type;
   datefrom = java.sql.Date.valueOf(timefrom);
   dateto = java.sql.Date.valueOf(timeto);
   ChartPanel chartPanel = (ChartPanel) createDemoPanel();
   chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   setContentPane(chartPanel);
 }
  private void setUpGraphPanel() {
    // set border for graph panel
    TitledBorder border = BorderFactory.createTitledBorder("Proportions of orders this week");
    border.setTitleJustification(TitledBorder.CENTER);

    BoxLayout boxLayout = new BoxLayout(graphPanel, BoxLayout.X_AXIS);
    graphPanel.setLayout(boxLayout);
    graphPanel.setBorder(border);

    setNumberChartContent();
    ChartPanel numbersChartPanel = new ChartPanel(numbersChart);
    numbersChartPanel.setPreferredSize(new Dimension(400, 200));

    setCostChartContent();
    ChartPanel costChartPanel = new ChartPanel(costChart);
    costChartPanel.setPreferredSize(new Dimension(400, 200));

    graphPanel.add(numbersChartPanel);
    graphPanel.add(costChartPanel);
  }
Ejemplo n.º 24
0
  /**
   * A demonstration application showing a candlestick chart.
   *
   * @param title the frame title.
   */
  public CandleStickChart(final String title, DefaultHighLowDataset highLowDataset) {

    super(title);

    final DefaultHighLowDataset dataset = highLowDataset;
    final JFreeChart chart = createChart(dataset);
    chart.getXYPlot().setOrientation(PlotOrientation.VERTICAL);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);
  }
Ejemplo n.º 25
0
 public LineChart(String title, XYSeries[] xyData) {
   super(title);
   XYDataset data = createDataset(xyData);
   chart = createChart(data, title);
   ChartPanel panel = new ChartPanel(chart);
   panel.setPreferredSize(new Dimension(500, 400));
   setContentPane(panel);
   pack();
   RefineryUtilities.centerFrameOnScreen(this);
   setVisible(true);
 }
Ejemplo n.º 26
0
  public ChartPanel newChart(XYSeriesCollection datatempcopy) {

    JFreeChart chart =
        ChartFactory.createXYLineChart(
            title, xaxis, yaxis, datatempcopy, PlotOrientation.VERTICAL, true, true, false);

    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(this.getWidth(), this.getHeight()));

    return chartPanel;
  }
Ejemplo n.º 27
0
 private GUIUtils(
     String title,
     DataSequence orig,
     DataSequence predicted,
     ArrayList<Anomaly> anomalyList,
     Properties config) {
   super(title);
   this.config = config;
   final JFreeChart chart = createCombinedChart(orig, predicted, anomalyList);
   final ChartPanel panel = new ChartPanel(chart, true, true, true, false, true);
   panel.setPreferredSize(new java.awt.Dimension(1440, 900));
   setContentPane(panel);
 }
Ejemplo n.º 28
0
 public PieChart(String applicationTitle, String chartTitle) {
   super(applicationTitle);
   // This will create the dataset
   PieDataset dataset = GraficoPizza.construiGraficoPizza(chartTitle);
   // based on the dataset we create the chart
   JFreeChart chart = createChart(dataset, chartTitle);
   // we put the chart into a panel
   ChartPanel chartPanel = new ChartPanel(chart);
   // default size
   chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   // add it to our application
   setContentPane(chartPanel);
 }
Ejemplo n.º 29
0
 /**
  * Displays a chart in a frame.
  *
  * @param chart the chart to be displayed
  */
 private static void displayChart(JFreeChart chart) {
   // Chart panel
   ChartPanel panel = new ChartPanel(chart);
   panel.setFillZoomRectangle(true);
   panel.setMouseWheelEnabled(true);
   panel.setPreferredSize(new java.awt.Dimension(500, 270));
   // Application frame
   ApplicationFrame frame = new ApplicationFrame("Ta4j example - Indicators to chart");
   frame.setContentPane(panel);
   frame.pack();
   RefineryUtilities.centerFrameOnScreen(frame);
   frame.setVisible(true);
 }
Ejemplo n.º 30
0
 public MouseListenerDemo1(String s) {
   super(s);
   DefaultPieDataset defaultpiedataset = new DefaultPieDataset();
   defaultpiedataset.setValue("Java", new Double(43.200000000000003D));
   defaultpiedataset.setValue("Visual Basic", new Double(0.0D));
   defaultpiedataset.setValue("C/C++", new Double(17.5D));
   org.jfree.chart.JFreeChart jfreechart =
       ChartFactory.createPieChart("Pie Chart Demo 1", defaultpiedataset, true, true, false);
   ChartPanel chartpanel = new ChartPanel(jfreechart, false, false, false, false, false);
   chartpanel.addChartMouseListener(this);
   chartpanel.setPreferredSize(new Dimension(500, 270));
   setContentPane(chartpanel);
 }