Commit ce901ca4136e5980e940450cbcf6f70e01f18006

Authored by fbormann
1 parent da1726c7

modified subtitles of donut resource chart

amadeus/static/css/base/amadeus.css
... ... @@ -1142,18 +1142,14 @@ li.item .notify_badge {
1142 1142  
1143 1143 /* CHART APP */
1144 1144 .pie-tooltip{
1145   - background: #eee;
1146   - box-shadow: 0 0 5px #999999;
1147   - color: #333;
1148   - display: none;
  1145 +
  1146 +
1149 1147 font-size: 30px;
1150 1148 left: 130px;
1151 1149 padding: 10px;
1152 1150 position: absolute;
1153 1151 text-align: center;
1154   - top: 95px;
1155 1152 width: 80px;
1156   - z-index: 10;
1157 1153 }
1158 1154  
1159 1155  
... ...
amadeus/static/js/charts/home.js
... ... @@ -60,27 +60,25 @@ var resource_donut_chart = {
60 60 .attr('fill', function(d, i) {
61 61 return color(i);
62 62 });
63   -
  63 + var labelArc = d3.arc()
  64 + .outerRadius(radius*1.2 - donutInner)
  65 + .innerRadius(radius*1.2 - donutInner);
  66 +
64 67  
65 68 svg.selectAll("text.pie-tooltip")
66   - .data(dataset)
  69 + .data(pie(dataset))
67 70 .enter()
68 71 .append("text")
69   - .text(function(d){
70   - return d[0];
71   - })
72 72 .attr("id", function(d){
73   - return d[0];
  73 + return d.data[0];
74 74 })
75   - .attr("class","pie-tooltip");
76   -
77   - path.on('mouseover', function(d) { //When the mouse is over the path
78   - $('#'+d.data[0]).css("display", "block");
79   - });
  75 + .attr("class","pie-tooltip")
  76 + .attr('fill',"#172121")
  77 + .attr("transform", function(d) { return "translate(" + labelArc.centroid(d) + ")"; })
  78 + .attr("dy", ".35em")
  79 + .text(function(d) { return d.data[0]; });
80 80  
81   - path.on('mouseout', function(d) { //When the mouse "leaves" the path
82   - t = $('#'+d.data[0]).css("display", "none");
83   - });
  81 +
84 82  
85 83 }) // end of the get method
86 84 }
... ...