v1.18.x
psychobunny 11 years ago
parent 6fb596c1c6
commit a46006ba64

@ -307,55 +307,65 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
}
function updateTopicsGraph(topics) {
var tids = Object.keys(topics);
var tids = Object.keys(topics),
segments = graphs.topics.segments;
var segments = graphs.topics.segments;
function reassignExistingTopics() {
for (var i = 0, ii = segments.length; i < ii; i++ ) {
var tid = segments[i].tid;
for (var i = 0, ii = segments.length; i < ii; i++ ){
var tid = segments[i].tid;
if ($.inArray(tid, tids) === -1) {
usedTopicColors.splice($.inArray(segments[i].color, usedTopicColors), 1);
graphs.topics.removeData(i);
} else {
graphs.topics.segments[i].value = topics[tid];
delete topics[tid];
if ($.inArray(tid, tids) === -1) {
usedTopicColors.splice($.inArray(segments[i].color, usedTopicColors), 1);
graphs.topics.removeData(i);
} else {
graphs.topics.segments[i].value = topics[tid];
delete topics[tid];
}
}
}
while (segments.length < 10 && tids.length > 0) {
var tid = tids.pop(),
value = topics[tid],
color = null;
function assignNewTopics() {
while (segments.length < 10 && tids.length > 0) {
var tid = tids.pop(),
value = topics[tid],
color = null;
if (!value) {
continue;
}
if (!value) {
continue;
}
do {
for (var i = 0, ii = topicColors.length; i < ii; i++) {
var chosenColor = topicColors[i];
do {
for (var i = 0, ii = topicColors.length; i < ii; i++) {
var chosenColor = topicColors[i];
if ($.inArray(chosenColor, usedTopicColors) === -1) {
color = chosenColor;
usedTopicColors.push(color);
break;
if ($.inArray(chosenColor, usedTopicColors) === -1) {
color = chosenColor;
usedTopicColors.push(color);
break;
}
}
}
} while (color !== null && usedTopicColors.length === topicColors.length);
} while (color !== null && usedTopicColors.length === topicColors.length);
graphs.topics.addData({
value: tid,
color: color,
highlight: lighten(color, 10),
label: "tid " + value
});
graphs.topics.addData({
value: tid,
color: color,
highlight: lighten(color, 10),
label: "tid " + value
});
segments[segments.length - 1].tid = tid;
segments[segments.length - 1].tid = tid;
}
}
reassignExistingTopics();
assignNewTopics();
graphs.topics.update();
}
function buildTopicsLegend() {
}
return Admin;
});

Loading…
Cancel
Save