ChartsOrg / ChartsOrg/Charts

LineChart disappears when zoom on X axe

Open
#5,042 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

## What did you do?

I have a LineChartView to display temperatures over a day.

```
self.lineChartView.gridBackgroundColor = .white
self.lineChartView.borderLineWidth = 2
self.lineChartView.borderColor = .systemGray
self.lineChartView.chartDescription.text = ""
self.lineChartView.gridBackgroundColor = .clear
self.lineChartView.backgroundColor = .clear
self.lineChartView.pinchZoomEnabled = false
self.lineChartView.doubleTapToZoomEnabled = false
self.lineChartView.delegate = self
self.lineChartView.scaleYEnabled = false
self.lineChartView.scaleXEnabled = true
self.lineChartView.extraBottomOffset = 10
```

image

## What did you expect to happen?

Since I have a lot of values for a single day, and all single value is really important, I need to zoom over the X axe disabling zoom on Y axe.

## What happened instead?

The problem is that the line disappears when I zoom-in. If I set y-zoom to true the line remains on screen, but If I set it to false, when zooming it disappears.

image

![zooming](https://github.com/danielgindi/Charts/assets/127401657/3094c6d7-8ad9-49e5-b086-032eda11e7ff)

## Charts Environment

**Charts version: 4.1.0**
**Xcode version: 14.2**
**Swift version: 5**
**Platform(s) running Charts: macOS**
**macOS version running Xcode: Ventura 13.0**

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported LineChartView configuration in Charts 4.1.0 with scaleXEnabled true and scaleYEnabled false, using the temperature data described in the issue. Trace the X-only zoom path and verify that the line remains visible after zooming; done means horizontal zoom works without requiring Y-axis zoom.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.