-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Cannot remove pie chart entries on Android #3262
Comments
Hello @ewpatton, ![]() ![]() |
Do you have the app loaded on the Companion, either on a physical device or emulator? Do It requires access to the Companion to work. |
Hello everyone, I wanted to provide additional clarification and confirm the steps I followed: I replicated the issue using the latest version of the Companion on an Android device. Update the ChartData2D.RemoveEntry logic to correctly distinguish between numeric values and string labels. Thank you! |
@ShreyashN16 That sounds roughly correct but in theory people may still want to be able to use numeric labels, they will just have to be converted to strings first. |
@ewpatton int numericLabel = 123;
String label = Integer.toString(numericLabel;
// Add the label to the chart This approach maintains flexibility while conforming to the current requirements. It might also be worth considering an enhancement where the system internally handles such conversions for better usability. |
the code tries to parse the x, y entries in order to get the entry being removed and then to highlight the following one (I guess)
however, the code to determine the index fails if the x value is a real string (such as "apple") and hence doesn't properly parse as a float so I think the best fix is to try to fetch the index from the List, but if we don't have a parseable X value, just set the index to 0
actually, the BEST way is to take advantage of the dataModel methods eg
if it fails in the form of a NumberFormatException, handle that error in |
Thank you for the clarification, @ewpatton. I understand that numeric
labels should still be supported but need to be converted to strings first.
I'll look into ensuring that both numeric and string labels are handled
properly while preventing unintended NumberFormatException errors.
Would it be preferable to enforce this conversion automatically within the
ChartData2D component, or should we require users to explicitly format
their inputs before passing them?
Also, I would love to contribute more to MIT App Inventor beyond this
issue. If you could encourage me by adding me to your team for GSoC 2025, I
would be highly motivated to work on more features and improvements.
Looking forward to your thoughts!
…On Sun, 5 Jan 2025 at 09:16, Evan W. Patton ***@***.***> wrote:
@ShreyashN16 <https://github.com/ShreyashN16> That sounds roughly correct
but in theory people may still want to be able to use numeric labels, they
will just have to be converted to strings first.
—
Reply to this email directly, view it on GitHub
<#3262 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BN7QM73PGGI7GIFL6ZZFPRT2JCTKNAVCNFSM6AAAAABSPWB3KOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZRGQ4DSOBVGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
updating ChartData2D to work with both strings and numbers for the x value (coordinate or label).
otherwise, we will see errors in adb logcat as well as the add/removals will fail to work. We are catching the exception however...
|
updated code will handle a NumberFormatException, calculate the index value of the label-as-x, and pass that again to the 'dataModel' |
handle labels via throwing NFE from within ChartData2D and BarChart
assume that the index from Labels
is not necessarily the same index as what may come back from
|
tested with labels and with numerical x values across all chart types |
Describe the bug
Affects
Expected behavior
Trying to remove an existing entry in the pie chart gives the following error:
Steps to reproduce
The text was updated successfully, but these errors were encountered: