diff --git a/src/View/GraphGUI.java b/src/View/GraphGUI.java index b7cf087..ec8dff6 100644 --- a/src/View/GraphGUI.java +++ b/src/View/GraphGUI.java @@ -80,6 +80,8 @@ public class GraphGUI private XYSeriesCollection dataset; private XYPlot plot; + private TextTitle textSubTitle; + private JFreeChart chart; public GraphGUI(String path) { @@ -103,18 +105,17 @@ private void createStage() private void displaySmallestEnclosingCircle() { - TextTitle textTitle = new TextTitle("Current Point: None"); - textTitle.setFont(new Font("SansSerif", Font.PLAIN, 12)); + textSubTitle = new TextTitle("Current Point: None"); + textSubTitle.setFont(new Font("SansSerif", Font.PLAIN, 12)); makeSeries(); makePlots(); - JFreeChart chart = new JFreeChart(plot); - chart.setTitle("Smallest Enclosing Circle"); - chart.addSubtitle(textTitle); + + //--------------------- ChartViewer viewer = new ChartViewer(chart); //--------------------------------------------------------------------------- - viewer.addChartMouseListener(new CustomMouseListener(textTitle)); + viewer.addChartMouseListener(new CustomMouseListener(textSubTitle)); //-------------------------------------------------- circleStage.setScene(new Scene(viewer)); @@ -124,8 +125,8 @@ private void makeSeries() { XYSeries series1 = new XYSeries("allPoints -> "+(dataBase.getAllPointsSize()-1)); XYSeries series2 = new XYSeries("convexPoints -> "+(dataBase.getConvexPointsSize()-1)); - XYSeries series3 = new XYSeries("circlePoints -> "+(dataBase.getCirclePointsSize()-1)); - + XYSeries series3 = new XYSeries("circlePoints -> "+(dataBase.getCirclePointsSize()-1)); + dataset = new XYSeriesCollection(); for(int i=0; i