hw can we plot a graph from the data given in a flat file
i need a program that reads a file with 2 columns:
- time in minutes for the x axis
- value (e.g. temperature, heart freq.) for the y axis
Plot the last m minutes, the y axis shall have a range from min...max.
Start with parameter values m=5, speed s=1, min=20, max=120.
After m=5 minutes, the graphical display shall plot the curve of the
last 5 minutes. In other words, you have to implement a sliding window
with a 5 minute history
The speed s is useful for testing, 1=real time, 10=10 times faster.
To implement the real time behaviour, you have to let the program wait the
time interval between two values. The time interval is not constant.
A sample file looks like this (lines 1..3 are always comments):
-8<-cut-here-8<-
Logfile of program temperature_monitor.cpp
Temp sensor #42, range 30..60 degrees Celsius
2007-06-21 20:30
0.017737 45.2
0.045122 42.7
0.073591 43.1
[...]
-8<-cut-here-8<-
You can download the test data file here:
http://alf42.dyndns.org/oost/temp_testdata_2007-06-21
An axample how the output can look like is here:
http://alf42.dyndns.org/oost/temperature_diagram_example.gif
> i need a program
Okay, thanks for letting us know. Did you have a question of some sort?
~
hi
can any one of you ca provide me the code for the following out put and the data is also given in the links
You can download the test data file here:
http://alf42.dyndns.org/oost/temp_testdata_2007-06-21
An axample how the output can look like is here:
http://alf42.dyndns.org/oost/temperature_diagram_example.gif
i am new to java i dont have that much knowledge on graphical libraries
> can any one of you ca provide me the code for the following out put and the data is also given in the links
http://www.rentacoder.com/
~
> i am new to java i dont have that much knowledge on
> graphical libraries
> Logfile of program temperature_monitor.cpp
Are you sure this is Java homework (and not C++)?
~
we can do it in any of the object oriented programming languages
C++ or Java
> we can do it in any of the object oriented
> programming languages C++ or Java
Okay. How much are you willing to pay someone to do your homework project?
~
> hi
> can any one of you ca provide me the code for the
> following out put and the data is also given in the
> links
No one will provide you code. Put your lazy @ss to work!
hi
i have tried the code for it and i am getting the barcharts but not the graph as the output
import java.awt.*;
import javax.servlet.*;
import java.lang.*;
import java.applet.*;
public class classfile{
int n=0;
String lable[];
int value[];
public void init()
{
try{
n= Integer.parseInt(getParameter("column"));
lable = new String[n];
value=new int[n];
lable[0]=getParameter("lable11");
lable[1]=getParameter("lable12");
lable[2]=getParameter("lable13");
lable[3]=getParameter("lable14");
value[0]=Integer.parseInt(getParamater("c1"));
value[1]=Integer.parseInt(getParamater("c2"));
value[2]=Integer.parseInt(getParamater("c3"));
value[3]=Integer.parseInt(getParamater("c4"));
}
catch(NullFormatException e )
{
System.out.println("Null format Exception");
}
}
public void pain(Graphics g)
{
for(int i=0;i<n;i++)
{
g.steColor(color.red);
g.drawString(lable, 20, i*50+30);
g.fillRect(50, i*50+20, value, 40);
}
}
}>
> hi
> i have tried the code for it and i am getting the
> barcharts but not the graph as the output
>
Your code is rubbish. You also did not use code tags. But let's examine the rubbish points shall we?
> import java.awt.*;
> import javax.servlet.*;
There is no need for you to import servlet here. Especially as this later appears to be an applet.
> import java.lang.*;
Importing java.lang is redundant.
> import java.applet.*;
> public class classfile{
This is a poorly named class for several reasons. One it does not follow conventions, class names should begin with a capital letter. Two classfile is just a stupid name.
Also your class should most likely extend applet if indeed you mean to write an applet. This is probably pointless because you probably don't mean to write an applet, it's just that you have no clue.
>
> int n=0;
>String lable[];
> int value[];
>
> blic void init()
>{
>try{
>n= Integer.parseInt(getParameter("column"));
n is pointless since everything is hardcoded anyways for four elements
>lable = new String[n];
>value=new int[n];
>lable[0]=getParameter("lable11");
>lable[1]=getParameter("lable12");
>lable[2]=getParameter("lable13");
>lable[3]=getParameter("lable14");
>
>
>value[0]=Integer.parseInt(getParamater("c1"));
>value[1]=Integer.parseInt(getParamater("c2"));
>value[2]=Integer.parseInt(getParamater("c3"));
>value[3]=Integer.parseInt(getParamater("c4"));
>}
>
>catch(NullFormatException e )
This is garbage.
>{
>System.out.println("Null format Exception");
>}
>
>
>
>
>public void pain(Graphics g)
While I am forced to agree with the sentiment here the correct name for this method is paint.
> {
>for(int i=0;i<n;i++)
> {
>g.steColor(color.red);
That is garbage for a variety of reasons.
> g.drawString(lable, 20, i*50+30);
>g.fillRect(50, i*50+20, value, 40);
> }
>}
So try again. Maybe learn some Java first? Just a suggestion.
