Skip to content

Commit

Permalink
Fix line chart tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermendes committed Mar 2, 2016
1 parent cbbd9cd commit 92f3a20
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libcrowds_statistics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from flask.ext.plugins import Plugin

__plugin__ = "LibCrowdsStatistics"
__version__ = "0.1.2"
__version__ = "0.1.3"


class LibCrowdsStatistics(Plugin):
Expand Down
2 changes: 1 addition & 1 deletion libcrowds_statistics/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"website": "https://github.com/LibCrowds/libcrowds-statistics",
"license": "BSD",
"description": "Global statistics page for LibCrowds.",
"version": "0.1.2"
"version": "0.1.3"
}
12 changes: 7 additions & 5 deletions libcrowds_statistics/static/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ Chart.defaults.global= {
tooltipCornerRadius: 6,
tooltipXOffset: 10,
tooltipTemplate: "<%if(label)\u007B%><%=label%>: <%}%>"
+ "<%=value%> "
+ "<%if(value != 1)\u007B%>"
+ "<%=datasetLabel%>s"
+ "<%}else\u007B%>"
+ "<%=value%>"
+ "<%if(datasetLabel == '%')\u007B%>"
+ "<%=datasetLabel%>"
+ "<%} else if(value != 1)\u007B%>"
+ " <%=datasetLabel%>s"
+ "<%}else\u007B%>"
+ " <%=datasetLabel%>"
+ "<%}%>",
onAnimationProgress: function() {},
onAnimationComplete: function() {},
Expand Down Expand Up @@ -462,7 +464,7 @@ function populateHourlyActivityChart(hourlyActivity, id) {
}
var data = {
labels: labels,
datasets: getLineDataset("percent", percentages)
datasets: getLineDataset("%", percentages)
};
drawLineChart(canvas, con, data);
}
2 changes: 1 addition & 1 deletion libcrowds_statistics/templates/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h4 class="padding-bottom-sm text-center">Total Hourly Activity</h4>
<script src="{{url_for('statistics.static', filename='js/vendor/leaflet.markercluster.js')}}" type="text/javascript"></script>
<script src="{{url_for('statistics.static', filename='js/vendor/moment.js')}}"></script>
<script src="{{url_for('statistics.static', filename='js/vendor/Chart.js-master/Chart.js')}}"></script>
<script src="{{url_for('statistics.static', filename='js/charts.js')}}"></script>
<script src="{{url_for('statistics.static', filename='js/charts.js')}}?v=0.2.0"></script>
<script>
$(function(){
var stats = {{ stats|safe }};
Expand Down

0 comments on commit 92f3a20

Please sign in to comment.