Skip to content

Commit

Permalink
fixing all values view in D3 #73
Browse files Browse the repository at this point in the history
  • Loading branch information
smadha committed May 6, 2016
1 parent 418d866 commit b228330
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions geoparser_app/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,19 @@ $(function() {
if (res.response.hasOwnProperty('docs')) {
var doc = res.response.docs[0];
var count = 0;
for (var key in metadataFields) {
key = metadataFields[key]

for (var key in doc) {
if (doc.hasOwnProperty(key)) {
count+=1;
var value = doc[key];
// Ellipsing the string if its too long
if(value.toString().length > 145) {
value = value.toString().substring(0,144)+"...";
}
var child = {"name": key, "children": [{"name": value,"size": 1}]};
d3_data['children'].push(child);

// Max num of default keys to be shown in the popup
if(count <= 4){
if(count <= 4 && $.inArray(key, metadataFields) > -1){
count+=1;
popup_content += "<p><b>" + key + "</b>: " + value + "</p>";
}
}
Expand Down

0 comments on commit b228330

Please sign in to comment.