From 6b59fd2554db8adf014fe25699959d2da74dde42 Mon Sep 17 00:00:00 2001 From: "Nickolay.NP" Date: Thu, 26 Oct 2023 22:28:13 +0300 Subject: [PATCH] v.0.30 --- toGraphTemplate.go | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/toGraphTemplate.go b/toGraphTemplate.go index 58bf712..c4bc649 100644 --- a/toGraphTemplate.go +++ b/toGraphTemplate.go @@ -7,6 +7,28 @@ const graphTemplate = ` + + + {{.Title}} @@ -14,6 +36,8 @@ const graphTemplate = ` google.charts.load('current', {'packages':['annotationchart']}); google.charts.setOnLoadCallback(drawChart); + let chart; + function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('date', 'Date'); @@ -32,7 +56,7 @@ const graphTemplate = ` {{- end}} ]); - var chart = new google.visualization.AnnotationChart(document.getElementById('chart_div')); + chart = new google.visualization.AnnotationChart(document.getElementById('chart_div')); var options = { displayAnnotations: true @@ -40,11 +64,29 @@ const graphTemplate = ` chart.draw(data, options); } + + function onChangeColumn(element) { + if (element.checked) { + chart.showDataColumns(element.value) + } else { + chart.hideDataColumns(element.value) + } + } -
+ + +
`