Giter VIP home page Giter VIP logo

Comments (2)

morganherlocker avatar morganherlocker commented on September 10, 2024

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:

Screenshot 2019-10-16 23 48 39

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:

Screenshot 2019-10-16 23 50 35

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.

morganherlocker avatar morganherlocker commented on September 10, 2024

Shipped in v4.0

from mobility-metrics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.