Spaces:
Runtime error
Runtime error
aus10powell
commited on
Commit
•
213bcf2
1
Parent(s):
e7d48eb
Upload 3 files
Browse files
templates/charts/handle_sentiment_breakdown.html
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<style>
|
5 |
+
.error {
|
6 |
+
color: red;
|
7 |
+
}
|
8 |
+
</style>
|
9 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm//vega@5"></script>
|
10 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm//[email protected]"></script>
|
11 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm//vega-embed@6"></script>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<div id="vis"></div>
|
15 |
+
<script>
|
16 |
+
(function(vegaEmbed) {
|
17 |
+
var spec = {"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}}, "data": {"name": "data-700e84ebfeae2b5e3ed0135928f5414d"}, "facet": {"column": {"field": "handle", "type": "nominal"}}, "spec": {"layer": [{"mark": "bar", "encoding": {"color": {"field": "handle", "title": "Twitter Handle", "type": "nominal"}, "order": {"field": "max_sentiment", "sort": "ascending", "type": "nominal"}, "x": {"field": "max_sentiment", "title": "Max Sentiment", "type": "nominal"}, "y": {"axis": {"format": "%"}, "field": "percentage", "title": "Percentage", "type": "quantitative"}}, "height": 150, "title": "Percentage of Max Sentiments by Twitter Handle", "width": 150}, {"mark": {"type": "text", "color": "black", "dx": 0, "dy": 5}, "encoding": {"text": {"field": "count", "type": "quantitative"}, "x": {"field": "max_sentiment", "type": "nominal"}, "y": {"axis": {"format": "%"}, "field": "percentage", "type": "quantitative"}}}]}, "$schema": "https://vega.github.io/schema/vega-lite/v4.17.0.json", "datasets": {"data-700e84ebfeae2b5e3ed0135928f5414d": [{"handle": "BarackObama", "max_sentiment": "negative", "count": 225, "percentage": 0.07723995880535531}, {"handle": "BarackObama", "max_sentiment": "neutral", "count": 1056, "percentage": 0.36251287332646753}, {"handle": "BarackObama", "max_sentiment": "positive", "count": 1632, "percentage": 0.5602471678681772}, {"handle": "alikarimi_ak8", "max_sentiment": "negative", "count": 49, "percentage": 0.34507042253521125}, {"handle": "alikarimi_ak8", "max_sentiment": "neutral", "count": 66, "percentage": 0.4647887323943662}, {"handle": "alikarimi_ak8", "max_sentiment": "positive", "count": 27, "percentage": 0.19014084507042253}, {"handle": "cathiedwood", "max_sentiment": "negative", "count": 216, "percentage": 0.14555256064690028}, {"handle": "cathiedwood", "max_sentiment": "neutral", "count": 537, "percentage": 0.3618598382749326}, {"handle": "cathiedwood", "max_sentiment": "positive", "count": 731, "percentage": 0.4925876010781671}, {"handle": "elonmusk", "max_sentiment": "negative", "count": 453, "percentage": 0.2560768795929904}, {"handle": "elonmusk", "max_sentiment": "neutral", "count": 852, "percentage": 0.4816280384397965}, {"handle": "elonmusk", "max_sentiment": "positive", "count": 464, "percentage": 0.26229508196721313}, {"handle": "taylorlorenz", "max_sentiment": "negative", "count": 7, "percentage": 0.30434782608695654}, {"handle": "taylorlorenz", "max_sentiment": "neutral", "count": 7, "percentage": 0.30434782608695654}, {"handle": "taylorlorenz", "max_sentiment": "positive", "count": 9, "percentage": 0.391304347826087}, {"handle": "ylecun", "max_sentiment": "negative", "count": 710, "percentage": 0.28826634185952094}, {"handle": "ylecun", "max_sentiment": "neutral", "count": 1407, "percentage": 0.5712545676004872}, {"handle": "ylecun", "max_sentiment": "positive", "count": 346, "percentage": 0.14047909053999189}]}};
|
18 |
+
var embedOpt = {"mode": "vega-lite"};
|
19 |
+
|
20 |
+
function showError(el, error){
|
21 |
+
el.innerHTML = ('<div class="error" style="color:red;">'
|
22 |
+
+ '<p>JavaScript Error: ' + error.message + '</p>'
|
23 |
+
+ "<p>This usually means there's a typo in your chart specification. "
|
24 |
+
+ "See the javascript console for the full traceback.</p>"
|
25 |
+
+ '</div>');
|
26 |
+
throw error;
|
27 |
+
}
|
28 |
+
const el = document.getElementById('vis');
|
29 |
+
vegaEmbed("#vis", spec, embedOpt)
|
30 |
+
.catch(error => showError(el, error));
|
31 |
+
})(vegaEmbed);
|
32 |
+
|
33 |
+
</script>
|
34 |
+
</body>
|
35 |
+
</html>
|
templates/charts/handle_sentiment_distribution.html
ADDED
The diff for this file is too large to render.
See raw diff
|
|
templates/charts/handle_sentiment_timesteps.html
ADDED
The diff for this file is too large to render.
See raw diff
|
|