From e15e6a23d8695c658280a2b973f5197ed704884f Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 14 May 2013 15:00:04 +1200 Subject: Hide KILLXP charts when not filtering for KILLXP Also filter KILLXP by default. This closes #16. --- public/index.html | 32 ++++++++++++++++---------------- public/js/mv/chart.js | 23 +++++++++++++++++++++-- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/public/index.html b/public/index.html index 5d0a9a2..92cf50f 100644 --- a/public/index.html +++ b/public/index.html @@ -19,27 +19,27 @@
-
-

Instance breakdown by Target

-
-
-

Instance breakdown by Weapon

-
-
-

Instance breakdown by number of attackers

-

Instance breakdown by Type

-
-
-
-
-

Breakdown by Map [?]

+
+
+

Instance breakdown by Target

-
-

Instance breakdown by Date

+
+

Instance breakdown by Weapon

+
+

Instance breakdown by number of attackers

+

+
+
+
+
+

Instance breakdown by Date

+
+
+

Breakdown by Map [?]

diff --git a/public/js/mv/chart.js b/public/js/mv/chart.js index a5783ec..2e19aa5 100644 --- a/public/js/mv/chart.js +++ b/public/js/mv/chart.js @@ -48,7 +48,25 @@ var mv = function(mv) { .renderTitle(true) ; mv.charts.stats = trellisChart("#stat-chart", ["str", "agi", "vit", "dex", "int", "luk"].map(function(d) { mv.heap[d].name = d; return mv.heap[d]; })); - dc.renderlet(function() { mv.charts.stats(); }); + mv.charts.type.filter("KILLXP"); + var killxpShown = true; + var killxpCharts = d3.select("#killxp-charts"); + dc.renderlet(function() { + mv.charts.stats(); + if (killxpShown) { + if (mv.charts.type.filter() != "KILLXP") { + /* Hide killxp charts */ + killxpCharts.style("opacity", "0"); + killxpShown = false; + } + } else { + if (mv.charts.type.filter() == "KILLXP") { + /* Show killxp charts */ + killxpCharts.style("opacity", "1"); + killxpShown = true; + } + } + }); dc.renderAll(); } charter.filters = function() { @@ -105,7 +123,8 @@ var mv = function(mv) { } function pie(chart) { return thin(chart) - .radius(90) + .radius(80) + .height(165) .colorCalculator(d3.scale.category20c()) ; } -- cgit v1.2.3-60-g2f50