-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create morbidity & demographic dashboards
- Loading branch information
1 parent
ee078b6
commit 69cdf94
Showing
91 changed files
with
2,841 additions
and
485 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const build_data = (subType, data) => { | ||
if (subType === "pyramidBar") { | ||
data.options.scales.xAxes[0].ticks.callback = (v) => v < 0 ? -v : v | ||
data.options.tooltips.callbacks.label = (c) => { | ||
console.log(c) | ||
let value = Number(c.value) | ||
value = value < 0 ? -value : value | ||
|
||
let datasetLabel = data.data.datasets[c.datasetIndex].label | ||
return `${datasetLabel}: ${value}` | ||
} | ||
} | ||
return data | ||
} | ||
|
||
export const renderChart = (ChartJS, charts, { id, subType, data }) => { | ||
if (charts[id]) { | ||
charts[id].destroy() | ||
} | ||
|
||
charts[id] = new ChartJS(id, build_data(subType, data)) | ||
} |
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
File renamed without changes.
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
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
14 changes: 11 additions & 3 deletions
14
lib/health_board_web/live/live_views/dashboard_live/data/card_data/births/births.ex
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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
defmodule HealthBoardWeb.DashboardLive.CardData.Births do | ||
@spec fetch(pid, map, map) :: nil | ||
def fetch(_pid, _card, _data) do | ||
nil | ||
@spec fetch(pid, map, map) :: map | ||
def fetch(_pid, _card, data) do | ||
%{year_births: %{total: births}} = data | ||
|
||
%{ | ||
filters: %{ | ||
year: data.year, | ||
location: data.location_name | ||
}, | ||
result: %{births: births} | ||
} | ||
end | ||
end |
Oops, something went wrong.