added legend for topics presence chart

v1.18.x
psychobunny 11 years ago
parent a46006ba64
commit 3634cebff7

@ -312,6 +312,10 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
function reassignExistingTopics() { function reassignExistingTopics() {
for (var i = 0, ii = segments.length; i < ii; i++ ) { for (var i = 0, ii = segments.length; i < ii; i++ ) {
if (!segments[i]) {
continue;
}
var tid = segments[i].tid; var tid = segments[i].tid;
if ($.inArray(tid, tids) === -1) { if ($.inArray(tid, tids) === -1) {
@ -344,21 +348,38 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
break; break;
} }
} }
} while (color !== null && usedTopicColors.length === topicColors.length); } while (color === null && usedTopicColors.length < topicColors.length);
if (color) {
graphs.topics.addData({ graphs.topics.addData({
value: tid, value: tid,
color: color, color: color,
highlight: lighten(color, 10), highlight: lighten(color, 10),
label: "tid " + value label: "tid " + tid
}); });
segments[segments.length - 1].tid = tid; segments[segments.length - 1].tid = tid;
} }
} }
}
function buildTopicsLegend() {
var legend = $('#topics-legend').html('');
for (var i = 0, ii = segments.length; i < ii; i++) {
var topic = segments[i];
legend.append(
'<li>' +
'<div style="background-color: ' + topic.highlightColor + '; border-color: ' + topic.strokeColor + '"></div>' +
'<span><a href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.label + '</a></span>' +
'</li>');
}
}
reassignExistingTopics(); reassignExistingTopics();
assignNewTopics(); assignNewTopics();
buildTopicsLegend();
graphs.topics.update(); graphs.topics.update();
} }

Loading…
Cancel
Save