From 3634cebff748afe8612f1a1fcdf016abce0c8c0a Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 29 Sep 2014 04:07:36 -0400 Subject: [PATCH] added legend for topics presence chart --- public/src/forum/admin/general/dashboard.js | 37 ++++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/public/src/forum/admin/general/dashboard.js b/public/src/forum/admin/general/dashboard.js index deb29e6aea..55fbfeb159 100644 --- a/public/src/forum/admin/general/dashboard.js +++ b/public/src/forum/admin/general/dashboard.js @@ -312,6 +312,10 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) { function reassignExistingTopics() { for (var i = 0, ii = segments.length; i < ii; i++ ) { + if (!segments[i]) { + continue; + } + var tid = segments[i].tid; if ($.inArray(tid, tids) === -1) { @@ -344,21 +348,38 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) { break; } } - } while (color !== null && usedTopicColors.length === topicColors.length); + } while (color === null && usedTopicColors.length < topicColors.length); + + if (color) { + graphs.topics.addData({ + value: tid, + color: color, + highlight: lighten(color, 10), + label: "tid " + tid + }); + + segments[segments.length - 1].tid = tid; + } + } + } + + function buildTopicsLegend() { + var legend = $('#topics-legend').html(''); - graphs.topics.addData({ - value: tid, - color: color, - highlight: lighten(color, 10), - label: "tid " + value - }); + for (var i = 0, ii = segments.length; i < ii; i++) { + var topic = segments[i]; - segments[segments.length - 1].tid = tid; + legend.append( + '
  • ' + + '
    ' + + ' ' + topic.label + '' + + '
  • '); } } reassignExistingTopics(); assignNewTopics(); + buildTopicsLegend(); graphs.topics.update(); }