Commit 7f8769d54b8b112b4c7cb26f50c132b85d6fa6fc
1 parent
3078dcb0
Exists in
master
and in
3 other branches
modified chart and carrousel
Showing
2 changed files
with
60 additions
and
6 deletions
Show diff stats
amadeus/static/css/base/amadeus.css
| ... | ... | @@ -1140,6 +1140,18 @@ li.item .notify_badge { |
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | |
| 1143 | +/*Carrosel change*/ | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | +.carousel-control.right{ | |
| 1148 | + background-image: none !important; | |
| 1149 | +} | |
| 1150 | + | |
| 1151 | +.carousel-control.left{ | |
| 1152 | + background-image: none !important; | |
| 1153 | +} | |
| 1154 | + | |
| 1143 | 1155 | /* CHART APP */ |
| 1144 | 1156 | .pie-tooltip{ |
| 1145 | 1157 | ... | ... |
amadeus/static/js/charts/home.js
| ... | ... | @@ -33,7 +33,7 @@ var charts = { |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - var donutInner = 50; | |
| 36 | + var donutInner = 20; | |
| 37 | 37 | var arc = d3.arc() |
| 38 | 38 | .innerRadius(radius - donutInner) |
| 39 | 39 | .outerRadius(radius); |
| ... | ... | @@ -64,8 +64,8 @@ var charts = { |
| 64 | 64 | return color(i); |
| 65 | 65 | }); |
| 66 | 66 | var labelArc = d3.arc() |
| 67 | - .outerRadius(radius*1.2 - donutInner) | |
| 68 | - .innerRadius(radius*1.2 - donutInner); | |
| 67 | + .outerRadius(radius - donutInner + 30) | |
| 68 | + .innerRadius(radius + 20 ); | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | svg.selectAll("text.pie-tooltip") |
| ... | ... | @@ -77,8 +77,11 @@ var charts = { |
| 77 | 77 | }) |
| 78 | 78 | .attr("class","pie-tooltip") |
| 79 | 79 | .attr('fill',"#172121") |
| 80 | - .attr("transform", function(d) { return "translate(" + labelArc.centroid(d) + ")"; }) | |
| 81 | - .attr("dy", ".35em") | |
| 80 | + .attr("transform", function(d) { | |
| 81 | + c = labelArc.centroid(d); | |
| 82 | + return "translate(" + (c[0]*1.0 - 20) +"," + c[1]*0.8 + ")"; | |
| 83 | + }) | |
| 84 | + .attr("dy", ".25em") | |
| 82 | 85 | .text(function(d) { return d.data[0]; }); |
| 83 | 86 | |
| 84 | 87 | |
| ... | ... | @@ -163,7 +166,6 @@ var charts = { |
| 163 | 166 | }) |
| 164 | 167 | |
| 165 | 168 | .attr("fill", function(d){ |
| 166 | - //return color(d['count']); | |
| 167 | 169 | return 'url('+'#'+'user_'+d['user_id']+')'; |
| 168 | 170 | }); |
| 169 | 171 | |
| ... | ... | @@ -227,6 +229,46 @@ var charts = { |
| 227 | 229 | }); |
| 228 | 230 | |
| 229 | 231 | |
| 232 | + }, | |
| 233 | + | |
| 234 | + most_accessed_subjects: function(url){ | |
| 235 | + $.get(url, function(dataset){ | |
| 236 | + var w = 400; | |
| 237 | + var h = 300; | |
| 238 | + | |
| 239 | + var new_div = d3.select(".carousel-inner").append("div").attr("class","item"); | |
| 240 | + | |
| 241 | + var padding = 20; | |
| 242 | + var xScale = d3.scaleLinear(). | |
| 243 | + domain([0 , d3.max(dataset, function(d){ return d[0]; })]) | |
| 244 | + .range([padding, w - padding]); | |
| 245 | + var yScale = d3.scaleLinear() | |
| 246 | + .domain([0, d3.max(dataset, function(d) { return d[1]; })]) | |
| 247 | + .range([h - padding, padding]); | |
| 248 | + | |
| 249 | + svg = d3.select("body").append("svg").attr("height", h).attr("width", w); | |
| 250 | + svg.selectAll("rect") | |
| 251 | + .data(dataset) | |
| 252 | + .enter() | |
| 253 | + .append("rect") | |
| 254 | + .attr("x", function(d, i){ | |
| 255 | + return i * (w / dataset.length - barPadding ); | |
| 256 | + }) | |
| 257 | + .attr("y", function(d){ | |
| 258 | + return h - d*2; | |
| 259 | + }) | |
| 260 | + .attr("width", 20) | |
| 261 | + .attr("height", function(d){ | |
| 262 | + return d*2; | |
| 263 | + }) | |
| 264 | + .attr("fill", function(d){ | |
| 265 | + if (d <= average(dataset)){ | |
| 266 | + return "#BDBDBD"; | |
| 267 | + }else{ | |
| 268 | + return "red"; | |
| 269 | + } | |
| 270 | + }); | |
| 271 | + }); | |
| 230 | 272 | } |
| 231 | 273 | } |
| 232 | 274 | ... | ... |