Draw Line Graph in Java Applet
import java.awt.*; import java.applet.*; public class Line_Graph extends Applet { int x[]={ 0, 60, 120, 180, 240, 300, 360, 400}; int y[]={ 400, 280, 220, 140, 60, 60, 100, 220}; int z=x.length; public void paint(Graphics g) { g.drawPolygon(x, y, z); } }
<html> <head> </head> <body> <applet code = "Line_Graph.class" width = "640" height = "480"></applet> </body> </html>
Output: