Results 1 to 5 of 5
Thread: graph
 08072016, 03:24 PM #1Member
 Join Date
 Aug 2016
 Posts
 3
 Rep Power
 0
graph
I m real new to java.I want to know how can one create a graph where on xaxis =0,.....,1 and yaxis=0,.......,1000.now i want to know how to create such graph can be produce base on the number step you have enter(even grid).where the user can input the number of step but this steps are in within this interval on xaxis=[0,1],and on yaxis=[0,1000].please guys help!
 08072016, 03:38 PM #2
Re: graph
How is the graph to be displayed?
Do you want to write the code or do you want to use a package to draw the graph?
What have you tried?If you don't understand my response, don't ignore it, ask a question.
 08082016, 08:54 AM #3Member
 Join Date
 Aug 2016
 Posts
 3
 Rep Power
 0
Re: graph
I want to write the code and the graph should be like the graph of y=sqrt{x}.
 08082016, 08:59 AM #4Member
 Join Date
 Aug 2016
 Posts
 3
 Rep Power
 0
Re: graph
i have this code:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools  Templates
* and open the template in the editor.
*/
package fuctiongraph;
/**
*
* @author Moody
*/
public class FuctionGraph {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// number of line segments to plot
int n = Integer.parseInt(args[0]);
// the function y = sin(4x) + sin(20x), sampled at n+1 points
// between x = 0 and x = pi
double[] x = new double[n+1];
double[] y = new double[n+1];
for (int i = 0; i <= n; i++) {
x[i] = Math.PI * i / n;
y[i] = Math.sin(4*x[i]) + Math.sin(20*x[i]);
}
// rescale the coordinate system
StdDraw.setXscale(0, Math.PI);
StdDraw.setYscale(0.0, 1.0);
// plot the approximation to the function
for (int i = 0; i < n; i++) {
StdDraw.line(x[i], y[i], x[i+1], y[i+1]);
}
}
}
please if anyone can help
 08082016, 12:45 PM #5
Re: graph
Please edit your post and wrap your code with code tags:
[code]
**YOUR CODE GOES HERE**
[/code]
to get highlighting and preserve formatting.
The code doesn't have its import statements but
It looks like that code uses 3rd party packages and classes that not many people here are familiar with.If you don't understand my response, don't ignore it, ask a question.
Similar Threads

Bar Graph
By Gavin Fraser in forum Java 2DReplies: 4Last Post: 07012013, 05:37 AM 
scrollable graph on JFrame. (I've made the graph and I need it scrollable)
By noobplus in forum AWT / SwingReplies: 16Last Post: 03212012, 09:41 AM 
ECG Graph
By bharath333 in forum Java AppletsReplies: 4Last Post: 02142009, 10:26 PM 
Bar Graph
By Zosden in forum Advanced JavaReplies: 2Last Post: 04282008, 06:52 AM 
Help with graph's bar
By coco in forum Java 2DReplies: 1Last Post: 08072007, 07:44 AM
Bookmarks