Skip to content

Commit

Permalink
Add chart configuration flag to disable same day dot styling on charts
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Plata committed Jul 10, 2017
1 parent 81dc701 commit 471a056
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion js/gc-chart-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ window.GC = window.GC || {};
// been stored on the server too)
// =========================================================================
var readOnlySettings = {
fileRevision : 208,
fileRevision : 210,

// See the toString method for the rendering template
version : {
Expand Down Expand Up @@ -112,6 +112,8 @@ window.GC = window.GC || {};
limit : 2
},

sameDayDot: true,

// At what point chronologically does one start forecasting adult height?
heightEstimatesMinAge : 12, // months

Expand Down
16 changes: 13 additions & 3 deletions js/gc-grid-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,32 @@


$.each(model, function( index, data ) {
var useSameDayDot = GC.Preferences._data.sameDayDot;

//debugger;
var age = new GC.TimeInterval(patient.DOB).setMonths(data.agemos),
date = new XDate(patient.DOB.getTime()).addMonths(data.agemos),
dateText = date.toString(GC.chartSettings.dateFormat);//,
date = new XDate(patient.DOB.getTime()).addMonths(data.agemos);//,
// years,
// months,
// days;

var sameDay = lastDate && lastDate.diffDays(date) < 1;
var dateText = (useSameDayDot && sameDay) ?
'<div style="text-align: center;font-size:20px">&bull;</div>' :
date.toString(GC.chartSettings.dateFormat);

// Header - Date
$('<th/>').append(
$('<div class="date"/>').html(dateText)
).appendTo(thr1);

// Header - Age
$('<th/>').append(
$('<div class=""/>').html(age.toString(shortDateFormat))
$('<div class=""/>').html(
(useSameDayDot && sameDay) ?
date.toString(GC.chartSettings.timeFormat) :
age.toString(shortDateFormat)
)
).appendTo(thr2);

$.each(scheme.header.rows, function(j, o) {
Expand Down

0 comments on commit 471a056

Please sign in to comment.