ChartsOrg / ChartsOrg/Charts

Multi-resolution time formatting in line chart in xAxis

Open
#3,685 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

* [✔️ ] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).

## What did you do?

ℹ Played with value formatters but unable to completely fix the problem.

## What did you expect to happen?

ℹ Different labels on xAxis depending on scaling.

## Charts Environment

**Charts version: Branch:** 3.0.5/master
**Xcode version:** 10
**Swift version:** 4.1
**Platform(s) running Charts:** iOS
**macOS version running Xcode:** 10.14

This is not basically an issue but feature request. Or may be I've missed to figure out a way if possible to achieve what I want.

I need a multi-resolution time format in x-Axis in line chart. What this means is depending on the scale of the chart or view port the xAxis will be formatted conditionally.

E.g: If the line chart is showing 2 years data and consider there are 4 grid lines drawn then xAxis will show labels as `Sep 2017`, `Dec`, `Mar 2018`, `Aug`.
When user zooms in or scaling happens horizontally then the format updates to `Oct 1st`, `Oct 4th`, `Oct 7th` etc. And further more scaling changes when day range data is shown to display time of the particular day; e.g `Oct 4th 11:15 Am`, `2:30 Pm`, `5:30 Pm`.

Are there any ways possible to achieve this. One way I have understood is I can create my custom value formatters and hold the xAxis data there to format conditionally. However, understanding the scale range reference is quite difficult and I'm not able to wrap my head around completely.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.