ChartsOrg / ChartsOrg/Charts

Bars not rendering or disappearing while and after dragging

Open
#2,240 32 comments 0 reactions 0 assignees View on GitHub
★★ help wanted
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I've created a bar chart using `BarChartView`. The view displays work hours per day.
Unfortunately, some bars are not rendered at all - and others are disappearing while the whole chart is dragged.

Before the chart is shown the first time, it's zoomed to show only 7 bars at a time:

```
barChart.zoom(scaleX:ceil(CGFloat(dataSet.xMax - dataSet.xMin) / 7), scaleY: 1, x: 0, y: 0)
```

Then the view is animated, so the latest day is shown first:

```
barChart.moveViewToAnimated(xValue: dataSet.xMax, yValue: dataSet.yMin, axis: barChart.rightAxis.axisDependency, duration: 0.8, easingOption: .easeInOutSine)
```

This leads to the following result - so far, so good:

![img_2071](https://cloud.githubusercontent.com/assets/392542/23853456/05898ab8-07ed-11e7-8e7f-752202cc094d.PNG)

As soon as I drag the chart to the right, bars begin to disappear - only the value remains visible (notice the bar of Mo. 6th - it's gone):

![img_2072](https://cloud.githubusercontent.com/assets/392542/23853538/51650d4a-07ed-11e7-999c-48e7ab998780.PNG)

Also all bars which are further left and therefore not visible immediately (because of the zoom) are not rendered at all. What I' doing wrong?

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with BarChartView using the shown zoom and moveViewToAnimated calls, then drag the chart to the right while observing bars outside the initial viewport. Trace the rendering path during zooming, animation, and dragging; done means all bars remain rendered and visible values stay aligned after movement.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
computer-graphics, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.