Skip to content
Permalink
Browse files

custom topic labels

  • Loading branch information...
JaimieMurdock committed Jul 19, 2019
1 parent 6b8533e commit d62b597ab37b9d234caf492cb674b0cdfa1ea917
Showing with 7 additions and 3 deletions.
  1. +2 −1 www/nodes.js
  2. +5 −2 www/topicprint.js
@@ -278,7 +278,8 @@ d3.csv(base_url + "cluster.csv", function (error, data) {
.style("fill-opacity", function (d) { return opacity(d.opacity) || 0.7; })
.on("click", function (d) { window.location.href = base_url + d.k + "/?topic=" + d.topic })
.attr("title", function (d) {
return "<strong>Topic " + d.topic + "</strong> (k=" + d.k + ")"
var topic_label = (d.label) ? d.label : ('Topic ' + d.topic);
return "<strong>" + topic_label + "</strong> (k=" + d.k + ")"
+ "<br />" + topics[d.k][d.topic];
})
.on("mouseover", function (d) { $(this).tooltip('show') })
@@ -312,18 +312,20 @@ function gettopics(words) {
$('#words').parents('.form-group').removeClass('has-error');
$('#words').parents('.form-group').removeClass('has-warning');
$('#words').parents('.form-group').addClass('has-success');
console.log(data);
Promise.resolve(topics).then(function (val) {
for (var i = 0; i < 10; i++) {
var k = data[i]['k'];
var t = data[i]['t'];
var topic_label = (data[i]['label']) ? data[i]['label'] : ('Topic ' + t);

/*$('#wordsDl').append('<dt><a href="' + k + '/?topic=' + t + '">' +
'Topic ' + t +
' <small>(k = ' + k + ')</small></a></dt>');
$('#wordsDl').append('<dd>' +
val[k][t] + '</dd>'); }*/
$('#wordsDl').append('<div class="col-xs-4"><h4><a href="' + k + '/?topic=' + t + '">' +
'Topic ' + t +
topic_label +
' <small>(k = ' + k + ')</small></a></h4><p>' +
val[k][t] + '</p></div>');
}
@@ -873,7 +875,8 @@ if (url)
//.attr("data-toggle", "tooltip")
.attr("data-placement", "right")
.attr("title", function (d) {
return "<strong>Topic {0}:</strong>".format(d) + "<br />"
var topic_label = (topics[d].label) ? topics[d].label : ('Topic ' + d);
return "<strong>{0}:</strong>".format(topic_label) + "<br />"
+ d3.keys(topics[d].words).sort(function (a, b) {
if (topics[d].words[a] > topics[d].words[b])
return -1;

0 comments on commit d62b597

Please sign in to comment.
You can’t perform that action at this time.