-
Notifications
You must be signed in to change notification settings - Fork 796
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
alt.datum
and alt.value
generates incorrect error messages
#2913
Comments
This seems to have been fixed.partially The error message for The error for the second example also makes sense now:
However, when specifying a property that exists, it still shows an error message which is self-contradictory,
The error message is similar to what we see here #2563 (comment) |
Minimal ReproBoth have identical behavior and meaning import altair as alt
>>> alt.Chart().mark_point().encode(x=alt.datum(1, bin=True))
>>> alt.Chart().mark_point().encode(x=alt.XDatum(1, bin=True)) You can get a different error by trying method chaining like import altair as alt
>>> alt.XDatum(1).bin(True)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[6], line 1
----> 1 alt.XDatum(1).bin(True)
File /altair/altair/utils/schemapi.py:1120, in SchemaBase.__getattr__(self, attr)
1118 except AttributeError:
1119 _getattr = super().__getattribute__
-> 1120 return _getattr(attr)
AttributeError: 'XDatum' object has no attribute 'bin' Note@joelostblom I feel like this might be pretty tricky to fix, since This would be the place to start I guess: altair/tools/schemapi/schemapi.py Lines 702 to 722 in be5e9ec
|
EditOpened #3752 and deleted original comment |
Thanks for looking into this @dangotbanned! The fix in #3750 looks great! |
Happy to help @joelostblom See #3750 for follow-up work |
Originally reported in #2883 (comment). When using the datum encoding then the message is incorrect:
'datum'
should not be included above as an incorrect property to the X channel, insteadwrong_name
should be mentioned as an incorrect parameter todatum
. The way to handle this is probably with special error checking inside the datum function (although maybe it needs to also consider which encoding channel it is used for?).Also mentioned in #2568 (comment) for
alt.value
. This can look more confusing now that the error message gives parameter hints:I found one spec that gives an incorrect hint:
It is allowed to use
alt.value()
in this context, but in this case it should be a string and not a number.The text was updated successfully, but these errors were encountered: