fix: CSS for country graph

pull/12/head
Raphaël Vinot 2018-08-01 12:16:02 +02:00
parent 7c1678c2df
commit d88c818b67
3 changed files with 12 additions and 2 deletions

View File

@ -0,0 +1,9 @@
.axis--x path {
display: none;
}
.line {
fill: none;
stroke: steelblue;
stroke-width: 1.5px;
}

View File

@ -12,14 +12,13 @@ function linegraph(call_path) {
z = d3.scaleOrdinal(d3.schemeCategory10); z = d3.scaleOrdinal(d3.schemeCategory10);
var line = d3.line() var line = d3.line()
.curve(d3.curveBasis) .curve(d3.curveLinear)
.x(function(d) { return x(d.date); }) .x(function(d) { return x(d.date); })
.y(function(d) { return y(d.rank); }); .y(function(d) { return y(d.rank); });
d3.json(call_path, {credentials: 'same-origin'}).then(function(data) { d3.json(call_path, {credentials: 'same-origin'}).then(function(data) {
var country_ranks = d3.entries(data).map(function(country_rank) { var country_ranks = d3.entries(data).map(function(country_rank) {
x.domain(d3.extent(country_rank.value, function(d) { return parseTime(d[0]); }));
return { return {
country: country_rank.key, country: country_rank.key,
values: d3.values(country_rank.value).map(function(d) { values: d3.values(country_rank.value).map(function(d) {
@ -28,6 +27,7 @@ function linegraph(call_path) {
}; };
}); });
x.domain(d3.extent(country_ranks[0].values, function(d) { return d.date; }));
y.domain([ y.domain([
d3.min(country_ranks, function(c) { return d3.min(c.values, function(d) { return d.rank; }); }), d3.min(country_ranks, function(c) { return d3.min(c.values, function(d) { return d.rank; }); }),
d3.max(country_ranks, function(c) { return d3.max(c.values, function(d) { return d.rank; }); }) d3.max(country_ranks, function(c) { return d3.max(c.values, function(d) { return d.rank; }); })

View File

@ -2,6 +2,7 @@
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='linegraph_country.css') }}">
{% endblock %} {% endblock %}