Guest User

Untitled

a guest
Aug 15th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. // ---
  2. transmission_graph_frame.setIconImage( the_icon.getImage() );
  3. transmission_graph_frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  4. transmission_graph_frame.setSize(640, 480);
  5. transmission_graph_frame.setMinimumSize( new Dimension(400, 400) );
  6. jfreechart = ChartFactory.createXYLineChart("Transmission Rate", "Time (ms)", "Packets per Second", transmission_xyseriescollection, PlotOrientation.VERTICAL, true, true, false);
  7. ( (XYPlot) jfreechart.getPlot() ).setRenderer( new XYLineAndShapeRenderer() ); // this should cause symbols to be plotted at each data point
  8. chartpanel = new ChartPanel(jfreechart);
  9. transmission_graph_frame.add(chartpanel);
  10.  
  11. tempB = new Hashtable<MotePartner, XYSeries>();
  12. for (MotePartner mote : the_mote_partners) {
  13. final XYSeries temp = new XYSeries( /*mote.identify()*/ mote.legend() );
  14. tempB.put(mote, temp);
  15. transmission_xyseriescollection.addSeries(temp);
  16. } // end for
  17. the_MP_to_transmission_series_HT = tempB; // race-free, with any luck ;-)
  18.  
  19. show_transmission_graph_button = new JButton("Show Transm. Graph");
  20. show_transmission_graph_button.addActionListener(new ActionListener() {
  21. public void actionPerformed(ActionEvent AE) {
  22. transmission_graph_frame.setVisible(true);
  23. transmission_graph_frame.setState(JFrame.NORMAL); // de-iconify if possible - this is a good reason to leave the "show" button always enabled
  24. }
  25. });
  26.  
  27. // ---
  28.  
  29.  
  30. public void transmission_interval(MotePartner source, long time, int status, boolean asleep, boolean stopped, long level, long mote_src) {
  31. try {
  32. if (null != the_MP_to_transmission_series_HT) {
  33. if(transmission_xyseriescollection.getSeriesCount() == 4) {
  34. //int src = (int)mote_src - 1;
  35. if(transmission_xyseriescollection.getSeries(src).getItemCount() >= 150) {
  36. transmission_xyseriescollection.getSeries(src).remove(0);//delete(0, 1);
  37. }
  38. }
  39.  
  40. the_MP_to_transmission_series_HT.get(source).add(time, level);
  41. }
  42. } catch (ArrayIndexOutOfBoundsException exp) {
  43. } catch (Exception E) {
  44. //System.err.println("source.identify()" + source.identify());
  45. //System.err.println("Exception: "+E);
  46. }
  47. }// end of "transmission_interval"
Add Comment
Please, Sign In to add comment