Comments (2)
I've been making progress on this front and have a semi-presentable version working.
how it works
I have added a summary
option to the config with a list of human readable titles as attributes. These each default to true
, but you can swap them over to false
.
...
"summary": {
"Unique Vehicles": true,
"Active Vehicles": true,
"Total Trips": true,
"Total Trip Distance": true,
"Distance Per Vehicle": true,
"Vehicle Utilization": true,
"Trips Per Active Vehicle": true,
"Avg Trip Distance": true,
"Avg Trip Duration": true
},
...
This object is now rendered to the report template, just like we do for the report's data blob. I have this working by then mapping the human readable names to the div ids, then I simply find the respective divs and delete the elements at render time. This works fine and you can see an example with 3 disabled fields here:
what's next
I'm happy with the general config flow and how we are rendering this in the UI, except for one issue. If you delete metric elements across rows, it can lead to some funny layouts. The grid system adapts nicely horizontally but does not adapt vertically. Here's an example of that behavior with more of the metrics disabled:
What I am planning to try next is to walk through the metrics list and render the layout like this:
rows = []
row = 0
for metric in metricConfig:
if metric == true:
if rows[rows.length-1] < 3:
rows[row].push(metric)
else:
rows.push([])
row++
rows[row].push(metric)
This would mean that the rows will "fill" with a max of 3 metrics per row, until all the enabled metrics have been rendered. The last row, wherever it lands, will center the metrics horizontally as seen in the existing implementation above.
from mobility-metrics.
Shipped in v4.0
from mobility-metrics.
Related Issues (20)
- trip & status hashing HOT 1
- report hashing HOT 1
- Add report signature to report interface HOT 1
- export all dump failure HOT 1
- bug in weekly aggregates
- Map visualizations over an arbitrary date range HOT 2
- Make the timezone configurable
- Add ability to specify MDS version HOT 2
- document config options HOT 1
- MDS specifies min_end_time query parameter for trips, but this uses start_time & end_time HOT 5
- add hover popup showing stats on maps
- polygon filter HOT 1
- vehicle type filter HOT 1
- docker based deployment HOT 1
- [Nodejs 12] Problem with Mapbox dependency during installation HOT 2
- --version,-v flag HOT 1
- Zones optionality brakes geo aggregation
- Problem installing mobility-metrics on Linux HOT 1
- Add User-Agent to Header HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mobility-metrics.