Make sentiment more usable
This commit is contained in:
parent
65140f70ac
commit
be20fb7a52
|
@ -30,11 +30,12 @@ new Chart(ctx, {
|
|||
plugins: {
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
beforeFooter: function(context) {
|
||||
return "Nick: " + full_data[context[0].dataIndex].nick;
|
||||
},
|
||||
footer: function(context) {
|
||||
return "Msg: " + full_data[context[0].dataIndex].text;
|
||||
var foot = "Text: " + full_data[context[0].dataIndex].text + "\n";
|
||||
foot += "Nick: " + full_data[context[0].dataIndex].nick + "\n";
|
||||
foot += "Channel: " + full_data[context[0].dataIndex].channel + "\n";
|
||||
foot += "Net: " + full_data[context[0].dataIndex].net;
|
||||
return foot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,18 +78,22 @@ def make_table(context):
|
|||
|
||||
|
||||
def make_graph(results):
|
||||
graph = json.dumps(
|
||||
[
|
||||
graph = []
|
||||
for index, item in enumerate(results):
|
||||
date = str(index)
|
||||
graph.append(
|
||||
{
|
||||
"text": item.get("msg", None) or item.get("id"),
|
||||
"text": item.get("tokens", None)
|
||||
or item.get("msg", None)
|
||||
or item.get("id"),
|
||||
"nick": item.get("nick", None),
|
||||
"channel": item.get("channel", None),
|
||||
"net": item.get("net", None),
|
||||
"value": item.get("sentiment", None) or None,
|
||||
"date": item.get("ts"),
|
||||
"date": date,
|
||||
}
|
||||
for item in results
|
||||
]
|
||||
)
|
||||
return graph
|
||||
)
|
||||
return json.dumps(graph)
|
||||
|
||||
|
||||
def drilldown_search(request, return_context=False, template=None):
|
||||
|
|
Loading…
Reference in New Issue