Megatest

Diff
Login

Differences From Artifact [7ee7c0b41a]:

To Artifact [c5b55537e1]:


2642
2643
2644
2645
2646
2647
2648
2649

2650
2651
2652
2653
2654
2655
2656




2657
2658
2659
2660











2661
2662

2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674


2675
2676
2677
2678
2679
2680
2681
2642
2643
2644
2645
2646
2647
2648

2649
2650
2651
2652
2653



2654
2655
2656
2657
2658
2659
2660

2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672

2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684

2685
2686
2687
2688
2689
2690
2691
2692
2693







-
+




-
-
-
+
+
+
+



-
+
+
+
+
+
+
+
+
+
+
+

-
+











-
+
+







	(let* ((dbdef  (list-ref parts 0))
	       (tablen (list-ref parts 1))
	       (timef  (list-ref parts 2))
	       (varfn  (list-ref parts 3))
	       (valfn  (list-ref parts 4))
	       (fields (cdr  (cddddr parts)))
	       (db     (dboard:graph-db-open dbdef))
	       (res    (make-hash-table)))
	       (res-ht (make-hash-table)))
	  (if db
	      (begin
		(for-each
		 (lambda (fieldname) ;; fields
		   (let ((qrystr (conc "SELECT " timef "," varfn "," valfn " FROM " tablen " WHERE " varfn "='" fieldname "' AND " timef " >= " tstart " AND " timef " <= " tend " ORDER BY " timef " ASC")))
		     (print "qrystr: " qrystr)
		     (hash-table-set! res fieldname ;; (fetch-rows (sql db qrystr)))))
		   (let ((all-dat-qrystr (conc "SELECT " timef "," varfn "," valfn " FROM " tablen " WHERE " varfn "='" fieldname "' AND " timef " >= " tstart " AND " timef " <= " tend " ORDER BY " timef " ASC"))
			 (zeroth-point   (conc "SELECT " timef "," varfn "," valfn " FROM " tablen " WHERE " varfn "='" fieldname "' AND " timef " < " tstart " LIMIT 1")))
		     (print "all-dat-qrystr: " all-dat-qrystr)
		     (hash-table-set! res-ht fieldname ;; (fetch-rows (sql db qrystr)))))
				      (sqlite3:fold-row
				       (lambda (res t var val)
					 (cons (vector t var val) res))
				       '() db qrystr))))
				       '() db all-dat-qrystr))
		     (let ((zeropt (handle-exceptions
				    exn
				    #f
				    (sqlite3:first-row db all-dat-qrystr))))
		       (if zeropt
			   (hash-table-set! res-ht
					    fieldname
					    (cons
					     (apply vector tstart (cdr zeropt))						    
					     (hash-table-ref/default res-ht fieldname '())))))))
		 fields)
		res)
		res-ht)
	      #f)))))
  
;; graph data 
;;  tsc=timescale, tfn=function; time->x
;;
(define (dboard:graph commondat tabdat tabnum llx lly ulx uly tstart tend tsc tfn compname cmargin)
  (let* ((dwg (dboard:tabdat-drawing tabdat))
	 (lib (vg:get/create-lib dwg "runslib"))
	 (cnv (dboard:tabdat-cnv tabdat))
	 (dur (- tstart tend)) ;; time duration
	 (cmp (vg:get-component dwg "runslib" compname))
	 (cfg (configf:get-section *configdat* "graph")))
	 (cfg (configf:get-section *configdat* "graph"))
	 (stdcolor (vg:rgb->number 20 30 40)))
    (vg:add-obj-to-comp
     cmp 
     (vg:make-rect-obj llx lly ulx uly))
    (for-each 
     (lambda (cf)
       (let* ((alldat  (dboard:graph-read-data (cadr cf) tstart tend)))
	 (if alldat
2695
2696
2697
2698
2699
2700
2701
2702

2703
2704
2705
2706
2707
2708
2709
2707
2708
2709
2710
2711
2712
2713

2714
2715
2716
2717
2718
2719
2720
2721







-
+







			   (let* ((tval  (vector-ref dpt 0))
				  (yval  (vector-ref dpt 2))
				  (stval (tfn tval))
				  (syval (yfunc yval)))
			     (vg:add-obj-to-comp
			      cmp 
			      (vg:make-rect-obj (- stval 2) lly (+ stval 2)(+ lly (* yval yscale))
						fill-color: (vg:rgb->number 50 50 50)))))
						fill-color: stdcolor))))
			 dat))))) ;; for each data point in the series
	      (hash-table-keys alldat)))))
     cfg)))
	 

;; run times tab
;;