ChartsOrg / ChartsOrg/Charts

Chart viewport change height when it has no data

Open
#4,239 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

* [x] 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?

Showing a line graph with and without data.
Setup:
lineChartView.drawBordersEnabled = false
lineChartView.drawMarkers = true
lineChartView.highlightPerTapEnabled = true
lineChartView.highlightPerDragEnabled = true
lineChartView.chartDescription = nil
lineChartView.leftAxis.enabled = false
lineChartView.isUserInteractionEnabled = true
lineChartView.dragXEnabled = true
lineChartView.dragYEnabled = false
lineChartView.setScaleEnabled(false)
lineChartView.pinchZoomEnabled = false
lineChartView.extraRightOffset = 10.0
lineChartView.extraLeftOffset = 16.0
lineChartView.noDataText = GSHLocalizedString(noDataTextId)
lineChartView.noDataFont = UIFont.wm330Light14
lineChartView.noDataTextAlignment = .center
lineChartView.noDataTextColor = .wmBlack
lineChartView.animate(xAxisDuration: 0.5)

axis minimum and maximum is also set to 0-6

## What did you expect to happen?

Chart viewport height stays the same.

## What happened instead?

Chart viewport is expanding when there is no data. And shrinking chart inside the viewport when data is shown. See attached screenshots.

## Charts Environment

**Charts version/Branch/Commit Number: 3.4.0**
**Xcode version: 11.2.1**
**Swift version: 5.1**
**Platform(s) running Charts: iOS**
**macOS version running Xcode: Catalina**

![Bildschirmfoto 2019-12-04 um 16 57 39](https://user-images.githubusercontent.com/58185389/70158428-80907b00-16b7-11ea-9cf1-09bd3deaaec3.png)
![Bildschirmfoto 2019-12-04 um 16 58 30](https://user-images.githubusercontent.com/58185389/70158429-80907b00-16b7-11ea-97bf-2b1ae77a34aa.png)

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.