Skip to content

GridLabelRenderer humanRound causes data to be hidden #681

@VeloSteve

Description

@VeloSteve

In GridLabelRenderer.adjustHorizontal the call to humanRound is hardwired to false for the second argument. This means that the increments between labels will always round down. That leads to data being truncated from the graph.

An easy way to see this is a one-line modification of the all-XML example given here. Replace the last line of

    <com.jjoe64.graphview.helper.GraphViewXML
        android:layout_width="match_parent"
        android:layout_height="100dip"
        app:seriesData="0=5;2=5;3=0;4=2" />

with

        app:seriesData="100=5;150=5;200=0;250=2" />

and you will see that the data, which runs from 100 to 250, is truncated at 180, hiding two of the four points.
GraphTruncated

There are several ways to address this I suppose, including

  • Just hardwire the value to true. This may waste a little screen space, but should not hide data.
  • Make the value user-configurable.
  • Adjust both the step size and number of labels for a possibly better compromise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions