From 271d37f572e525f0053102f13cd316c6e02399a8 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Tue, 16 Jun 2015 22:21:40 -0400 Subject: [PATCH] Update radar sample + use the same colour functions in all samples --- samples/doughnut.html | 2 +- samples/line.html | 5 ++++- samples/pie.html | 5 ++++- samples/radar.html | 25 ++++++++++++++++++++++++- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/samples/doughnut.html b/samples/doughnut.html index 93f7c8656..f2746557a 100644 --- a/samples/doughnut.html +++ b/samples/doughnut.html @@ -32,7 +32,7 @@ return Math.round(Math.random() * 255); }; var randomColor = function(opacity) { - return 'rgba(' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + (opacity || '.3') + ')'; + return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')'; }; var config = { diff --git a/samples/line.html b/samples/line.html index c7ea97c17..b4d9bc4ee 100644 --- a/samples/line.html +++ b/samples/line.html @@ -25,8 +25,11 @@ var randomScalingFactor = function() { return Math.round(Math.random() * 100 * (Math.random() > 0.5 ? -1 : 1)); }; + var randomColorFactor = function() { + return Math.round(Math.random() * 255); + }; var randomColor = function(opacity) { - return 'rgba(' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + (opacity || '.3') + ')'; + return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')'; }; var config = { diff --git a/samples/pie.html b/samples/pie.html index 2ae057355..571efb037 100644 --- a/samples/pie.html +++ b/samples/pie.html @@ -18,8 +18,11 @@ var randomScalingFactor = function() { return Math.round(Math.random() * 100); }; + var randomColorFactor = function() { + return Math.round(Math.random() * 255); + }; var randomColor = function(opacity) { - return 'rgba(' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + Math.round(Math.random() * 255) + ',' + (opacity || '.3') + ')'; + return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')'; }; var config = { diff --git a/samples/radar.html b/samples/radar.html index 0630bc1ed..fd1214cbb 100644 --- a/samples/radar.html +++ b/samples/radar.html @@ -8,10 +8,12 @@ -
+
+ + -- 2.47.3