create utils.getGraphType() function.

also apply setting to long term graphs
flip logic - only return "line" if the setting is explicitly set to "false"

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2020-06-01 21:10:14 +01:00
parent 4cca206810
commit 02a4e83d87
3 changed files with 10 additions and 7 deletions

View File

@@ -783,12 +783,9 @@ $(function () {
var permittedColor = $(".queries-permitted").css("background-color");
var gridColor = $(".graphs-grid").css("background-color");
var ticksColor = $(".graphs-ticks").css("color");
var graphType = localStorage.getItem("barchart_chkbox") === "true" ? "bar" : "line";
var ctx = document.getElementById("queryOverTimeChart").getContext("2d");
timeLineChart = new Chart(ctx, {
type: graphType,
type: utils.getGraphType(),
data: {
labels: [],
datasets: [
@@ -906,7 +903,7 @@ $(function () {
if (clientsChartEl) {
ctx = clientsChartEl.getContext("2d");
clientsChart = new Chart(ctx, {
type: graphType,
type: utils.getGraphType(),
data: {
labels: [],
datasets: [{ data: [] }]