DSACMS / metrics

Experimentations in Open Source Repository Metrics
https://dsacms.github.io/metrics/
Other
6 stars 3 forks source link

Reports: Add Graph Toggles Component #99

Closed natalialuzuriaga closed 6 months ago

natalialuzuriaga commented 6 months ago

Reports: Add Graph Toggles

Problem

For some of our data visualizations, we generate graphs with data that is timeboxed in intervals such as 1 month, 6 month, 1 year, etc. We would like to add toggle buttons to our reports so users can toggle between different timeframe graph views.

Solution

Result

Screenshot 2024-04-03 at 4 09 33 PM Screenshot 2024-04-03 at 4 09 40 PM

Test Plan

In metrics_data.md, added to the bottom of graph-container div at line 118:

    <!--- Time Toggle Testing -->
    <h3>Commits over Time</h3>
    <div class="timeToggle">
      {% assign optionsArray = '1 Month, 6 Month, 1 Year' | split: ',' %}
      {% assign graphsArray = '/assets/img/graphs/DSACMS/metrics/issue_gauge_metrics_data.svg, /assets/img/graphs/DSACMS/metrics/commit_sparklines_metrics_data.svg, /assets/img/graphs/DSACMS/metrics/issue_gauge_metrics_data.svg' | split: ',' %}
      {% render "graph-toggle", baseurl: site.baseurl, name: "commit" options: optionsArray, graphs: graphsArray %}
  </div>
  <!--- Time Toggle Testing -->
    <h3>PRs over Time</h3>
    <div class="timeToggle">
      {% assign optionsArray = '1 Month, 6 Month, 1 Year' | split: ',' %}
      {% assign graphsArray = '/assets/img/graphs/DSACMS/metrics/issue_gauge_metrics_data.svg, /assets/img/graphs/DSACMS/metrics/commit_sparklines_metrics_data.svg, /assets/img/graphs/DSACMS/metrics/issue_gauge_metrics_data.svg' | split: ',' %}
      {% render "graph-toggle", baseurl: site.baseurl, name: "pull-request" options: optionsArray, graphs: graphsArray %}
  </div>

(This would go into the report templates^)

natalialuzuriaga commented 6 months ago

Alignment needed with the backend:

Styling notes for myself:

IsaacMilarky commented 6 months ago

The graphs that need toggles haven't been merged into main yet so they haven't been generating. We should do a release of dev into main to make things more consistent for development in the future.

As for the graph configuration I think it looks great to me. It makes sense to do it how you set it up IMO.

Overall, we should merge dev into main and make sure that all the toggle graphs are being generated correctly before implementing and merging this PR. Looks great overall!

natalialuzuriaga commented 6 months ago

Oooo ok gotcha, we'll hold off on merging this PR until then. In the meantime, I'll continue tinkering with the css styling

natalialuzuriaga commented 6 months ago

Alright pulled all the changes and it works!! LGTM 🚢

Screenshot 2024-04-04 at 12 54 14 PM Screenshot 2024-04-04 at 12 54 22 PM
natalialuzuriaga commented 6 months ago

@IsaacMilarky Minor but is the legend of those graphs correct? Should it be contributors or it issues?

IsaacMilarky commented 6 months ago

@IsaacMilarky Minor but is the legend of those graphs correct? Should it be contributors or it issues?

Oh good catch, the legend is incorrect and should be contributors. I will fix that