ChartsOrg / ChartsOrg/Charts

LineChart Dataset not rendering

Open
#4,683 2 comments 4 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?

Attempting to draw to line chart datasets.

## What did you expect to happen?

Both datasets should be rendered.

## What happened instead?

Only one dataset was rendered.

## Charts Environment

**Charts version/Branch/Commit Number:** master branch
**Xcode version:** 13.0 beta 3
**Swift version:** 5.x
**Platform(s) running Charts:** macOS
**macOS version running Xcode:** 12.0 beta 3

## Reason

Tracked the issue down to the following method.

open override func entryIndex(
x xValue: Double,
closestToY yValue: Double,
rounding: ChartDataSetRounding) -> Int

in

ChartDataSet

is returning -1 instead of the last index when xValue is equal to or larger than the x-axis entries. This led to an empty range being drawn for one of the two datasets.

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.