/*
- * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- *
+ * Sixth 3D engine. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
*/
-
package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
import eu.svjatoslav.sixth.e3d.geometry.Point2D;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape;
import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas.TextCanvas;
-import java.io.IOException;
import java.util.List;
public class Graph extends AbstractCompositeShape {
private final Color plotColor;
public Graph(final double scale, final List<Point2D> data,
- final String label, final Point3D location) throws IOException {
+ final String label, final Point3D location) {
super(location);
width = 20;
plotColor = new Color(255, 0, 0, 100);
addVerticalLines(scale);
- addXlabels(scale);
+ addXLabels(scale);
addHorizontalLinesAndLabels(scale);
plotData(scale, data);
addShape(labelCanvas);
}
- public void addHorizontalLinesAndLabels(final double scale)
- throws IOException {
+ private void addHorizontalLinesAndLabels(final double scale) {
for (double y = yMin; y <= yMax; y += verticalStep) {
final Point3D p1 = new Point3D(0, y, 0).scaleUp(scale);
}
}
- public void addVerticalLines(final double scale) {
+ private void addVerticalLines(final double scale) {
for (double x = 0; x <= width; x += horizontalStep) {
final Point3D p1 = new Point3D(x, yMin, 0).scaleUp(scale);
}
}
- public void addXlabels(final double scale) throws IOException {
+ private void addXLabels(final double scale) {
for (double x = 0; x <= width; x += horizontalStep * 2) {
final Point3D labelLocation = new Point3D(x, yMin - 0.4, 0)
.scaleUp(scale);
}
}
- public void plotData(final double scale, final List<Point2D> data) {
+ private void plotData(final double scale, final List<Point2D> data) {
Point3D previousPoint = null;
for (final Point2D point : data) {