Commit ff5fd5bf6ad3ec7625f08dcc8eacbd93f4810696
1 parent
25ec6dd7
Exists in
master
and in
4 other branches
Less and Longer Y ticks
Showing
2 changed files
with
33 additions
and
8 deletions
Show diff stats
app/main/static/css/charges.css
app/main/static/js/charges.js
... | ... | @@ -2,12 +2,16 @@ const margin = {top: 60, right: 350, bottom: 100, left: 90}, |
2 | 2 | width = 1300 - margin.left - margin.right, |
3 | 3 | height = 500 - margin.top - margin.bottom; |
4 | 4 | |
5 | +const height_ratio = 1.2 | |
6 | + | |
5 | 7 | const tooltip_offset = {dx: 0, dy: 100} |
6 | 8 | |
7 | 9 | const color_scale = d3.scaleOrdinal(d3.schemeCategory10); |
8 | 10 | |
11 | +const y_ticks_num = 5 | |
12 | + | |
9 | 13 | const legend_cell_size = 15; // colored scare size |
10 | -const legend_x = width+20; // begin legend a bit after the end of the chart | |
14 | +const legend_x = width + 20; // begin legend a bit after the end of the chart | |
11 | 15 | |
12 | 16 | // TODO: set main scales attr here then domain later |
13 | 17 | // const x = d3.scaleBand() |
... | ... | @@ -71,7 +75,7 @@ function build_chart(div_selector, data_url, project_name, category) { |
71 | 75 | let reverse_keys = color_scale.domain().reverse(); |
72 | 76 | |
73 | 77 | let legend = svg.append('g') |
74 | - .attr('transform', 'translate('+legend_x+', -30)'); | |
78 | + .attr('transform', 'translate(' + legend_x + ', -30)'); | |
75 | 79 | |
76 | 80 | legend.selectAll() |
77 | 81 | .data(reverse_keys) |
... | ... | @@ -147,14 +151,15 @@ function build_chart(div_selector, data_url, project_name, category) { |
147 | 151 | if (y_max == 0) { |
148 | 152 | y_max = 100 |
149 | 153 | } |
150 | - // Enhance it by 10% to leave room on the top of the graph | |
151 |