Commit 7d095c38f0cd291319aa6111c09a850f5f14b00b

Authored by hitier
1 parent 5f89fdc7

One color scale by chart

Showing 1 changed file with 6 additions and 5 deletions   Show diff stats
app/main/static/js/charges.js
@@ -10,7 +10,6 @@ function build_chart(div_selector, data_url, project_name, category) { @@ -10,7 +10,6 @@ function build_chart(div_selector, data_url, project_name, category) {
10 const tooltip_offset = {dx: 0, dy: 100} 10 const tooltip_offset = {dx: 0, dy: 100}
11 const tooltip_offset_dot = {dx: 20, dy: 60} 11 const tooltip_offset_dot = {dx: 20, dy: 60}
12 12
13 - const colorScale = d3.scaleOrdinal(d3.schemeCategory10);  
14 13
15 const y_ticks_num = 5 14 const y_ticks_num = 5
16 15
@@ -26,23 +25,25 @@ function build_chart(div_selector, data_url, project_name, category) { @@ -26,23 +25,25 @@ function build_chart(div_selector, data_url, project_name, category) {
26 const yScale = d3.scaleLinear() 25 const yScale = d3.scaleLinear()
27 .range([height, 0]) 26 .range([height, 0])
28 27
  28 + var colorScale = d3.scaleOrdinal([])
29 29
30 var chart_title = "" 30 var chart_title = ""
31 var category_title = "" 31 var category_title = ""
32 - var draw_total_line = function (data, categories) {  
33 - }  
34 - var draw_categories_bars = function (data, categories) {  
35 - } 32 + var draw_total_line = function (data, categories) { }
  33 + var draw_categories_bars = function (data, categories) { }
  34 +
36 if (category == 'capacity') { 35 if (category == 'capacity') {
37 chart_title = "Charges par fonction" 36 chart_title = "Charges par fonction"
38 category_title = "Fonction" 37 category_title = "Fonction"
39 //draw_total_line 38 //draw_total_line
40 draw_categories_bars = draw_categories_grouped 39 draw_categories_bars = draw_categories_grouped
  40 + colorScale = d3.scaleOrdinal(d3.schemeSet3);
41 } else if (category == 'service') { 41 } else if (category == 'service') {
42 chart_title = "Charges par service" 42 chart_title = "Charges par service"
43 category_title = "Service" 43 category_title = "Service"
44 draw_total_line = draw_totalcharge_line 44 draw_total_line = draw_totalcharge_line
45 draw_categories_bars = draw_categories_stacked 45 draw_categories_bars = draw_categories_stacked
  46 + colorScale = d3.scaleOrdinal(d3.schemeTableau10);
46 } else { 47 } else {
47 alert("ALERT ! Every body shall quit the boat, we are sinking ! ALERT !") 48 alert("ALERT ! Every body shall quit the boat, we are sinking ! ALERT !")
48 } 49 }