Angular 9 project of https://heyteacher.github.io/COVID-19/ a COVID-19 Italy Charts based on dataset https://github.com/heyteacher/COVID-19.
Developed with:
Angular 9
ngx-charts
: https://github.com/swimlane/ngx-chartsAngular Material
Bootstrap 4
Font Awasome
Datasources JSON are downloaded directly in raw mode from https://github.com/heyteacher/COVID-19, no backend is needed.
- install
Angular CLI
: https://angular.io/guide/setup-local npm install
- Run
ng serve
for a dev server. Navigate tohttp://localhost:4200/
. The app will automatically reload if you change any of the source files.
Main components and services
src/
│
└───app/
└─── bars-control/ component on header of bar charts
│ with play, pause, stop and select
│ a day in the past
│
└─── charts/ main component with bars and series charts
│
└─── legend/ generic legend component for series chart
│
└─── google-analytics/ module for track pages and event
│ in Google Analytics
│
└─── series-control/ component on header of series charts
│ with Log/Linear view
│
└─── tree-menu/ component tree in the left side with
│ levels contry -> region -> province
│
└─── app-routing.module.ts the routing module to access
│ directly to region /<Region>
│ and province
│ /<Region>/<Province> via URL
│
└─── app.model.ts model of dataset for Bar, Series and
| tree Node, and utility function
|
└─── bars.service.ts prepare data to bar charts
|
└─── data.service.ts download JSON and prepare datasets
| and `tree-menu` structure
|
└─── legends.service.ts manage legends and checkbox
| show/hide series in charts
|
└─── numbers.service.ts prepare data per numbers
| charts
|
└─── series.service.ts prepare data to series and bar
| charts
|
└───locale/
└─── messages.it.xlf italian translations
|
└─── messages.xlf default translation (en)
This project use @heyteacher/ngx-charts
my fork of official repository @swimlane/ngx-charts
which introduce these changes:
-
branch format-tooltip-line-area-charts: apply
yAxisTickFormatting
to toolptip value in line and area charts -
branch adding-axisTickClassByTick-line-area-charts: introduce
xAxisTickClassByTick
andxAxisTickClassByTick
in order to customize grid line depenting tick value (e.g. weekend x-axis, zero y-axis)
These branches are constantly updated with official repository @swimlane/ngx-chart
and merged into a release branch heyteacher-release which is published in npmjs.com
: https://www.npmjs.com/package/@heyteacher/ngx-charts
Localization is implemented via ng xi18n
, xliffmerge
(https://github.com/martinroob/ngx-i18nsupport) and virtaal
(https://github.com/translate/virtaal)
Default language is English
and is supported only Italian
language
-
install
xliffmerge
andvirtaal
sudo npm install -g ngx-i18nsupport sudo apt install virtaal
-
load
$localize
onto the global scope inpolifills.ts
adding:import '@angular/localize/init';
-
use
i18n
,i18n-title
HTML attributes and$localize
as described in https://angular.io/guide/i18n -
merge new strings to be traslated in
src/locale/messages.it.xlf
npm run i18n
alias of:
ng xi18n --output-path src/locale && xliffmerge --profile xliffmerge.json en it
-
run
virtaal
and fix missin translations insrc/locale/messages.it.xlf
-
test missing traslation
$localize
in*.ts
(not discovered byng xi18n
)npm run serve-prod-it
-
insert missing
$localize
translations in:locale/messages.it.xlf
and translate them
Dashboard can be released in github.io pages (i.e. https://<gitub-user>.github.io/COVID-19)
Replace with your account
-
create repository for pages
https://<gitub-user>.github.io/<base_href>
in github -
checkout the repository inside dist
cd dist git checkout https://<gitub-user>.github.io/COVID-19 prod cd ..
-
copy
src/index.prod.html.sample
insrc/index.prod.html
end edit<baseHref>
, header metadata property, GA id ...etc -
copy
src/environments/environment.prod.ts.sample
insrc/environments/environment.prod.ts
end editbaseHref
, shared properties -
run locally prod environment
npm run serve-prod
or italian localization
npm run serve-prod-it
-
test locally prod environment at http://localhost:4200/COVID-19
-
run locally prod italian environment
npm run serve-prod-it
-
test locally prod environment at http://localhost:4200/COVID-19/it
-
run script
npm run release
-
browser
https://<gitub-user>.github.io/COVID-19