-
Notifications
You must be signed in to change notification settings - Fork 152
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizing tooltips #102
Comments
Thanks @joakimkejser. Great questions, which should lead to some new features in the future. You should be able to disable the tooltips altogether by setting In terms of the legend title, I'm assuming you're referring specifically to the location text value that's displayed? The only way to set this now is through the workaround you mentioned. I agree that this should be simpler to customize and will add this to the list of updates that need to be made. It's not easy at the moment to customize the tooltip content, but I'll add that to the list of updates as well. |
@sfairgrieve, thanks for getting back to me.
I am specifically referring to the location text value that is displayed, yes. In relation to that, the Another option I would like to see is the ability to also hide the legend box (the colored/styled little icon) in the tooltips. I find them very useful in some cases, but when using a MapMarkerDataLayer unstyled or with very few color options, I would like to exclude them. Once again, thank you for your work on this project - it is immensely useful. Let me know if there is anything I can do to help. Regards, |
You're right. Great points/suggestions. I think these are all things that should be configurable. You should be able to hide the legend boxes using CSS. Something like: div.leaflet-div-icon div.legend-box {
display: none;
} Let me know if that doesn't work. I'm definitely open to contributions, so if you feel like implementing any of these suggestions, I'd be happy to accept pull requests. I'll let you know when I start working on these features once I get some free time (hopefully soon). Scott |
@joakimkejser After reviewing the code, I also forgot that this option existed, but you can pass in an option called var layer = new L.DataLayer(data, {
...
dynamicOptions: function (record) {
return {
layerOptions: {
color: 'red'
},
legendDetails: {
field1: value1
}
};
}
...
}); The |
@sfairgrieve Yes, that does indeed work with a small change:
I called the original function to avoid having to define all my layerOptions again, but this is also a nice way to allow complete control over those. The legendDetails need a "name" and "value" for it to work. Is there a way to call Thanks! This solves my problem for now. I will see if I can help with some of the other options when I get time. |
Great! Yeah, I just noticed that |
@sfairgrieve the pull request is just a minor change, so no hurries. Asesome, the context will be very useful in I have stumbled upon another issue related to tooltips. If A solution could be to move the check on A workaround for now is to leave the
It is a bit of a hack, but it gets the tooltip out of the way. |
@joakimkejser I pushed some updates to master and 1.0dev that address some of your suggestions. Can you give these updates a try when you get a chance? I did some testing, but I'm hoping you can validate things to make sure I didn't miss anything. I may also break out your suggestions into separate issues, so I can track them better. |
@sfairgrieve Thanks for working on this. When I load in 1.0dev, everything works fine, but master gives me an error. I think I've tracked it down to some issue with
where Maybe you have some inputs on that? I'll take a look at the specific features you have implemented tomorrow and validate. Just to clarify, from reading the code I understand that you have added/fixed the following:
Have I missed anything? Great idea seperating the issues - sorry for pouring them all into one issue. I can try and create seperate issues and reference the fixes if you'd like? |
Thanks @joakimkejser. That makes sense. master is setup to work with Leaflet 0.7.x and 1.0dev is setup to work with Leaflet 1.0.x. At some point in the near future, I'll switch master to be the 1.0.x compatible version and ween off any updates related to the 0.7.x version. It's tough trying to support both codebases. The changes you've listed are right. I also updated the code so that the |
@sfairgrieve I tested all of the above against the 1.0dev branch, and it works as intended! Reading through our discussions above, the enhancements related to tooltips that are still missing are:
With that in place, I think we have achieved completely customizable tooltips! I might have some additional enhancement proposals for L.Graph, but I'll open separate issues for that when I have explored/formalized my thoughts on that. Thanks for spending time on this! |
Thanks for validating. I'll plan to add those additional features in the next few days. Any feedback/improvements you have for L.Graph will be much appreciated. |
@joakimkejser I pushed some updates to the feature/custom-tooltips branch, if you want to check it out. This should address #104 and #105. For #104: Under For #105: Under Let me know what you think when you get a chance. |
Hi @sfairgrieve , After remembering to update the css, the I will test and explore the Cheers. |
Hi @sfairgrieve , The I discovered a possible side effect of the changes. Using L.PieChartDataLayer (or any ChartDataLayer i assume), I now how to specify
Furthermore, I seem to have two additional issues:
I can fix the mouserOver/Out issues by adding:
but then I lose the nice exaggerations of the slices on hover. Can you replicate these issues or is it just me? I haven't had the time to read through the code thoroughly, so I'm sorry if I've missed something obvious. |
Thanks for testing this out! I'll investigate and see if I encounter the same issues. |
I see the issue. This is a side effect of removing the if statement around |
@sfairgrieve, your recent changes in the feature/custom-tooltips branch seems to have solved my issues. I'm aware that there still might be some customization issues - haven't checked any of that. |
No one of methods, which described above, didn't work for me. I didn't meet other explanation or any option in docs. In code I even didn't meet those options, which mentioned above. So, I put some changes in PieChartMarker section in leaflet-dvf.markers.js:
and set option options.showTooltipOnChartPart to false. This helps me. Maybe I didn't understand something? I used version 1.0dev. |
Hi,
First of all, thanks for a great library!
I have some questions regarding tooltips:
Sometimes, I would like to use displayOptions and a data property to customize a visualization, but I do not want to show the data property in the tooltip - is there a way to avoid that?
Is there an easier way to change the "title" of the tooltips (the one above the legend)? I have managed to do so for a MapMarkerDataLayer, where per default the lat/lon is showed, by using the custom location mode and changing the text property of the location object. However, this seems like a bit of a workaround.
Is it possible to disable the legend in the tooltips?
Finally, is it possible to completely customize the content of the tooltip, or do I need to implement my own with the onEachRecord function?
Regards,
Joakim Kejser
The text was updated successfully, but these errors were encountered: