MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

[Feature Request] Re-scaling X Axis when zooming

Open cynuxsolutions opened this issue 10 years ago • 2 comments

Is there any way to be able to re-scale the X-axis as you zoom in for Bar chart ?

For instance, the initial X-axis scale is by day and as you zoom in to a certain day X-axis scale becomes by hour.

Like my scenario is to scale X-axis with dates (i.e. Jul 5, Jul 6, Jul 7...) and after zooming in on a certain level I want to see the hours (i.e. 10:00, 11:00, 12:00...) on my X-axis to have a more accurate information about my data item.

cynuxsolutions avatar Apr 29 '16 05:04 cynuxsolutions

The only one way at the moment as i see is to rewrite your own renderers and handle scale factor to show time instead of date, also set X values as millis

romatroskin avatar May 05 '16 12:05 romatroskin

This will be possible in v3.0.0 using AxisValueFormatter.

The new branch already contains an example: https://github.com/PhilJay/MPAndroidChart/blob/remove_xindices/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivity.java

The formatter in the example scales from days to month / year: https://github.com/PhilJay/MPAndroidChart/blob/remove_xindices/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/DayAxisValueFormatter.java

PhilJay avatar Jun 18 '16 10:06 PhilJay