跪求大神帮忙,java 画坐标轴(两组数据)

Python020

跪求大神帮忙,java 画坐标轴(两组数据),第1张

要么找开源的作图插件,要么用JAVA操作matlab。

没做过这方面的东西,也不清楚你到底是不是只需要画个图,毕竟得从整体的需求来判断用什么技术比较好。只能给点思路了,单纯画图自然用作图表的插件

大概查了下,http://www.cnblogs.com/lixiaolun/archive/2012/08/10/2631856.html,也生成了个图不过可能比较简单。

搜索一下应该很容易找到SAMPLE,国外论坛应该更爱分享成果的。

国内关于JAVA操作第3方的软件的资料比较少。这种东西外文资料多,而国内外语过关又有实力又爱分享的人几乎没有

希望对你有帮助

public class test8888 extends JPanel

{

Polygon po = new Polygon()

Font fn = new Font("宋体", Font.BOLD, 22)

Font fn2 = new Font("宋体", Font.BOLD, 20)

int x = 100

int y = 100

int[] pox ={ 90, 100, 100 }

int[] poy ={ 110, 90, 100 }

int[] poxx ={ 100, 100, 110 }

int[] poyy ={ 90, 90, 110 }

int[] poxB = {687,697,707}

int[] poyB = {690,700,700}

int[] poxBB = {687,697,707}

int[] poyBB = {710,700,700}

public test8888()

{

setSize(900, 900)

}

public void paint(Graphics g)

{

super.paintComponent(g)

Graphics2D g2d = (Graphics2D) g

g2d.setColor(Color.black)

g2d.fillRect(99, 100, 2, 600)

g2d.fillRect(99, 700, 600, 2)

g2d.fillRect(100, 685, 15, 15)

for (int i = 0i <37i++)

{

g2d.drawLine(100 + i * 15, 600 + y, y + i * 15, y + 45)

g2d.drawLine(100, 600 + y - i * 15, y + 555, y + 600 - i * 15)

g2d.drawString("0", x - 20, 720)

if (i % 2 == 0 &&i / 2 != 0)

{

g2d.drawString(String.valueOf(i / 2), x - 20, 705 - i / 2 * 30)

g2d.drawString(String.valueOf(i / 2), x - 5 + i / 2 * 30, 720)

}

}

g2d.setFont(fn2)

g2d.setColor(Color.white)

g2d.drawString("A", 102, 700)

g2d.setFont(fn)

g2d.setColor(Color.black)

g2d.drawString("Y", 80, 140)

g2d.drawString("X", 670, 720)

g2d.fillPolygon(pox,poy,3)

g2d.fillPolygon(poxx,poyy,3)

g2d.fillPolygon(poxB,poyB,3)

g2d.fillPolygon(poxBB,poyBB,3)

g2d.dispose()

}

public static void main(String[] args)

{

JFrame jf = new JFrame()

jf.setSize(900, 900)

jf.setVisible(true)

jf.setDefaultCloseOperation(3)

jf.getContentPane().add(new test8888())

}

}