Skip to content

Conversation

@benjaminleonard
Copy link
Contributor

@benjaminleonard benjaminleonard commented Feb 17, 2025

Seems like a small change but it makes them feel much more resolved in the container.
Comments explain it pretty well, but essentially we can figure out the container width by taking the width of a character – which we know – and adding the padding and tick stroke size. Recharts does not have a way of doing this natively.

It is possible to calculate the width of a string, given the string and the text using the canvas – which is dynamic of course but probably overkill in this instance. We might need to re-evaluate for mobile layouts eventually.

Before:
image

After:
image

@vercel
Copy link

vercel bot commented Feb 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Feb 17, 2025 4:38pm

Copy link
Collaborator

@david-crespo david-crespo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subtle, yet exquisite

@david-crespo david-crespo merged commit 82096ba into oxql_disk_metrics Feb 18, 2025
7 checks passed
@david-crespo david-crespo deleted the dynamic-chart-y-axis-width branch February 18, 2025 23:27
david-crespo added a commit that referenced this pull request Feb 27, 2025
* Add stub of Disk Metrics using OxQL

* Refactoring; getting chart working; needs better default situation

* refacotrs; remove old DiskMetrics; add writes and flushes charts

* initial stub for CPU metrics

* file reorg

* More CPU metrics, though we mgiht need to rethink the long-term plan

* working group_by

* Updates to routes to handle sub-tabs

* Dropdown working on CPU charts

* cleanup

* more work on charts; networking

* Standardize wrapper components

* Reorder charts a bit

* getting side tabs into place

* Update side tab CSS

* Consolidate SideTabs into legacy tabs, using props to control layout

* refactoring; getting rollups working for disks and network interfaces

* Pass pre-formed query string to metric component

* Move date selector up a level, using useContext

* Update routes in path-builder test

* Small refactor to align approach to useState and dropdowns for network and disk metrics tabs

* Add static values for metrics for testing and mock service worker

* Removes TS guard that was a bit onerous; relying on casting now, though, which isn't great

* Updated mock data for disks

* small refactor before integrating Ben's PR

* Refactoring chart logic

* Add tests for OxQL charts

* Better handle cumulative_u64 data with initial sum value

* Instance metrics design tweaks (#2676)

Co-authored-by: David Crespo <david.crespo@oxidecomputer.com>
Co-authored-by: Charlie Park <charlie@oxidecomputer.com>

* a little code cleanup

* make getOxqlQuery args more generic and structured

* view/copy oxql modal

* inline oxql query modal, remove comment about showing query

* NonEmptyArray whaaaaaaat

* highlight oxql

* Add 'More about OxQL queries' button/link to modal

* test for rendered oxql in modal

* Better link style for OxQL docs

* slightly smaller text

* clean up my weird half-finished metrics props change

* CopyCode footer

* handle no nics case on network metrics

* small aria label fix

* Add restriction to only turn on query reloading once initial data have succcessfully loaded in

* Simplify CPU utilization tab

* Metrics more actions (#2700)

* OxQL metrics more actions

* take CopyCodeModal refactor further, fix motion import

* move oxql schema docs thing into links file

---------

Co-authored-by: David Crespo <david.crespo@oxidecomputer.com>

* tweak more actions menu copy one more time

* Dynamic chart Y axis width (#2697)

* Dynamic Y axis width

* Remove spacing and make tick size/margin explicit

* Need spacing on old cards

* Updates, and better logic on utilization chart; still accounting for cpus count

* Updates to incorporate nCPUs in utilization calculation

* small refactor

* Updated test for utilization

* Move OxqlMetric files to own component directory

* A few more tests

* update import

* tests are easier to make sense of when you can see all the data at once

* Default to single state on CPU utiization tab; offer 'total' option

* Update metrics schema URL

* Metrics error & loading states (#2698)

* Move some loaders to parent component

* Update dropdown to cap at 24 hours and handle minimum mean_within

* Use seconds when determining durations

* remove intervalPicker until OxQL is faster

* Less twitchy datepicker wrap

* clean up chart loading states

* init MetricsContext with null instead of dummy values

* Update mock numbers so CPU utilization range is normal

* use lazy imports in the routes

* blarg lint

* Clean up CPU charts

* revert CpuStateMetric component

* utils file tweaks, abstract slightly less

* replace getUnit with explicit unit prop

* use date-fns

* use delay function for sleeps

---------

Co-authored-by: Benjamin Leonard <benji@oxide.computer>
Co-authored-by: David Crespo <david.crespo@oxidecomputer.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants