Skip to content

Commit

Permalink
Use random colors in client graph if presets run out
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Drobnak <[email protected]>
  • Loading branch information
AzureMarker committed Aug 16, 2018
1 parent f4c5746 commit 6af8c76
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/pi-hole/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,17 @@ function updateClientsOverTime() {

for (i = clientsChart.data.datasets.length; plotdata.length && i < plotdata[0].length; i++)
{
clientsChart.data.datasets.push({data: [], backgroundColor: colors[i], pointRadius: 0, pointHitRadius: 5, pointHoverRadius: 5, label: labels[i], cubicInterpolationMode: "monotone" });
clientsChart.data.datasets.push({
data: [],
backgroundColor: i < colors.length
? colors[i]
: '#' + parseInt("" + Math.random() * 0xffffff, 10).toString(16).padStart(6, "0"),
pointRadius: 0,
pointHitRadius: 5,
pointHoverRadius: 5,
label: labels[i],
cubicInterpolationMode: "monotone"
});
}

// Add data for each dataset that is available
Expand Down

0 comments on commit 6af8c76

Please sign in to comment.