Results 1 to 14 of 14
Thread: ECG plot in a textfile
- 07-17-2007, 03:51 AM #1
Member
- Join Date
- Mar 2007
- Posts
- 16
- Rep Power
- 0
- 07-17-2007, 03:53 AM #2
Senior Member
- Join Date
- Mar 2007
- Posts
- 134
- Rep Power
- 0
Look at this , Tell me if this is what you needed ?
How can i display a line graph.. just like real time
- 01-28-2012, 12:29 PM #3
Member
- Join Date
- Jan 2012
- Posts
- 17
- Rep Power
- 0
Re: ECG plot in a textfile
i have a same query..
i have ecg data stored in a text file, and i am plotting that data in jframe....
ecg data is as follows:
time volts
0.003 -0.145
0.006 -0.145
0.008 -0.145
...my entire data is getting plot as a straight line......even if i take a ecg signal of 60 minutes the voltage values are in decimals and are very less and they vary with time also very less...
i should be able to see the depths of d diagram.....there is where a noisy ECG signal lies...
can anyone plz help me....thanks in advance..:-)
- 01-28-2012, 01:12 PM #4
Re: ECG plot in a textfile
You need to show the code that is drawing the graph
- 01-28-2012, 01:44 PM #5
Member
- Join Date
- Jan 2012
- Posts
- 17
- Rep Power
- 0
Re: ECG plot in a textfile
Norm,..
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASIN G,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.translate(0, getHeight() - 100);
g2.scale(1, -1);
g2.setPaint(Color.green.darker());
int i=0;
for(; i < a2.length-1;)
{
double x1 = a1[i];
double y1 = a2[i];
double x2 = a1[i+1];
double y2 = a2[i+1];
i=i+2;
g2.draw(new Line2D.Double(x1, y1, x2, y2));
}
}
//where a1[] and a2[]are the arrays where time and voltage values are stored....
- 01-28-2012, 01:49 PM #6
Re: ECG plot in a textfile
What are the values of x1, x2, y1 and y2?
How are they computed?
- 01-28-2012, 02:16 PM #7
Member
- Join Date
- Jan 2012
- Posts
- 17
- Rep Power
- 0
Re: ECG plot in a textfile
x-axis values are time values...and y-axis values are voltage values..as i showed previously...:
time volts
0.003 -0.145
0.006 -0.145
0.008 -0.145
and they change very slowly...i mean voltage changes very slightly over a period of time.....
i do not calculate as uch....directly plot the points..................
but norm...i think u gave me an idea!!...should i calculate the values.. imean anything like 0.1=1+0.1....so that the graph becomes visible...??..
- 01-28-2012, 02:19 PM #8
Re: ECG plot in a textfile
Add a println to print out the values of x1, x2, y1, y2 so you can see what the code is trying to draw.
- 01-28-2012, 02:25 PM #9
Member
- Join Date
- Jan 2012
- Posts
- 17
- Rep Power
- 0
Re: ECG plot in a textfile
i had added....i saw..its all right values ...exactly whatever the file has...!...
i just removed it while showing it to u...
my question is:
it plots d graph...but as the values are very very less it gives a straight line on the output screen.....................
and i want to see orignal graph..as in make the graph more visible......
ie...as it would be in case of integer values..
- 01-28-2012, 02:31 PM #10
Re: ECG plot in a textfile
You probably have to scale the data to make the graph you want to see.
What is the range of the y values? What is the vertical size of the graph you want to plot?
How many pixels per unit of data? For example what is the different in y value for .12 and .13?
- 01-28-2012, 02:37 PM #11
Member
- Join Date
- Jan 2012
- Posts
- 17
- Rep Power
- 0
Re: ECG plot in a textfile
the range of y values is from -0.100 to say -0.700.........whereas x values vary from 0.0 t0 60.0...
iam new to java...
i dint understand what u meant by "How many pixels per unit of data? For example what is the different in y value for .12 and .13?"
- 01-28-2012, 02:51 PM #12
Re: ECG plot in a textfile
The size of the graph you are drawing is measured in pixels. My console is 1400 wide by 900 high.
If I want to plot data that is in the range of .1 to .7 then I have to scale it to my screen.
The max-min(delta) is .6. If I want to use 600 pixels vertically for the graph then I can show each .1 change in value by a 100 pixel change.
A .1 value would plot at y=600, a .7 value at y=0
- 01-28-2012, 03:05 PM #13
Member
- Join Date
- Jan 2012
- Posts
- 17
- Rep Power
- 0
Re: ECG plot in a textfile
heyy!!...it got plotted...i directly scaled d values..
something like this:
x1=x1*100
y1=y1*100....
yeah!!...i can c d ecg wave!!
- 01-28-2012, 04:02 PM #14
Re: ECG plot in a textfile
In future, don't resurrect an old dead thread. Ask your question in a new thread -- they're free.
This is a technical forum. Please use proper words..i can c d ecg wave!!
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Plot 2D graph in Java from RS-232 data
By spratana in forum Java 2DReplies: 4Last Post: 02-11-2009, 06:49 PM -
Need Help for Dot Plot Graph
By BHCluster in forum Java 2DReplies: 5Last Post: 04-15-2008, 02:54 PM -
Search TextFile
By gsupriyarao@yahoo.com in forum Advanced JavaReplies: 5Last Post: 04-11-2008, 11:03 AM -
textfile with Java problems
By saytri in forum New To JavaReplies: 4Last Post: 12-29-2007, 05:16 PM -
Textfile and GUI problems
By saytri in forum New To JavaReplies: 2Last Post: 12-21-2007, 04:08 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks