Skip to content

Commit

Permalink
Update GraphGUI
Browse files Browse the repository at this point in the history
  • Loading branch information
johnprif committed Jan 13, 2023
1 parent df956ef commit bf2effb
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions src/View/GraphGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public class GraphGUI
private XYSeriesCollection dataset;

private XYPlot plot;
private TextTitle textSubTitle;
private JFreeChart chart;

public GraphGUI(String path)
{
Expand All @@ -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));
Expand All @@ -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<dataBase.getAllPointsSize(); i++)
{
Expand All @@ -141,7 +142,7 @@ private void makeSeries()
{
series3.add(dataBase.getCirclePoints().get(i).getX(), dataBase.getCirclePoints().get(i).getY());
}
dataset = new XYSeriesCollection();

dataset.addSeries(series3);
dataset.addSeries(series2);
dataset.addSeries(series1);
Expand All @@ -156,10 +157,11 @@ private void makePlots()
"Y", // Y-Axis Label
dataset // Dataset for the Chart
);
scatterPlot.setElementHinting(true);
scatterPlot.setTextAntiAlias(true);
scatterPlot.setNotify(true);
scatterPlot.setAntiAlias(true);
// scatterPlot.setElementHinting(true);
// scatterPlot.setTextAntiAlias(true);
// scatterPlot.setNotify(true);
// scatterPlot.setAntiAlias(true);
// scatterPlot.setBorderVisible(true);
plot = (XYPlot)scatterPlot.getPlot();
Ellipse2D circle = dataBase.findCircle(dataBase.getCirclePoints().get(0), dataBase.getCirclePoints().get(1), dataBase.getCirclePoints().get(2));
XYShapeAnnotation annotation = new XYShapeAnnotation(circle, new BasicStroke(1.0f), Color.BLACK, null);
Expand All @@ -171,6 +173,16 @@ private void makePlots()
plot.setDomainCrosshairVisible(true);
plot.setDomainZeroBaselineVisible(true);
plot.setOutlineVisible(true);

chart = new JFreeChart(plot);
chart.setTitle("Smallest Enclosing Circle");
chart.addSubtitle(textSubTitle);
//---------------------
chart.setElementHinting(true);
chart.setTextAntiAlias(true);
chart.setNotify(true);
chart.setAntiAlias(true);
chart.setBorderVisible(true);
}

}

0 comments on commit bf2effb

Please sign in to comment.