AppDevNext / AndroidChart

A fork from dead upstream with a lot of merged pull requests from upstream. Including Espresso tests and screenshot tests
Other
114 stars 16 forks source link

Add custom positions #139

Closed papjul closed 1 year ago

papjul commented 1 year ago

First of all, I'm very thankful to you for keeping this library alive!

This pull request adds ability to have custom positions for lines and labels.

Custom position for labels was already written by someone else so I cherry-picked it, then I added support for grid lines to follow position of labels as well.

Here is an example of a chart with customized positions for X and Y axis where I customized labels to achieve what I wanted to do:

Precipitation forecast: image

I'm very new to AndroidChart, so it needs a review from someone with better knowledge, although risk should be very low as this new feature is hidden behind an option that is disabled by default, so there should be no impact on existing graphs.

Thank you,

papjul commented 1 year ago

I added the demo, I’m not sure what the numbers mean for activity listing, I had to shift numbers for other activities or it would crash on opening app. Please review if there is any impact.

I shortened "specificLabelPositions" to "specificPositions" as it also includes lines in my version.

I wanted to change the "C style syntax" you mentioned but when looking at the surrounding code it’s how functions above are written. So I would suggest making Java style homogenous with all functions on a separate work from this PR.

hannesa2 commented 1 year ago

I wanted to change the "C style syntax" you mentioned but when looking at the surrounding code it’s how functions above are written. So I would suggest making Java style homogenous with all functions on a separate work from this PR.

Agree, it's a general question if I should reformat all code and loose direct connect to upstream code.

hannesa2 commented 1 year ago

I see this is new sample nr. 23 image

Unfortunately it doesn't extend sample nr. 1 image

The best would be to extend sample 1 to show diff to sample 23 with same data. Or add an option in 1 to add custom positions.

But this is just optional. Thanks for your afford !