Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[charts] The tooltip should get a position option #11484

Open
alexfauquette opened this issue Dec 21, 2023 · 3 comments
Open

[charts] The tooltip should get a position option #11484

alexfauquette opened this issue Dec 21, 2023 · 3 comments
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature waiting for 馃憤 Waiting for upvotes

Comments

@alexfauquette
Copy link
Member

alexfauquette commented Dec 21, 2023

Summary 馃挕

Come from this message: https://stackoverflow.com/questions/77590276/customize-the-tooltip-on-a-mui-graph

The idea as I understand it is to force the x/y position of the popper instead of following the mouse position.

placement.mp4

Could be something like sltoProps.popper.placement = 'top' to force the tooltip to appear on top of the chart

Examples 馃寛

No response

Motivation 馃敠

No response

Search keywords: charts tooltip placement

@alexfauquette alexfauquette added enhancement This is not a bug, nor a new feature component: charts This is the name of the generic UI component, not the React module! labels Dec 21, 2023
@MonstraG
Copy link

MonstraG commented Mar 4, 2024

Maybe somewhat overlapping issue:
image

If chart is placed near the edge of the screen, tooltip can be unreadable as it always gets placed to the right.

@MonstraG
Copy link

MonstraG commented Mar 4, 2024

I've discovered that popper's position options can already be passed:

<BarChart
	series={series}
	xAxis={[xAxis]}
	slotProps={{
		popper: {
			placement: "auto-start" // actually works
		}
	}}
	tooltip={{
		slotProps: {
			popper: {
				placement: "auto-start" // ignored
			}
		}
	}}
/>

but note how there are 2 ways to do it, and one of them doesn't do anything.
My issue is resolved.

@flaviendelangle
Copy link
Member

@alexfauquette we should probably either remove tooltip.slotProps.popper from the typing (if not already) or do the merge correctly
Classic slot merging stuff 馃槅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature waiting for 馃憤 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

3 participants