[report-utilities] centralise gnc:not-all-zeros

it is used by old chart module *and* reports
This commit is contained in:
Christopher Lam 2020-12-05 05:45:56 +08:00
parent d2f1cc0e37
commit 424676c31a
5 changed files with 6 additions and 38 deletions

View File

@ -249,17 +249,6 @@
(set! rownum (+ 1 rownum)))
newcol)))
(define (gnc:not-all-zeros data)
(define (myor list)
(begin
(gnc:debug "list" list)
(if (null? list) #f
(or (car list) (myor (cdr list))))))
(cond ((number? data) (not (= 0 data)))
((list? data) (myor (map gnc:not-all-zeros data)))
(else #f)))
(define (gnc:html-barchart-prepend-column! barchart newcol)
(let ((rows (gnc:html-barchart-data barchart))
(this-row #f)

View File

@ -304,17 +304,6 @@
(set! rownum (+ 1 rownum)))
newcol)))
(define (gnc:not-all-zeros data)
(define (myor list)
(begin
(gnc:debug "list" list)
(if (null? list) #f
(or (car list) (myor (cdr list))))))
(cond ((number? data) (not (= 0 data)))
((list? data) (myor (map gnc:not-all-zeros data)))
(else #f)))
(define (gnc:html-linechart-prepend-column! linechart newcol)
(let ((rows (gnc:html-linechart-data linechart))
(this-row #f)

View File

@ -151,14 +151,6 @@
(define gnc:html-piechart-set-button-3-legend-urls!
(record-modifier <html-piechart> 'button-3-legend-urls))
(define (gnc:not-all-zeros data)
(define (myor list)
(if (null? list) #f
(or (car list) (myor (cdr list)))))
(cond ((number? data) (not (= 0 data)))
((list? data) (myor (map gnc:not-all-zeros data)))
(else #f)))
(define (gnc:html-piechart-render piechart doc)
(let* ((chart (gnc:make-html-chart))
(title (gnc:html-piechart-title piechart))

View File

@ -132,14 +132,6 @@
scatter
(cons newpoint (gnc:html-scatter-data scatter)))))
(define (gnc:not-all-zeros data)
(define (myor list)
(if (null? list) #f
(or (car list) (myor (cdr list)))))
(cond ((number? data) (not (= 0 data)))
((list? data) (myor (map gnc:not-all-zeros data)))
(else #f)))
;; The Renderer
(define (gnc:html-scatter-render scatter doc)
(let* ((chart (gnc:make-html-chart))

View File

@ -974,6 +974,12 @@ query instead.")
;; ***************************************************************************
(define (gnc:not-all-zeros data)
(cond
((number? data) (not (= 0 data)))
((pair? data) (any gnc:not-all-zeros data))
(else #f)))
;; Adds "file:///" to the beginning of a URL if it doesn't already exist
;;
;; @param url URL