Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compliance chart #45

Merged
merged 15 commits into from
Oct 26, 2015
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions presenter/patient.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,34 @@ module.exports = function (request, reply) {
name: 'test'
},
surveys: surveys,
surveysJson: JSON.stringify(surveys)
surveysJson: JSON.stringify(surveys)
});
};

var scatterChartData = {
datasets: [{
label: "Compliance Chart",
data: [{
x: 1,
y: 0
}, {
x: 1,
y: 51
}, {
x: 2,
y: 52
}, {
x: 3,
y: 53
}, {
x: 4,
y: 54
}
],
borderColor: "rgba(220,220,220,1)",
backgroundColor: "rgba(220,220,220,0.2)",
pointBorderColor: "rgba(220,220,220,1)",
pointBackgroundColor: "rgba(220,220,220,1)",
pointBorderWidth: "1"
}]
}
};
1 change: 1 addition & 0 deletions view/layout/default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script src="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script src="https://cdn.rawgit.com/nnnick/Chart.js/2.0.0-alpha4/Chart.min.js"></script>
<script src="../Chart.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.4.0/fullcalendar.min.js"></script>

<!-- Polyfills -->
Expand Down
74 changes: 74 additions & 0 deletions view/template/patient.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
<div class="col-sm-8">
<div id="calendar"></div>
</div>
<div class="col-lg-4 col-md-6">
<canvas id="scatterChart" width="400" height="400"></canvas>
</div>
<div class="col-xs-12">
<div class="card">
<div class="card-block">
<div class="row">
<div class="col-sm-6">
<h4 class="card-title">
Trials
</h4>
</div>
<div class="col-sm-4">
<div class="card card-inverse card-primary">
<div class="card-block">
Expand Down Expand Up @@ -106,5 +118,67 @@
allDayDefault: true,
events: surveys
});



});

var scatterChartData = {
datasets: [{
label: "My First dataset",
data: [{
x: 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

y: 0
}, {
x: 1,
y: 51
}, {
x: 2,
y: 52
}, {
x: 3,
y: 53
}, {
x: 4,
y: 54
}
], // data
borderColor: "rgba(220,220,220,1)",
backgroundColor: "rgba(220,220,220,0.2)",
pointBorderColor: "rgba(220,220,220,1)",
pointBackgroundColor: "rgba(220,220,220,1)",
pointBorderWidth: "1"
}] // datasets
}; //chartData

window.onload = function() {
var ctx = document.getElementById("scatterChart").getContext("2d");
window.myScatter = Chart.Scatter(ctx, {
data: scatterChartData,
options: {
scales: {
xAxes: [{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sylvr3 time series is simple.
Replace the xAxes code here.
with this code:
https://github.com/nnnick/Chart.js/blob/v2.0-dev/samples/line-time-point-data.html#L71

position: 'top',
gridLines: {
zeroLineColor: "rgba(0,255,0,1)"
},
scaleLabel: {
show: true,
labelString: 'x axis'
}
}],
yAxes: [{
position: 'right',
gridLines: {
zeroLineColor: "rgba(0,255,0,1)"
},
scaleLabel: {
show: true,
labelString: 'y axis'
}
}]
}
}
});
};
</script>