From 7d095c38f0cd291319aa6111c09a850f5f14b00b Mon Sep 17 00:00:00 2001 From: Richard Hitier Date: Mon, 12 Apr 2021 11:04:10 +0200 Subject: [PATCH] One color scale by chart --- app/main/static/js/charges.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/main/static/js/charges.js b/app/main/static/js/charges.js index 3211572..bd348fd 100644 --- a/app/main/static/js/charges.js +++ b/app/main/static/js/charges.js @@ -10,7 +10,6 @@ function build_chart(div_selector, data_url, project_name, category) { const tooltip_offset = {dx: 0, dy: 100} const tooltip_offset_dot = {dx: 20, dy: 60} - const colorScale = d3.scaleOrdinal(d3.schemeCategory10); const y_ticks_num = 5 @@ -26,23 +25,25 @@ function build_chart(div_selector, data_url, project_name, category) { const yScale = d3.scaleLinear() .range([height, 0]) + var colorScale = d3.scaleOrdinal([]) var chart_title = "" var category_title = "" - var draw_total_line = function (data, categories) { - } - var draw_categories_bars = function (data, categories) { - } + var draw_total_line = function (data, categories) { } + var draw_categories_bars = function (data, categories) { } + if (category == 'capacity') { chart_title = "Charges par fonction" category_title = "Fonction" //draw_total_line draw_categories_bars = draw_categories_grouped + colorScale = d3.scaleOrdinal(d3.schemeSet3); } else if (category == 'service') { chart_title = "Charges par service" category_title = "Service" draw_total_line = draw_totalcharge_line draw_categories_bars = draw_categories_stacked + colorScale = d3.scaleOrdinal(d3.schemeTableau10); } else { alert("ALERT ! Every body shall quit the boat, we are sinking ! ALERT !") } -- libgit2 0.21.2