ChartsOrg / ChartsOrg/Charts

Candle stick bar's body cannot be shown if it's height is too small

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

Description

Problem:
When I use Charts version 3.0.1, if the candle stick bar's body's height is less than 0.5 pixel, the candle stick bar's body would not be shown.
Cause:
In class CandleStickChartRenderer's drawDataSet method, drawing body use these codes:
context.setFillColor(color.cgColor)
context.fill(_bodyRect)
but if the body's height is too small, no body would be draw. I set a threshold, and use the codes below instead when body's height is less than 0.5 pixel, problem solved:
context.setStrokeColor(color.cgColor)
context.stroke(_bodyRect)
I hope this problem can be solved in the new release of Charts. I can commit my code to this project.

Contributor guide

Open the contributing guide

Research direction

Start in CandleStickChartRenderer's drawDataSet method, where the issue identifies the body rectangle drawing. Reproduce a candle body below 0.5 pixel and verify that the body becomes visible without changing normal-sized bodies; the issue does not name a test file or specific source path.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.