Forum Replies Created by dungeonlegend

Viewing 7 posts - 1 through 7 (of 7 total)
  • in reply to: How can I plot values from .txt file ? #6845

    By the way, I’ve been wondering that, why my .txt file just have a few numbers as the link I posted above but the code I used from you finally plo a lot of points, looks like it repeatedly do it again the whole number of values
    inside the .txt file. Please look at this link and you will know what I wanna say :

    http://ladykillernicky.uni.me/graph.php

    I’m using Firefox and Chrome to check them out but it shows the same results !!!

    I know what the things came wrong i< allLines.length, but I can’t solve this problem.

    • This reply was modified 10 years, 3 months ago by dungeonlegend.
    in reply to: How can I plot values from .txt file ? #6793

    Thank you so so much for helping me out, I have had some roughly day to deal with this problem. May be all I need now to have some extra function such as zoom or scale to analyze the graph more easier.

    Thank you with all shining stars above the sky !!! ^^

    Getting new knowledge everyday ! Thank you so much :)

    • This reply was modified 11 years, 3 months ago by dungeonlegend.

    Cause I’ve been WOW for a little while, and after getting back to work, sorry but I have to ask you more & more…

    1. what different in for() function between j < count and j < yVal.length, changing two type this condition get two different results

    2. if I set time = (new Date()).getTime(); and than take time++ for seeking x Axis by time, is it the same as time.setSeconds(time.getSeconds() + 1); in your code ?

    3. whats yVal[updateCount % yVal.length] mean ? Sorry I can’t get it :)

    • This reply was modified 11 years, 3 months ago by dungeonlegend.

    I have checked back my code and it still running as well :|, but as I can say, what you just did above exactly the same idea I ever want, even better than I could do, you plot every each items in array while I just could plot the whole series points. Although It still have a few difference things, but is it ok if I’ll turn back and get to ask you later ? Million thanks and I really appreciate what you’ve done for me. Thank you again, wish you all the best wishes :)

    • This reply was modified 11 years, 3 months ago by dungeonlegend.

    Thank you ! But I still got a problem…

    <script type="text/javascript">
    	window.onload = function () {
    
    		var dps = []; // dataPoints
                    var instance = (new Date()).getTime();
    		var chart = new CanvasJS.Chart("chartContainer",{
    			title :{
    				text: "Live SpO2 Data"
    			},	
                            axisX:{
                            title: "Time",
                            valueFormatString:"hh:mm:ss"
                            },
     
                            axisY:{
                            title: "%SpO2",
                            },
    			data: [{
    				type: "spline",
                                    xValueType: "dateTime",
    				dataPoints: dps 
    			}]
    		});
    
    		var yVal = [0.02, 0.02, 0.02, 0.02, 0.05, 0.07, 0.06, 0.09, 0.06,-0.2, 0.9, 0.5, -0.1, 0.02, 0.02, 0.04, 0.1, 0.08, 0.03, 0.02, 0.02, 0.02, 0.02, 0.02];	
    		var updateInterval = 1000;
    		var dataLength = 50; // number of dataPoints visible at any point
                  var time = (new Date()).getTime();
                 
    		var updateChart = function (count) {
    
    			count = count || 1;
    			// count is number of times loop runs to generate random dataPoints.
    
    			for (var j = 0; j < yVal.length; j++) {	
    			
                 
    				dps.push({
    					x: time,
    					y: yVal[j]
    				});
    				time++;
                  
                      
    			}; 
    			if (dps.length > dataLength)
    			{
    				dps.shift();				
    			}
    			
    			chart.render();		
    
    		};
    
    		// generates first set of dataPoints
    		updateChart(dataLength); 
     
    		// update chart after specified time. 
    		seInterval(function(){updateChart()}, updateInterval); 
    
    	}

    I can’t shift the frame, looks like it’s getting tighter and I can’t see the signal after few interval. I know the problem comes from if() function but I don’t know how to fix it. Can you try to use my code, you’ll see what I mean, please help me, I’m so close to get the final result !

    • This reply was modified 11 years, 3 months ago by dungeonlegend.
    in reply to: X Axis : display real system time #4877

    Thank you so much for helping me out ! I’ll try to fix my code right now !

Viewing 7 posts - 1 through 7 (of 7 total)