- added more options to access grid picture, web structure picture and network graphics

- remove test class


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7770 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent efcd21e0ed
commit 2683162ec5

@ -11,7 +11,7 @@
<script type="text/javascript">
<!--
imagestub = "AccessPicture_p.png?width=1024&height=576&bgcolor=FFFFFF&ct=5000&coronaangle=";
imagestub = "AccessPicture_p.png?width=1024&height=576&colorback=FFFFFF&amp;colortext=AAAAAA&amp;colorgrid=333333&amp;colordot=33CC33&amp;colorline=555555&ct=5000&coronaangle=";
imageanimindex = 0;
imageloadindex = 0;
imagecycles = 0;
@ -53,7 +53,7 @@
<p>This images shows incoming connections to your YaCy peer and outgoing connections from your peer to other peers and web servers</p>
<div class="left">
<p>
<a href="AccessPicture_p.png?width=1024&amp;height=576&amp;bgcolor=FFFFFF"><img id="AccessPicture" src="AccessPicture_p.png?width=1024&amp;height=576&amp;bgcolor=FFFFFF&amp;coronaangle=0" alt="YaCy Access Grid" width="1024" height="576" /></a>
<a href="AccessPicture_p.png?width=1024&amp;height=576&amp;colorback=FFFFFF&amp;colortext=AAAAAA&amp;colorgrid=333333&amp;colordot=33CC33&amp;colorline=555555"><img id="AccessPicture" src="AccessPicture_p.png?width=1024&amp;height=576&amp;bgcolor=FFFFFF&amp;coronaangle=0" alt="YaCy Access Grid" width="1024" height="576" /></a>
</p>
</div>

@ -32,7 +32,6 @@ import net.yacy.cora.protocol.RequestHeader;
import net.yacy.visualization.HexGridPlotter;
import net.yacy.visualization.PrintTool;
import net.yacy.visualization.RasterPlotter;
import net.yacy.visualization.RasterPlotter.DrawMode;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -76,17 +75,18 @@ public class AccessPicture_p {
if (height < 24) height = 24;
if (height > 10000) height = 10000;
final HexGridPlotter picture = new HexGridPlotter(width, height, DrawMode.MODE_SUB, color_back, cellsize);
final RasterPlotter.DrawMode drawMode = (RasterPlotter.darkColor(color_back)) ? RasterPlotter.DrawMode.MODE_ADD : RasterPlotter.DrawMode.MODE_SUB;
final HexGridPlotter picture = new HexGridPlotter(width, height, drawMode, color_back, cellsize);
picture.drawGrid(color_grid);
// calculate dimensions for left and right column
int gridLeft = 0;
final int gridLeft = 0;
int gridRight = picture.gridWidth() - 2;
if ((gridRight & 1) == 0) gridRight--;
// draw home peer
int centerx = (picture.gridWidth() >> 1) - 1;
int centery = picture.gridHeight() >> 1;
final int centerx = (picture.gridWidth() >> 1) - 1;
final int centery = picture.gridHeight() >> 1;
picture.setColor(color_dot);
picture.gridDot(centerx, centery, 5, true, 100);
if (corona) {
@ -101,25 +101,25 @@ public class AccessPicture_p {
picture.gridPrint(centerx, centery, 5, "THIS YACY PEER", "\"" + sb.peers.myName().toUpperCase() + "\"", 0);
// left column: collect data for access from outside
int verticalSlots = (picture.gridHeight() >> 1) - 1;
String[] hosts = new String[verticalSlots];
int[] time = new int[verticalSlots];
int[] count = new int[verticalSlots];
final int verticalSlots = (picture.gridHeight() >> 1) - 1;
final String[] hosts = new String[verticalSlots];
final int[] time = new int[verticalSlots];
final int[] count = new int[verticalSlots];
for (int i = 0; i < verticalSlots; i++) {hosts[i] = null; time[i] = 0; count[i] = 0;}
String host;
int c, h;
for (int j = 0; j < times.length; j++) {
Iterator<String> i = sb.accessHosts();
for (final int time2 : times) {
final Iterator<String> i = sb.accessHosts();
try {
while (i.hasNext()) {
host = i.next();
c = sb.latestAccessCount(host, times[j]);
c = sb.latestAccessCount(host, time2);
if (c > 0) {
h = (Math.abs(host.hashCode())) % hosts.length;
hosts[h] = host;
count[h] = c;
time[h] = times[j];
time[h] = time2;
}
}
} catch (final ConcurrentModificationException e) {} // we don't want to synchronize this

@ -37,10 +37,9 @@ import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.order.Base64Order;
import net.yacy.visualization.GraphPlotter;
import net.yacy.visualization.PrintTool;
import net.yacy.visualization.RasterPlotter;
import net.yacy.visualization.GraphPlotter;
import de.anomic.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -65,6 +64,8 @@ public class WebStructurePicture_p {
int nodes = 100; // maximum number of host nodes that are painted
int time = -1;
String host = null;
boolean corona = false;
int coronaangle = 0;
if (post != null) {
width = post.getInt("width", 1024);
@ -78,6 +79,8 @@ public class WebStructurePicture_p {
color_dot = post.get("colordot", color_dot);
color_line = post.get("colorline", color_line);
color_lineend = post.get("colorlineend", color_lineend);
corona = post.getBoolean("corona", true);
coronaangle = (corona) ? post.getInt("coronaangle", 0) : -1;
}
// too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
@ -99,7 +102,8 @@ public class WebStructurePicture_p {
final RasterPlotter graphPicture;
if (host == null) {
// probably no information available
graphPicture = new RasterPlotter(width, height, RasterPlotter.DrawMode.MODE_SUB, color_back);
final RasterPlotter.DrawMode drawMode = (RasterPlotter.darkColor(color_back)) ? RasterPlotter.DrawMode.MODE_ADD : RasterPlotter.DrawMode.MODE_SUB;
graphPicture = new RasterPlotter(width, height, drawMode, color_back);
PrintTool.print(graphPicture, width / 2, height / 2, 0, "NO WEB STRUCTURE DATA AVAILABLE.", 0);
PrintTool.print(graphPicture, width / 2, height / 2 + 16, 0, "START A WEB CRAWL TO OBTAIN STRUCTURE DATA.", 0);
} else {
@ -112,7 +116,7 @@ public class WebStructurePicture_p {
// recursively find domains, up to a specific depth
final GraphPlotter graph = new GraphPlotter();
if (host != null && hash != null) place(graph, sb.webStructure, hash, host, nodes, timeout, 0.0, 0.0, 0, depth);
if (host != null && hash != null) place(graph, sb.webStructure, hash, host, nodes, timeout, 0.0, 0.0, 0, depth, coronaangle);
//graph.print();
graphPicture = graph.draw(width, height, 40, 40, 16, 16, color_back, color_dot, color_line, color_lineend, color_text);
@ -127,10 +131,13 @@ public class WebStructurePicture_p {
}
private static final int place(final GraphPlotter graph, final WebStructureGraph structure, final String centerhash, final String centerhost, int maxnodes, final long timeout, final double x, final double y, int nextlayer, final int maxlayer) {
private static final int place(
final GraphPlotter graph, final WebStructureGraph structure, final String centerhash, final String centerhost,
int maxnodes, final long timeout, final double x, final double y, int nextlayer, final int maxlayer,
final int coronaangle) {
// returns the number of nodes that had been placed
assert centerhost != null;
GraphPlotter.coordinate center = graph.getPoint(centerhost);
final GraphPlotter.coordinate center = graph.getPoint(centerhost);
int mynodes = 0;
if (center == null) {
graph.addPoint(centerhost, x, y, nextlayer);
@ -140,7 +147,7 @@ public class WebStructurePicture_p {
if (nextlayer == maxlayer) return mynodes;
nextlayer++;
final double radius = 1.0 / (1 << nextlayer);
WebStructureGraph.StructureEntry sr = structure.outgoingReferences(centerhash);
final WebStructureGraph.StructureEntry sr = structure.outgoingReferences(centerhash);
final Map<String, Integer> next = (sr == null) ? new HashMap<String, Integer>() : sr.references;
Map.Entry<String, Integer> entry;
String targethash, targethost;
@ -162,7 +169,7 @@ public class WebStructurePicture_p {
targets.add(new String[] {targethash, targethost});
if (graph.getPoint(targethost) != null) continue;
// set a new point. It is placed on a circle around the host point
final double angle = Base64Order.enhancedCoder.cardinal((targethash + "____").getBytes()) / maxlongd * 2 * Math.PI;
final double angle = ((Base64Order.enhancedCoder.cardinal((targethash + "____").getBytes()) / maxlongd) + (coronaangle / 360.0d)) * 2.0d * Math.PI;
//System.out.println("ANGLE = " + angle);
rr = radius * 0.25 * (1 - targetrefs / (double) maxtargetrefs);
re = radius * 0.5 * (thisrefs / (double) maxthisrefs);
@ -180,7 +187,7 @@ public class WebStructurePicture_p {
targethost = target[1];
final GraphPlotter.coordinate c = graph.getPoint(targethost);
assert c != null;
nextnodes = ((maxnodes <= 0) || (System.currentTimeMillis() >= timeout)) ? 0 : place(graph, structure, targethash, targethost, maxnodes, timeout, c.x, c.y, nextlayer, maxlayer);
nextnodes = ((maxnodes <= 0) || (System.currentTimeMillis() >= timeout)) ? 0 : place(graph, structure, targethash, targethost, maxnodes, timeout, c.x, c.y, nextlayer, maxlayer, coronaangle);
mynodes += nextnodes;
maxnodes -= nextnodes;
graph.setBorder(centerhost, targethost);

@ -39,7 +39,6 @@ import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.logging.Log;
import net.yacy.visualization.PrintTool;
import net.yacy.visualization.RasterPlotter;
import de.anomic.search.QueryParams;
import de.anomic.search.SearchEvent;
import de.anomic.search.SearchEventCache;
@ -135,19 +134,19 @@ public class NetworkGraph {
int angle;
// draw in the primary search peers
for (int j = 0; j < primarySearches.length; j++) {
if (primarySearches[j] == null) continue;
eventPicture.setColor((primarySearches[j].isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(primarySearches[j].target().hash), null)) / ((double) Long.MAX_VALUE)));
for (final yacySearch primarySearche : primarySearches) {
if (primarySearche == null) continue;
eventPicture.setColor((primarySearche.isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(primarySearche.target().hash), null)) / ((double) Long.MAX_VALUE)));
eventPicture.arcLine(cx, cy, cr - 20, cr, angle, true, null, null, -1, -1, -1, false);
}
// draw in the secondary search peers
if (secondarySearches != null) {
for (int j = 0; j < secondarySearches.length; j++) {
if (secondarySearches[j] == null) continue;
eventPicture.setColor((secondarySearches[j].isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(secondarySearches[j].target().hash), null)) / ((double) Long.MAX_VALUE)));
for (final yacySearch secondarySearche : secondarySearches) {
if (secondarySearche == null) continue;
eventPicture.setColor((secondarySearche.isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(UTF8.getBytes(secondarySearche.target().hash), null)) / ((double) Long.MAX_VALUE)));
eventPicture.arcLine(cx, cy, cr - 10, cr, angle - 1, true, null, null, -1, -1, -1, false);
eventPicture.arcLine(cx, cy, cr - 10, cr, angle + 1, true, null, null, -1, -1, -1, false);
}
@ -158,9 +157,9 @@ public class NetworkGraph {
final Iterator<byte[]> i = query.queryHashes.iterator();
eventPicture.setColor(RasterPlotter.GREY);
while (i.hasNext()) {
long[] positions = seedDB.scheme.dhtPositions(i.next());
for (int j = 0; j < positions.length; j++) {
angle = (int) (360.0 * (((double) positions[j]) / ((double) Long.MAX_VALUE)));
final long[] positions = seedDB.scheme.dhtPositions(i.next());
for (final long position : positions) {
angle = (int) (360.0 * (((double) position) / ((double) Long.MAX_VALUE)));
eventPicture.arcLine(cx, cy, cr - 20, cr, angle, true, null, null, -1, -1, -1, false);
}
}
@ -177,14 +176,15 @@ public class NetworkGraph {
final int passiveLimit, final int potentialLimit,
final int maxCount, final int coronaangle,
final long communicationTimeout,
final String networkName, final String networkTitle, final String bgcolor) {
final String networkName, final String networkTitle, final String color_back) {
RasterPlotter networkPicture = new RasterPlotter(width, height, (bgcolor.equals("000000")) ? RasterPlotter.DrawMode.MODE_ADD : RasterPlotter.DrawMode.MODE_SUB, bgcolor);
final RasterPlotter.DrawMode drawMode = (RasterPlotter.darkColor(color_back)) ? RasterPlotter.DrawMode.MODE_ADD : RasterPlotter.DrawMode.MODE_SUB;
final RasterPlotter networkPicture = new RasterPlotter(width, height, drawMode, color_back);
if (seedDB == null) return networkPicture; // no other peers known
final int maxradius = Math.min(width, height) / 2;
final int innerradius = maxradius * 4 / 10;
int outerradius = maxradius - 20;
final int outerradius = maxradius - 20;
// draw network circle
networkPicture.setColor(COL_DHTCIRCLE);
@ -253,15 +253,15 @@ public class NetworkGraph {
// draw DHT activity
if (communicationTimeout >= 0) {
Date horizon = new Date(System.currentTimeMillis() - communicationTimeout);
for (Hit event: yacyChannel.channels(yacyChannel.DHTRECEIVE)) {
final Date horizon = new Date(System.currentTimeMillis() - communicationTimeout);
for (final Hit event: yacyChannel.channels(yacyChannel.DHTRECEIVE)) {
if (event == null || event.getPubDate() == null) continue;
if (event.getPubDate().after(horizon)) {
//System.out.println("*** NETWORK-DHTRECEIVE: " + event.getLink());
drawNetworkPictureDHT(networkPicture, width / 2, height / 2, innerradius, seedDB.mySeed(), seedDB.get(event.getLink()), COL_DHTIN, coronaangle, false);
}
}
for (Hit event: yacyChannel.channels(yacyChannel.DHTSEND)) {
for (final Hit event: yacyChannel.channels(yacyChannel.DHTSEND)) {
if (event == null || event.getPubDate() == null) continue;
if (event.getPubDate().after(horizon)) {
//System.out.println("*** NETWORK-DHTSEND: " + event.getLink());
@ -280,7 +280,7 @@ public class NetworkGraph {
return networkPicture;
}
private static void drawNetworkPictureDHT(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final yacySeed mySeed, final yacySeed otherSeed, final String colorLine, final int coronaangle, boolean out) {
private static void drawNetworkPictureDHT(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final yacySeed mySeed, final yacySeed otherSeed, final String colorLine, final int coronaangle, final boolean out) {
final int angleMy = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(mySeed.hash), null)) / ((double) Long.MAX_VALUE)));
final int angleOther = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(ASCII.getBytes(otherSeed.hash), null)) / ((double) Long.MAX_VALUE)));
// draw line
@ -317,31 +317,31 @@ public class NetworkGraph {
PrintTool.arcPrint(img, centerX, centerY, innerradius + linelength, angle, name);
// draw corona around dot for crawling activity
int ppmx = seed.getPPM() / 30;
final int ppmx = seed.getPPM() / 30;
if (coronaangle >= 0 && ppmx > 0) {
drawCorona(img, centerX, centerY, innerradius, angle, dotsize, ppmx, coronaangle, true, false, 24, 24, 24); // color = 0..63
}
// draw corona around dot for query activity
int qphx = ((int) (seed.getQPM() * 4.0));
final int qphx = ((int) (seed.getQPM() * 4.0));
if (coronaangle >= 0 && qphx > 0) {
drawCorona(img, centerX, centerY, innerradius, angle, dotsize, qphx, coronaangle, false, true, 8, 62, 8); // color = 0..63
}
}
private static void drawCorona(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, int angle, int dotsize, int strength, int coronaangle, boolean inside, boolean split, int r, int g, int b) {
double ca = Math.PI * 2.0 * ((double) coronaangle) / 360.0;
private static void drawCorona(final RasterPlotter img, final int centerX, final int centerY, final int innerradius, final int angle, final int dotsize, int strength, final int coronaangle, final boolean inside, final boolean split, final int r, final int g, final int b) {
final double ca = Math.PI * 2.0 * (coronaangle) / 360.0;
if (strength > 4) strength = 4;
// draw a wave around crawling peers
double wave;
final int waveradius = innerradius / 2;
int segments = 72;
final int segments = 72;
for (int radius = 0; radius < waveradius; radius++) {
wave = ((double) (waveradius - radius) * strength) * (1.0 + Math.sin(Math.PI * 16 * radius / waveradius + ((inside) ? ca : -ca))) / 2.0 / (double) waveradius;
wave = ((double) (waveradius - radius) * strength) * (1.0 + Math.sin(Math.PI * 16 * radius / waveradius + ((inside) ? ca : -ca))) / 2.0 / waveradius;
img.setColor(((((long) (r * wave)) & 0xff) << 16) | (((long) ((g * wave)) & 0xff) << 8) | ((((long) (b * wave))) & 0xff));
if (split) {
for (int i = 0; i < segments; i++) {
int a = (coronaangle + 360 * i) / segments;
final int a = (coronaangle + 360 * i) / segments;
img.arcArc(centerX, centerY, innerradius, angle, dotsize + radius, dotsize + radius, a, a + 180/segments);
}
} else {

@ -1,39 +0,0 @@
package net.yacy;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class screenshot {
/*
try {
Robot robot = new Robot();
Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage bufferedImage = robot.createScreenCapture(area);
} catch (AWTException e) {
}
*/
public static void main(final String[] args) throws Exception {
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreenSize();
final Rectangle screenRect = new Rectangle(screenSize);
// create screen shot
final Robot robot = new Robot();
final BufferedImage image = robot.createScreenCapture(screenRect);
final String outFileName = "test.png";
// save captured image to PNG file
ImageIO.write(image, "png", new File(outFileName));
// give feedback
System.out.println("Saved screen shot (" + image.getWidth() + " x " + image.getHeight() + " pixels) to file \"" + outFileName + "\".");
}
}

@ -45,21 +45,21 @@ public class GraphPlotter {
// a ymageGraph is a set of points and borders between the points
// to reference the points, they must all have a nickname
private Map<String, coordinate> points;
private Set<String> borders;
private final Map<String, coordinate> points;
private final Set<String> borders;
private double leftmost, rightmost, topmost, bottommost;
public GraphPlotter() {
points = new HashMap<String, coordinate>();
borders = new HashSet<String>();
leftmost = 1.0;
rightmost = -1.0;
topmost = -1.0;
bottommost = 1.0;
this.points = new HashMap<String, coordinate>();
this.borders = new HashSet<String>();
this.leftmost = 1.0;
this.rightmost = -1.0;
this.topmost = -1.0;
this.bottommost = 1.0;
}
public coordinate getPoint(final String name) {
return points.get(name);
return this.points.get(name);
}
public coordinate[] getBorder(final String name) {
@ -73,25 +73,25 @@ public class GraphPlotter {
public coordinate addPoint(final String name, final double x, final double y, final int layer) {
final coordinate newc = new coordinate(x, y, layer);
final coordinate oldc = points.put(name, newc);
final coordinate oldc = this.points.put(name, newc);
assert oldc == null; // all add shall be unique
if (x > rightmost) rightmost = x;
if (x < leftmost) leftmost = x;
if (y > topmost) topmost = y;
if (y < bottommost) bottommost = y;
if (x > this.rightmost) this.rightmost = x;
if (x < this.leftmost) this.leftmost = x;
if (y > this.topmost) this.topmost = y;
if (y < this.bottommost) this.bottommost = y;
return newc;
}
public boolean hasBorder(final String fromPoint, final String toPoint) {
return borders.contains(fromPoint + "-" + toPoint);
return this.borders.contains(fromPoint + "-" + toPoint);
}
public void setBorder(final String fromPoint, final String toPoint) {
final coordinate from = points.get(fromPoint);
final coordinate to = points.get(toPoint);
final coordinate from = this.points.get(fromPoint);
final coordinate to = this.points.get(toPoint);
assert from != null;
assert to != null;
borders.add(fromPoint + "$" + toPoint);
this.borders.add(fromPoint + "$" + toPoint);
}
public static class coordinate {
@ -110,7 +110,7 @@ public class GraphPlotter {
public void print() {
// for debug purpose: print out all coordinates
final Iterator<Map.Entry<String, coordinate>> i = points.entrySet().iterator();
final Iterator<Map.Entry<String, coordinate>> i = this.points.entrySet().iterator();
Map.Entry<String, coordinate> entry;
String name;
coordinate c;
@ -120,7 +120,7 @@ public class GraphPlotter {
c = entry.getValue();
System.out.println("point(" + c.x + ", " + c.y + ", " + c.layer + ") [" + name + "]");
}
final Iterator<String> j = borders.iterator();
final Iterator<String> j = this.borders.iterator();
while (j.hasNext()) {
System.out.println("border(" + j.next() + ")");
}
@ -139,15 +139,14 @@ public class GraphPlotter {
final String color_lineend,
final String color_text
) {
RasterPlotter.DrawMode drawMode = RasterPlotter.DrawMode.MODE_SUB;
if (RasterPlotter.darkColor(color_back)) drawMode = RasterPlotter.DrawMode.MODE_ADD;
final RasterPlotter.DrawMode drawMode = (RasterPlotter.darkColor(color_back)) ? RasterPlotter.DrawMode.MODE_ADD : RasterPlotter.DrawMode.MODE_SUB;
final RasterPlotter image = new RasterPlotter(width, height, drawMode, color_back);
final double xfactor = ((rightmost - leftmost) == 0.0) ? 0.0 : (width - leftborder - rightborder) / (rightmost - leftmost);
final double yfactor = ((topmost - bottommost) == 0.0) ? 0.0 : (height - topborder - bottomborder) / (topmost - bottommost);
final double xfactor = ((this.rightmost - this.leftmost) == 0.0) ? 0.0 : (width - leftborder - rightborder) / (this.rightmost - this.leftmost);
final double yfactor = ((this.topmost - this.bottommost) == 0.0) ? 0.0 : (height - topborder - bottomborder) / (this.topmost - this.bottommost);
// draw dots and names
final Iterator<Map.Entry<String, coordinate>> i = points.entrySet().iterator();
final Iterator<Map.Entry<String, coordinate>> i = this.points.entrySet().iterator();
Map.Entry<String, coordinate> entry;
String name;
coordinate c;
@ -156,8 +155,8 @@ public class GraphPlotter {
entry = i.next();
name = entry.getKey();
c = entry.getValue();
x = (xfactor == 0.0) ? width / 2 : (int) (leftborder + (c.x - leftmost) * xfactor);
y = (yfactor == 0.0) ? height / 2 : (int) (height - bottomborder - (c.y - bottommost) * yfactor);
x = (xfactor == 0.0) ? width / 2 : (int) (leftborder + (c.x - this.leftmost) * xfactor);
y = (yfactor == 0.0) ? height / 2 : (int) (height - bottomborder - (c.y - this.bottommost) * yfactor);
image.setColor(color_dot);
image.dot(x, y, 6, true, 100);
image.setColor(color_text);
@ -165,7 +164,7 @@ public class GraphPlotter {
}
// draw lines
final Iterator<String> j = borders.iterator();
final Iterator<String> j = this.borders.iterator();
coordinate[] border;
image.setColor(color_line);
int x0, x1, y0, y1;
@ -176,15 +175,15 @@ public class GraphPlotter {
x0 = width / 2;
x1 = width / 2;
} else {
x0 = (int) (leftborder + (border[0].x - leftmost) * xfactor);
x1 = (int) (leftborder + (border[1].x - leftmost) * xfactor);
x0 = (int) (leftborder + (border[0].x - this.leftmost) * xfactor);
x1 = (int) (leftborder + (border[1].x - this.leftmost) * xfactor);
}
if (yfactor == 0.0) {
y0 = height / 2;
y1 = height / 2;
} else {
y0 = (int) (height - bottomborder - (border[0].y - bottommost) * yfactor);
y1 = (int) (height - bottomborder - (border[1].y - bottommost) * yfactor);
y0 = (int) (height - bottomborder - (border[0].y - this.bottommost) * yfactor);
y1 = (int) (height - bottomborder - (border[1].y - this.bottommost) * yfactor);
}
// draw the line, with the dot at the beginning of the line
image.lineDot(x1, y1, x0, y0, 3, 4, color_line, color_lineend);

Loading…
Cancel
Save