class StatDisplayUtils {

    public static AreaChart<Number, Number> buildAreaChart(LinkedList<FixationPoint> points, final Region root) {

        final NumberAxis xAxis = new NumberAxis();
        final NumberAxis yAxis = new NumberAxis();

        xAxis.setTickLabelsVisible(false);
        yAxis.setLabel("Coordinates");

        AreaChart<Number, Number> colorBands = new AreaChart<>(xAxis, yAxis);
        colorBands.setTitle("Color Bands");

        colorBands.setCreateSymbols(true);
        colorBands.setLegendVisible(true);

        if (points.size() > 0) {

            Series<Number, Number> xEyeCoordinates = new Series<>();
            xEyeCoordinates.setName("X coordinate");

            Series<Number, Number> yEyeCoordinates = new Series<>();
            yEyeCoordinates.setName("Y coordinate");

            for (FixationPoint p : points) {
                xEyeCoordinates.getData().add(new Data<>(p.getTimeGaze(), p.getY()));
                yEyeCoordinates.getData().add(new Data<>(p.getTimeGaze(), p.getX()));
            }

            colorBands.getData().addAll(xEyeCoordinates, yEyeCoordinates);

            EventHandler<Event> openAreaChartEvent = createZoomInAreaChartEventHandler(colorBands, root);

            colorBands.addEventHandler(MouseEvent.MOUSE_CLICKED, openAreaChartEvent);

            root.widthProperty().addListener(
                (observable, oldValue, newValue) -> colorBands.setMaxWidth(newValue.doubleValue() * 0.4));
            root.heightProperty().addListener(
                (observable, oldValue, newValue) -> colorBands.setMaxHeight(newValue.doubleValue() * 0.4));
            colorBands.setMaxWidth(root.getWidth() * 0.4);
            colorBands.setMaxHeight(root.getHeight() * 0.4);

            return colorBands;
        } else
            return null;
    }

}