JetBrains / lets-plot-kotlin

Grammar of Graphics for Kotlin
https://lets-plot.org/kotlin/
MIT License
419 stars 36 forks source link

Tooltips bug #176

Closed AndreiKingsley closed 1 year ago

AndreiKingsley commented 1 year ago

Tooltips for columns that mapped on x and y are displayed incorrectly

image
alshan commented 1 year ago

Taking in account that mapping y = "b" is ignored (unless stat=identity), this is likely an expected behavior. @AndreiKingsley, what were you expecting in the tooltip?

AndreiKingsley commented 1 year ago

Taking in account that mapping y = "b" is ignored (unless stat=identity), this is likely an expected behavior. @AndreiKingsley, what were you expecting in the tooltip?

Column names ("a", "b) on the left side of tooltips, just like for "c".

alshan commented 1 year ago

I see, at first I thought your complain is about tooltip showing "c: a1" instead of "c: b2" :)

Macro '@' substituted with a default title for given aesthetic, which is <empty> for 'positional' aesthetics x/y. @OLarionova-HORIS am I correct?

AndreiKingsley commented 1 year ago

But why is it empty?

AndreiKingsley commented 1 year ago

Is there any sense in this behavior?

OLarionova-HORIS commented 1 year ago

Macro '@' substituted with a default title for given aesthetic, which is for 'positional' aesthetics x/y. @OLarionova-HORIS am I correct?

Yes, we don't show the default title for positional variables. But it's possible to specify the title explicitly: .line("title for a|@a").line("title for b|@b")

alshan commented 1 year ago

May be we can invert this situation and for the setting .line("@|@a") render the tooltip line as

title value

unconditionally? And let the user to remove the title if necessary using .line("|@a") ?

AndreiKingsley commented 1 year ago

May be we can invert this situation and for the setting .line("@|@a") render the tooltip line as

title value

unconditionally? And let the user to remove the title if necessary using .line("|@a") ?

Seems great!

OLarionova-HORIS commented 1 year ago

So the expected behaviour should be the following:

But what about titles for positionals x/y in the following situations:

Now we use empty titles for them.

alshan commented 1 year ago

without specified tooltips tooltips are set via variable list: layerTooltips( "a", "b" )

I think, in the case of multiline tooltip it's preferable to show title regardless of the kind of the aesthetic.

alshan commented 1 year ago

tooltips are set via variable list: layerTooltips( "a", "b" )

Another way to look at it:

layerTooltips( "a", "b" )

is equivalent to

layerTooltips()
  .line("@|@a")
  .line("@|@b")
alshan commented 1 year ago

Fixed in LPK v4.4.0