Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ---
- transmission_graph_frame.setIconImage( the_icon.getImage() );
- transmission_graph_frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- transmission_graph_frame.setSize(640, 480);
- transmission_graph_frame.setMinimumSize( new Dimension(400, 400) );
- jfreechart = ChartFactory.createXYLineChart("Transmission Rate", "Time (ms)", "Packets per Second", transmission_xyseriescollection, PlotOrientation.VERTICAL, true, true, false);
- ( (XYPlot) jfreechart.getPlot() ).setRenderer( new XYLineAndShapeRenderer() ); // this should cause symbols to be plotted at each data point
- chartpanel = new ChartPanel(jfreechart);
- transmission_graph_frame.add(chartpanel);
- tempB = new Hashtable<MotePartner, XYSeries>();
- for (MotePartner mote : the_mote_partners) {
- final XYSeries temp = new XYSeries( /*mote.identify()*/ mote.legend() );
- tempB.put(mote, temp);
- transmission_xyseriescollection.addSeries(temp);
- } // end for
- the_MP_to_transmission_series_HT = tempB; // race-free, with any luck ;-)
- show_transmission_graph_button = new JButton("Show Transm. Graph");
- show_transmission_graph_button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent AE) {
- transmission_graph_frame.setVisible(true);
- transmission_graph_frame.setState(JFrame.NORMAL); // de-iconify if possible - this is a good reason to leave the "show" button always enabled
- }
- });
- // ---
- public void transmission_interval(MotePartner source, long time, int status, boolean asleep, boolean stopped, long level, long mote_src) {
- try {
- if (null != the_MP_to_transmission_series_HT) {
- if(transmission_xyseriescollection.getSeriesCount() == 4) {
- //int src = (int)mote_src - 1;
- if(transmission_xyseriescollection.getSeries(src).getItemCount() >= 150) {
- transmission_xyseriescollection.getSeries(src).remove(0);//delete(0, 1);
- }
- }
- the_MP_to_transmission_series_HT.get(source).add(time, level);
- }
- } catch (ArrayIndexOutOfBoundsException exp) {
- } catch (Exception E) {
- //System.err.println("source.identify()" + source.identify());
- //System.err.println("Exception: "+E);
- }
- }// end of "transmission_interval"
Add Comment
Please, Sign In to add comment