ChartsOrg / ChartsOrg/Charts

API for increasing and decreasing for CandleStick Chart

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

Description

In the CandleStickRenderer.
The colors of candle are determined by `open` and `close` values. But in my case (maybe a lot others are same as mine), the colors are determined by the last candleEntry too.

If the the increasing and decreasing had an API the default imp are `open > close` as currently doing. But users also can override, it would be perfect
Please see below, It's very easy to draw colors or hollow candles when drawDataSet.

```
enum Trend {
increasing,
decreasing,
neutral
}

Trend trendOfEntry(entry) {
if open > close {
return .decreasing
} else if open < close {
return .increasing
} else {
return . neutral
}
}
```

Old code
```
if dataSet.shadowColorSameAsCandle
{
if open > close
{
shadowColor = dataSet.decreasingColor ?? dataSet.color(atIndex: j)
}
else if open < close
{
shadowColor = dataSet.increasingColor ?? dataSet.color(atIndex: j)
}
else
{
shadowColor = dataSet.neutralColor ?? dataSet.color(atIndex: j)
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start in CandleStickRenderer and follow the drawDataSet path where increasing, decreasing, and neutral colors are selected from open and close values. Define the requested override behavior while preserving the current open/close defaults, then verify candle and shadow colors for increasing, decreasing, and neutral entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data-visualization, mobile
Issue type
Feature
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.