diff --git a/app/main/static/js/charges.js b/app/main/static/js/charges.js index 42a89a1..28a8ae9 100644 --- a/app/main/static/js/charges.js +++ b/app/main/static/js/charges.js @@ -1,4 +1,4 @@ -const margin = {top: 150, right: 40, bottom: 10, left: 40}, +var margin = {top: 30, right: 30, bottom: 130, left: 90}, width = 1000 - margin.left - margin.right, height = 500 - margin.top - margin.bottom; @@ -39,7 +39,7 @@ function build_chart(div_selector, data_url) { var services = data.columns.slice(1) var periods = d3.map(data, d => d.period) - console.log(data) + // console.log(data) var stack = d3.stack() .keys(services) @@ -53,8 +53,13 @@ function build_chart(div_selector, data_url) { .range([0, width]) .padding(0.1); + y_max = d3.max(stacked_data[stacked_data.length - 1], d => d[1]); + if ( y_max == 0 ) { + console.log(y_max) + y_max = height + } const y = d3.scaleLinear() - .domain([0, 100]) + .domain([0, y_max]) .range([height, 0]); -- libgit2 0.21.2