hide tables

This commit is contained in:
Gwenhael Le Moine 2016-10-23 10:36:24 +02:00
parent 5abdf3eabf
commit af911d67f8
2 changed files with 80 additions and 70 deletions

View file

@ -119,14 +119,19 @@ app.controller( 'DashboardCtrl',
};
this.pie_graph_options = { chart: { type: 'pieChart',
donut: true,
donutRatio: 0.25,
height: 300,
x: function( d ) { return d.account; },
y: function( d ) { return d.amount; },
showLabels: false,
showLegend: false,
showLegend: true,
legendPosition: 'right',
showTooltipPercent: true,
duration: 500,
labelThreshold: 0.01,
labelSunbeamLayout: true
labelSunbeamLayout: true,
donutLabelsOutside: true
} };
};
@ -202,48 +207,53 @@ app.controller( 'DashboardCtrl',
} );
} );
$scope.graphiques = { monthly_values: { options: { chart: { type: 'multiBarChart',
height: 300,
showControls: false,
showLegend: true,
showLabels: true,
stacked: false,
duration: 500,
reduceXTicks: false,
rotateLabels: 67,
labelSunbeamLayout: true,
useInteractiveGuideline: false,
multibar: {
dispatch: {
elementClick: function( event ) {
$scope.period = event.data.x;
retrieve_period_detailed_data();
}
}
}}
},
data: _.chain( response.data )
.keys()
.reverse()
.map( function( key ) {
var multiplicator = ( key == "Income" ) ? -1 : 1;
return { key: key,
values: _.chain(response.data[ key ]).map( function( value ) {
var date = new Date( value.date );
var period = date.getFullYear() + '-' + ( date.getMonth() < 9 ? '0' : '' ) + ( date.getMonth() + 1 );
$scope.periods.push( period );
$scope.graphiques = {
monthly_values: {
options: {
chart: {
type: 'multiBarChart',
height: 300,
showControls: false,
showLegend: true,
showLabels: true,
stacked: false,
duration: 500,
reduceXTicks: false,
rotateLabels: 67,
labelSunbeamLayout: true,
useInteractiveGuideline: false,
multibar: {
dispatch: {
elementClick: function( event ) {
$scope.period = event.data.x;
retrieve_period_detailed_data();
}
}
}
}
},
data: _.chain( response.data )
.keys()
.reverse()
.map( function( key ) {
var multiplicator = ( key == "Income" ) ? -1 : 1;
return { key: key,
values: _.chain(response.data[ key ]).map( function( value ) {
var date = new Date( value.date );
var period = date.getFullYear() + '-' + ( date.getMonth() < 9 ? '0' : '' ) + ( date.getMonth() + 1 );
$scope.periods.push( period );
return { key: key,
x: period,
y: parseInt( value.amount ) * multiplicator };
} )
.sortBy( function( item ) { return item.x; } )
.value()
};
} )
.value()
}
};
return { key: key,
x: period,
y: parseInt( value.amount ) * multiplicator };
} )
.sortBy( function( item ) { return item.x; } )
.value()
};
} )
.value()
}
};
$scope.periods = _.chain($scope.periods).uniq().sort().reverse().value();
$scope.period = _($scope.periods).first();

View file

@ -25,37 +25,37 @@
<option value=''>...</option>
</select>
</md-card>
<md-card flex="20">
<md-card flex="78">
<nvd3 data="bucket.data"
options="bucket.pie_graph_options" >
</nvd3>
</md-card>
<md-card flex="56">
<table class="table">
<thead>
<tr>
<th><md-buton data-ng-click="bucket.order_by( 'account' )">account</md-buton></th>
<th><md-buton data-ng-click="bucket.order_by( 'amount' )">amount</md-buton></th>
<th><md-buton data-ng-click="bucket.order_by( 'score' )">score</md-buton></th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="account in bucket.data | orderBy:bucket.orderBy:bucket.orderDesc"
data-ng-class="{'even': $even, 'odd': $odd}"
style="border-left:10px solid {{coloring_score( account.score )}};border-right:10px solid {{coloring_score( account.score )}}">
<td style="border-bottom:1px solid {{coloring_score( account.score )}}">
{{account.account}}
</td>
<td style="text-align:right;border-bottom:1px solid {{coloring_score( account.score )}}">
{{account.amount | number:2}} €
</td>
<td style="text-align:right;border-bottom:1px solid {{coloring_score( account.score )}}">
{{account.score}}
</td>
</tr>
</tbody>
</table>
</md-card>
<!-- <md-card flex="56">
<table class="table">
<thead>
<tr>
<th><md-buton data-ng-click="bucket.order_by( 'account' )">account</md-buton></th>
<th><md-buton data-ng-click="bucket.order_by( 'amount' )">amount</md-buton></th>
<th><md-buton data-ng-click="bucket.order_by( 'score' )">score</md-buton></th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="account in bucket.data | orderBy:bucket.orderBy:bucket.orderDesc"
data-ng-class="{'even': $even, 'odd': $odd}"
style="border-left:10px solid {{coloring_score( account.score )}};border-right:10px solid {{coloring_score( account.score )}}">
<td style="border-bottom:1px solid {{coloring_score( account.score )}}">
{{account.account}}
</td>
<td style="text-align:right;border-bottom:1px solid {{coloring_score( account.score )}}">
{{account.amount | number:2}} €
</td>
<td style="text-align:right;border-bottom:1px solid {{coloring_score( account.score )}}">
{{account.score}}
</td>
</tr>
</tbody>
</table>
</md-card> -->
</md-content>
</md-card>
</md-content>