Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
=====controller=====================
$http.get('/smartfarm/showconfiguredmasters/'+uid).then(function(response){
$scope.configuredmasters = response.data;
var cmid = response.data[0].id;
$http.get('/smartfarm/getdata/'+uid+'/'+cmid).then(function(response){
$scope.farmdatas = response.data;
$scope.d0_1 = [];
for(var j=0; j<response.data.length; j++)
{
$scope.d0_1.push([ j+1 , response.data[j].temperature ]);
}
});
});
===========================================template========================================
<div class="col-md-6">
<div class="panel">
<div class="panel-heading font-bold bg-primary">Temperature</div>
<div class="panel-body">
<div ui-jq="plot" ui-options="
[
{ data:{{d0_1}} , label: 'in C', points: { show: true }, lines: { show: true, fill: true, fillColor: { colors: [{ opacity: 0.1 }, { opacity: 0.1}] } } }
],
{
colors: [ '{{app.color.info}}','{{app.color.warning}}' ],
series: { shadowSize: 2 },
xaxis:{ font: { color: '#ccc' } },
yaxis:{ font: { color: '#ccc' } },
grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' },
tooltip: true,
tooltipOpts: { content: '%s of %x.1 is %y.4', defaultTheme: false, shifts: { x: 0, y: 20 } }
}
" style="height:240px">
</div>
</div>
</div>
</div>
====================angular routes=====================
.state('app', {
abstract : true,
url : '/app',
templateUrl: layout,
})
.state('app.dashboard-v1', {
url : '/dashboard-v1',
templateUrl: 'tpl/app_dashboard_v1.html',
resolve : load(['toaster','js/controllers/chart.js'])
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.