mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[html-chart] html-chart-set! don't convert list to vector
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
(use-modules (gnucash core-utils))
|
||||
(use-modules (gnucash json builder)) ;for building JSON options
|
||||
(use-modules (gnucash report html-utilities))
|
||||
(use-modules (gnucash report report-utilities))
|
||||
(use-modules (srfi srfi-9))
|
||||
(use-modules (ice-9 match))
|
||||
|
||||
@@ -274,10 +275,10 @@
|
||||
(gnc:html-chart-get chart '(options title text)))
|
||||
|
||||
(define (gnc:html-chart-set-title! chart title)
|
||||
(gnc:html-chart-set! chart '(options title text) title))
|
||||
(gnc:html-chart-set! chart '(options title text) (list-to-vec title)))
|
||||
|
||||
(define (gnc:html-chart-set-data-labels! chart labels)
|
||||
(gnc:html-chart-set! chart '(data labels) labels))
|
||||
(gnc:html-chart-set! chart '(data labels) (list-to-vec labels)))
|
||||
|
||||
(define (gnc:html-chart-set-axes-display! chart display?)
|
||||
(gnc:html-chart-set! chart '(options scales xAxes (0) display) display?)
|
||||
@@ -337,9 +338,8 @@
|
||||
(nested-alist-get options path)))
|
||||
|
||||
(define (gnc:html-chart-set! chart path val)
|
||||
(let ((options (gnc:html-chart-get-options-internal chart))
|
||||
(val-vec (list-to-vec val)))
|
||||
(nested-alist-set! options path val-vec)
|
||||
(let ((options (gnc:html-chart-get-options-internal chart)))
|
||||
(nested-alist-set! options path val)
|
||||
(gnc:html-chart-set-options-internal! chart options)))
|
||||
|
||||
(define JS-Number-to-String "
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
|
||||
(define (test-html-chart)
|
||||
|
||||
(let ((chart (gnc:make-html-chart)))
|
||||
(let ((chart (gnc:make-html-chart))
|
||||
(a-list-of-pairs '((unit . day)
|
||||
(displayFormats (day . "DD-MM-YYYY"))
|
||||
(tooltipFormat . "DD-MM-YYYY"))))
|
||||
|
||||
(gnc:html-chart-add-data-series! chart "label" '(2 3 4) "red")
|
||||
|
||||
@@ -57,6 +60,16 @@
|
||||
'abc
|
||||
(gnc:html-chart-get chart '(options maintainAspectRatio)))
|
||||
|
||||
(test-equal "path doesn't exist"
|
||||
#f
|
||||
(gnc:html-chart-get chart '(options scales xAxes (0) time)))
|
||||
|
||||
(gnc:html-chart-set! chart '(options scales xAxes (0) time) a-list-of-pairs)
|
||||
|
||||
(test-equal "path exists and the list-of-pairs is intact"
|
||||
a-list-of-pairs
|
||||
(gnc:html-chart-get chart '(options scales xAxes (0) time)))
|
||||
|
||||
(gnc:html-chart-set! chart '(options legend position) 'de)
|
||||
(test-equal "1st level option setter & getter"
|
||||
'de
|
||||
|
||||
Reference in New Issue
Block a user