Skip to content

ValueFormatter getFormattedValue needs also function with Double #197

Closed

Description

@Paget96

Here is whole issue which exists since long ago
PhilJay/MPAndroidChart#2891

Also would be nice if we can map formatter with Entry data where we can pass multiple info regarding the Entry.

This is needed when we want to add Unix timestamp to X axis. if we do add it now and convert to float, precision is lost, and line is going everywhere but not where it supposed to go.

Activity

  1. hannesa2 commented on May 12, 2024

    @hannesa2
    Collaborator

    Isn't it enough to simple convert double to a float ?
    https://github.com/AppDevNext/AndroidChart/pull/223/files

  2. hannesa2 commented on Dec 30, 2025

    @hannesa2
    Collaborator

    I made at least a test to demonstrate the issue #630

  3. hannesa2 commented on Dec 30, 2025

    @hannesa2
    Collaborator

    we want to add Unix timestamp to X axis.

    I guess for Unix timestamp a Long would be the best solution, am I right ?

  4. hannesa2 commented on Dec 30, 2025

    @hannesa2
    Collaborator

    Does this #631 solve your issue ?
    Without thinking much about it, I simply used an overlapping method with Long.

  5. hannesa2 commented on Dec 30, 2025

    @hannesa2
    Collaborator

    I made #633 to have unix timestamp linechart. Please demonstrate there your

    and line is going everywhere but not where it supposed to go. Then I can search for an easy solution.

    Btw, #631 is the wrong solution (as far as I understand it currently)

  6. added
    question
    on Jan 1, 2026
  7. Paget96 commented on Jan 17, 2026

    @Paget96
    ContributorAuthor

    I will test these. Long for timestamp is ok, problem is chart precision, but I will test and report back.
    Thank you!

  8. hannesa2 commented on Feb 11, 2026

    @hannesa2
    Collaborator

    @Paget96
    I currently add a time chart #720 one value per second and values are looking not that bad. Even millis are somehow precise.
    The SimpleTimeFormat is "HH:mm:ss.sss" of a unix timestamp

    Image

    It looks linear when I add it in a loop (for each second one value).
    Ok, you can ask why i t needs 13 ms by adding 14 values. One value = 1 ms.

    I currently don't loose precision.
    Please tell me where is the issue ? (Otherwise I close this)

  9. hannesa2 commented on Feb 11, 2026

    @hannesa2
    Collaborator

    But I see when you calculate later with values, eg. time difference to next Entry it's somehow non-precise.
    Please see "duration"

    Image
  10. hannesa2 commented on Mar 31, 2026

    @hannesa2
    Collaborator

    #752 solves it now. Please reopen, if it still exist.
    I'll create a new version with it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions