-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/ATL-10'
- Loading branch information
Showing
22 changed files
with
441 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,4 +132,12 @@ | |
} | ||
} | ||
|
||
&__include-annual-option { | ||
margin-left: 0.5rem; | ||
} | ||
|
||
&__include-temporal-option { | ||
margin-left: 0.5rem; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ions/components/characterizations/characterization-view-edit/explore-temporal-cohort.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="explore-temporal-cohort"> | ||
<div class="upper-tabs" data-bind="foreach: tabs"> | ||
<div data-bind="css: { active: $component.selectedTabKey() === key }, | ||
click: $component.selectedTabKey.bind($component, key)"> | ||
<span data-bind="text: title"></span> | ||
</div> | ||
</div> | ||
<div data-bind="with: $component.tabs.find(t => t.key === $component.selectedTabKey())"> | ||
<div data-bind="component: { name: 'explore-temporal', params: componentParams }"></div> | ||
</div> | ||
</div> |
28 changes: 28 additions & 0 deletions
28
...ations/components/characterizations/characterization-view-edit/explore-temporal-cohort.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
define([ | ||
"knockout", | ||
"utils/CommonUtils", | ||
"components/Component", | ||
"utils/AutoBind", | ||
"text!./explore-temporal-cohort.html", | ||
"less!./explore-temporal-cohort.less", | ||
'components/tabs', | ||
'./explore-temporal', | ||
], function (ko, commonUtils, Component, AutoBind, view, tabs) { | ||
|
||
class ExploreTemporalCohort extends AutoBind(Component) { | ||
constructor(params) { | ||
super(params); | ||
const temporal = params.temporal || {}; | ||
this.temporalDataByCohort = temporal.temporalDataByCohort || {}; | ||
|
||
this.tabs = this.temporalDataByCohort.map(cohort => ({ | ||
title: cohort.cohortName, | ||
key: cohort.cohortName, | ||
componentParams: { data: cohort.temporalInfo }, | ||
})); | ||
this.selectedTabKey = ko.observable(this.tabs.length > 0 ? this.tabs[0].key : null); | ||
} | ||
} | ||
|
||
commonUtils.build('explore-temporal-cohort', ExploreTemporalCohort, view); | ||
}); |
17 changes: 17 additions & 0 deletions
17
...ions/components/characterizations/characterization-view-edit/explore-temporal-cohort.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.explore-temporal-cohort { | ||
.upper-tabs { | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
div { | ||
flex: 1; | ||
border: 1px solid grey; | ||
padding: 5px; | ||
cursor: pointer; | ||
|
||
&.active { | ||
background-color: lightgrey; | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...terizations/components/characterizations/characterization-view-edit/explore-temporal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="explore-temporal"> | ||
<div data-bind="foreach: tabs"> | ||
<div data-bind="css: { active: $component.selectedTabKey() === key }"> | ||
<div data-bind="component: { name: componentName, params: componentParams }"></div> | ||
</div> | ||
</div> | ||
</div> |
46 changes: 46 additions & 0 deletions
46
...acterizations/components/characterizations/characterization-view-edit/explore-temporal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
define([ | ||
"knockout", | ||
"text!./explore-temporal.html", | ||
'components/Component', | ||
'utils/CommonUtils', | ||
'utils/AutoBind', | ||
'components/tabs', | ||
'./temporal/annual', | ||
'./temporal/temporal', | ||
"less!./explore-temporal.less", | ||
], | ||
function ( | ||
ko, | ||
view, | ||
Component, | ||
commonUtils, | ||
AutoBind, | ||
tabs, | ||
) { | ||
|
||
class ExploreTemporal extends AutoBind(Component) { | ||
constructor(params) { | ||
super(params); | ||
this.tabs = [ | ||
{ | ||
title: 'Annual', | ||
key: 'annual', | ||
componentName: 'explore-temporal-annual', | ||
componentParams: { data: params.data.temporalAnnual }, | ||
visible: () => params.data.temporalAnnual && params.data.temporalAnnual.length > 0 | ||
},{ | ||
title: 'Daily', | ||
key: 'daily', | ||
componentName: 'explore-temporal-daily', | ||
componentParams: { data: params.data.temporalDaily }, | ||
visible: () => params.data.temporalDaily && params.data.temporalDaily.length > 0 | ||
}, | ||
].filter(v => v.visible()); | ||
console.log(this.tabs); | ||
this.selectedTabKey = ko.observable(this.tabs.length > 0 ? this.tabs[0].key : null); | ||
} | ||
} | ||
|
||
commonUtils.build('explore-temporal', ExploreTemporal, view); | ||
} | ||
); |
10 changes: 10 additions & 0 deletions
10
...terizations/components/characterizations/characterization-view-edit/explore-temporal.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.explore-temporal { | ||
div.tabs__header { | ||
background: #fff; | ||
border-bottom: solid 1px #ccc; | ||
} | ||
span.tabs__header-title { | ||
background: #999; | ||
color: #ffe; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...cterizations/components/characterizations/characterization-view-edit/temporal/annual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<div data-bind="css: classes()"> | ||
<table data-bind=" | ||
dataTable: { | ||
data: $component.data(), | ||
options: { | ||
columns: $component.tableColumns, | ||
dom: 'Blftipr', | ||
pageLength: $component.tableOptions.pageLength, | ||
lengthMenu: $component.tableOptions.lengthMenu, | ||
language: ko.i18n('datatable.language') | ||
} | ||
} | ||
"> | ||
<thead> | ||
<tr> | ||
<th>Count</th> | ||
<th>Avg</th> | ||
<th>Year</th> | ||
</tr> | ||
</thead> | ||
</table> | ||
</div> |
61 changes: 61 additions & 0 deletions
61
...racterizations/components/characterizations/characterization-view-edit/temporal/annual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
define([ | ||
"knockout", | ||
"text!./annual.html", | ||
'components/Component', | ||
'utils/CommonUtils', | ||
'utils/AutoBind', | ||
'numeral', | ||
'../utils', | ||
'utils/ChartUtils', | ||
'd3', | ||
'atlascharts', | ||
'components/charts/histogram', | ||
"less!./annual.less", | ||
], | ||
function ( | ||
ko, | ||
view, | ||
Component, | ||
commonUtils, | ||
AutoBind, | ||
numeral, | ||
utils, | ||
ChartUtils, | ||
d3, | ||
atlascharts, | ||
) { | ||
|
||
class ExploreTemporalAnnual extends AutoBind(Component) { | ||
constructor(params) { | ||
super(params); | ||
this.tableColumns = [ | ||
{ | ||
title: 'Year', | ||
data: 'year', | ||
class: this.classes('col-year'), | ||
}, | ||
{ | ||
title: 'Count', | ||
class: this.classes('col-count'), | ||
render: (s, p, d) => numeral(d.count || 0).format(), | ||
}, | ||
{ | ||
title: 'Pct', | ||
class: this.classes('col-pct'), | ||
render: (s, p, d) => { | ||
const pct = utils.formatPct((d.avg * 100) || 0); | ||
return `<div class="pct-fill" style="width: ${pct}"><div>${pct}</div></div>`; | ||
}, | ||
}, | ||
]; | ||
this.tableOptions = {...commonUtils.getTableOptions('M'), pageLength: 10}; | ||
|
||
this.temporal = params.data || []; | ||
this.data = ko.observableArray(this.temporal); | ||
} | ||
|
||
} | ||
|
||
commonUtils.build('explore-temporal-annual', ExploreTemporalAnnual, view); | ||
} | ||
); |
Oops, something went wrong.