Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. private void initUI(String title) {
  2.         XYSeries xySeries1 = arrangePointsOnArea(10, 0, 10, 0, 10);
  3.         XYSeries xySeries2 = arrangePointsOnArea(10, 12, 18, 15, 25);
  4.         XYSeries xySeries3 = arrangePointsOnArea(10, 20, 30, 5, 10);
  5.  
  6.         neuronSeries = new XYSeries("neurons");
  7.         Point neuron1 = getRandomPointFromRange(0, 30, 0, 30);
  8.         neuronSeries.add(neuron1.x, neuron1.y);
  9.         neurons.add(neuron1);
  10.  
  11.         Point neuron2 = getRandomPointFromRange(0, 30, 0, 30);
  12.         neuronSeries.add(neuron2.x, neuron2.y);
  13.         neurons.add(neuron2);
  14.  
  15.         Point neuron3 = getRandomPointFromRange(0, 30, 0, 30);
  16.         neuronSeries.add(neuron3.x, neuron3.y);
  17.         neurons.add(neuron3);
  18.  
  19.         dataset.addSeries(xySeries1);
  20.         dataset.addSeries(xySeries2);
  21.         dataset.addSeries(xySeries3);
  22.        
  23.         dataset.addSeries(neuronSeries);
  24.  
  25.         JFreeChart chart = createChart(dataset, title);
  26.         ChartPanel chartPanel = new ChartPanel(chart);
  27.         chartPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
  28.         chartPanel.setBackground(Color.white);
  29.         add(chartPanel);
  30.  
  31.         pack();
  32.         setTitle("Line chart");
  33.         setLocationRelativeTo(null);
  34.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement