Add functionality to download training metrics graphs
Summary
- Implemented a "Download" button in the
MetricGraphcomponent to let users export training metrics graphs as PNG images. - Extracted SVG elements natively, drew them on a canvas, and triggered a PNG download directly, without introducing extra dependencies.
Closes: #5656
How to test
- Open the application UI and navigate to your project.
- Click on the Models tab in the main navigation menu.
- Select a trained model from the list to open the Model Details view.
- Click on the Training Metrics tab inside the details panel.
- You should see one or more line graphs (e.g., Training Loss, Validation Accuracy, etc.).
- Look at the top-right corner of any graph's container box. You should now see a new Download icon button.
- Click the Download button.
- Verify Download: A .png file (named based on the graph's title, e.g., training_loss_metrics.png) should be downloaded to your local machine.
- Verify Image Quality: Open the downloaded image file. Confirm that the graph is fully visible with a solid white background, and that all data lines, axes, and labels rendered correctly exactly as they appeared in the UI.
Checklist
- [x] The PR title and description are clear and descriptive
- [x] I have manually tested the changes
- [x] All changes are covered by automated tests
- [x] All related issues are linked to this PR (if applicable)
- [ ] Documentation has been updated (if applicable)
Hi @dwesolow, @jpggvilaca, @A-Artemis pls let me know if this pr needs any changes or if it is good to merge
Hi @leoll2 could you pls trigger the checks again ?
@andersendsa I tested the feature locally and there are evident problems with the generated image (missing data, poor formatting, ...). However, you say that you tested it and that everything is rendered correctly. Could you maybe share a screenshot of how the graphs look in your environment?
@andersendsa I tested the feature locally and there are evident problems with the generated image (missing data, poor formatting, ...). However, you say that you tested it and that everything is rendered correctly. Could you maybe share a screenshot of how the graphs look in your environment?
Hi @leoll2 sorry for the late reply I was busy in my university examinations I hadnt pushed the commit sorry for that here is the graph I am getting
Thanks for applying the fixes. To be honest, I'm a bit hesitant to accept the feature in its current state. While downloading graphs is certainly useful for researchers, the graphs themselves look a bit rough:
- The units of measurement are absent.
- Axis intervals are not aligned with the data points; they mark for example values like "2.8 epochs" which have no physical meaning.
- Decimal precision is inconsistent
- Text overlaps
Data visualization isn't just a matter of style, it is about presenting information in a digestible and credible way. If you are willing to improve the graphs in the aspects that I mentioned above, then I would be happy to eventually merge the PR, at the moment it's not "production-ready" yet.
Thanks for applying the fixes. To be honest, I'm a bit hesitant to accept the feature in its current state. While downloading graphs is certainly useful for researchers, the graphs themselves look a bit rough:
- The units of measurement are absent.
- Axis intervals are not aligned with the data points; they mark for example values like "2.8 epochs" which have no physical meaning.
- Decimal precision is inconsistent
- Text overlaps
Data visualization isn't just a matter of style, it is about presenting information in a digestible and credible way. If you are willing to improve the graphs in the aspects that I mentioned above, then I would be happy to eventually merge the PR, at the moment it's not "production-ready" yet.
Thank you for the feedback. I’d love to continue working on this PR and keep receiving reviews.
@leoll2 pls let me know if any more changes are required
Thanks for the improvements, the feature now works as expected 😃
@andersendsa A few Eslint checks are failing and blocking this PR, would you check them?
https://github.com/open-edge-platform/geti/actions/runs/31010971233/job/95329949541?pr=6917
@andersendsa A few Eslint checks are failing and blocking this PR, would you check them?
https://github.com/open-edge-platform/geti/actions/runs/31010971233/job/95329949541?pr=6917
Hi @leoll2 I have fixed the failing checks could you pls trigger the checks ?