7
7
import info .monitorenter .gui .chart .IAxis .AxisTitle ;
8
8
import info .monitorenter .gui .chart .ITrace2D ;
9
9
import info .monitorenter .gui .chart .ZoomableChart ;
10
- import info .monitorenter .gui .chart .traces .Trace2DLtd ;
11
10
import info .monitorenter .gui .chart .traces .Trace2DSimple ;
12
11
import info .monitorenter .gui .chart .views .ChartPanel ;
13
12
import java .awt .Color ;
@@ -261,6 +260,7 @@ public void showGraph() {
261
260
frame .getContentPane ().add (new ChartPanel (energyPlottingCallback .createChart ()));
262
261
frame .getContentPane ().add (new ChartPanel (coordPlottingCallback .createChart ()));
263
262
frame .getContentPane ().add (new ChartPanel (intensityPlottingCallback .createChart ()));
263
+ frame .getContentPane ().add (new ChartPanel (xyPlottingCallback .createChart ()));
264
264
265
265
chartFrame = frame ;
266
266
}
@@ -271,6 +271,7 @@ public void showGraph() {
271
271
272
272
private PlottingCallback energyPlottingCallback = new EnergyPlottingCallback ();
273
273
private PlottingCallback coordPlottingCallback = new XYZPlottingCallback ();
274
+ private PlottingCallback xyPlottingCallback = new XYPlottingCallback ();
274
275
private PlottingCallback intensityPlottingCallback = new IntensityPlottingCallback ();
275
276
276
277
private abstract class PlottingCallback implements Callback {
@@ -376,6 +377,30 @@ public void point(double t, double x, double y, double z, double vx, double vy,
376
377
}
377
378
}
378
379
380
+ private class XYPlottingCallback extends PlottingCallback {
381
+
382
+ private ITrace2D coordTrace = new Trace2DSimple ("x-y trajectory" );
383
+
384
+ @ Override
385
+ public ZoomableChart createChart () {
386
+ ZoomableChart c = new ZoomableChart ();
387
+ c .getAxisX ().setAxisTitle (new AxisTitle ("x" ));
388
+ c .getAxisY ().setAxisTitle (new AxisTitle ("y" ));
389
+
390
+ c .addTrace (coordTrace );
391
+
392
+ return c ;
393
+ }
394
+
395
+ protected void clearTraces () {
396
+ coordTrace .removeAllPoints ();
397
+ }
398
+
399
+ public void point (double t , double x , double y , double z , double vx , double vy , double vz ) {
400
+ coordTrace .addPoint (x , y );
401
+ }
402
+ }
403
+
379
404
private class OutputCallback implements Callback {
380
405
381
406
private PrintStream s ;
@@ -470,6 +495,7 @@ public void fly(
470
495
new Callback [] {energyPlottingCallback ,
471
496
coordPlottingCallback ,
472
497
intensityPlottingCallback ,
498
+ xyPlottingCallback ,
473
499
writer } :
474
500
new Callback [] {writer };
475
501
solve (dt , mass , charge ,
0 commit comments