diff --git a/gnucash/report/html-chart.scm b/gnucash/report/html-chart.scm index 70d3d49ea6b..d3da4b47e13 100644 --- a/gnucash/report/html-chart.scm +++ b/gnucash/report/html-chart.scm @@ -186,7 +186,6 @@ (cons 'display #t) (cons 'labelString ""))) (cons 'ticks (list - (cons 'fontSize 12) (cons 'maxRotation 30)))) ;; the following another xAxis at the top '((position . top) @@ -205,7 +204,6 @@ (cons 'display 1.5) (cons 'labelString ""))) (cons 'ticks (list - (cons 'fontSize 10) (cons 'beginAtZero #f)))) ;; the following another yAxis on the right '((position . right) @@ -215,7 +213,6 @@ )))) (cons 'title (list (cons 'display #t) - (cons 'fontSize 16) (cons 'fontStyle "") (cons 'text "")))))) "XXX" ;currency-iso @@ -348,6 +345,17 @@ Chart.pluginService.register({ } }) +// copy font info from css into chartjs. +bodyStyle = window.getComputedStyle (document.querySelector ('body')); +Chart.defaults.global.defaultFontSize = parseInt (bodyStyle.fontSize); +Chart.defaults.global.defaultFontFamily = bodyStyle.fontFamily; +Chart.defaults.global.defaultFontStyle = bodyStyle.fontStyle; + +titleStyle = window.getComputedStyle (document.querySelector ('h3')); +chartjsoptions.options.title.fontSize = parseInt (titleStyle.fontSize); +chartjsoptions.options.title.fontFamily = titleStyle.fontFamily; +chartjsoptions.options.title.fontStyle = titleStyle.fontStyle; + document.getElementById(chartid).onclick = function(evt) { var activepoints = myChart.getElementAtEvent(evt); var anchor = document.getElementById(jumpid); @@ -398,21 +406,23 @@ document.getElementById(chartid).onclick = function(evt) { (push (lambda (l) (set! retval (cons l retval)))) ;; Use a unique chart-id for each chart. This prevents charts ;; clashing on multi-column reports - (id (guid-new-return))) + (id (symbol->string (gensym "chart")))) (push (gnc:html-js-include (gnc-path-find-localized-html-file "chartjs/Chart.bundle.min.js"))) + ;; the following hidden h3 is used to query style and copy onto chartjs + (push "

") (push (format #f "
\n" (size->str (gnc:html-chart-width chart)) (size->str (gnc:html-chart-height chart)))) (push (format #f "\n" id)) - (push (format #f "\n" id)) + (push (format #f "\n" id)) (push "
\n") (push (format #f "