ChartsOrg / ChartsOrg/Charts

Add legend entry without overwrite auto generated

Open
#4,152 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Ho,

i have a Combined Chart with one Stacked Bar Chart and two Line Charts, and two Limit Lines, but in legend i only show Charts entry and not Limit Lines.

![image](https://user-images.githubusercontent.com/18572941/65230243-c92f9380-dacd-11e9-9d60-1f3715684bc4.png)

If i use a Custom Legend, i have an opposite situation:

```
let legend: Legend = graphView.legend
legend.enabled = true

let legendEntryA: LegendEntry = LegendEntry()
legendEntryA.label = "LIMITLINE1"
legendEntryA.formColor = UIColor.black

let legendEntryB: LegendEntry = LegendEntry()
legendEntryB.label = "LIMITLINE2"
legendEntryB.formColor = UIColor.black

var legendArray: [LegendEntry]! = []
legendArray.append(legendEntryA)
legendArray.append(legendEntryB)
legend.setCustom(entries: legendArray)
```

![image](https://user-images.githubusercontent.com/18572941/65230407-17dd2d80-dace-11e9-8039-61ab409e9863.png)

How can i have both legend entries? (Possibly without setting all entries with setCustom...)

Thanks a lot!

## Charts Environment

**Charts version/Branch/Commit Number:** 3.3.0
**Xcode version:** 10.3
**Swift version:** 5
**Platform(s) running Charts:** MacBook Pro
**macOS version running Xcode:** 10.14.6

Contributor guide

Open the contributing guide

Research direction

Start with the Legend and setCustom(entries:) entry points shown in the issue, then trace how a combined chart generates entries for charts and limit lines. The work is done when automatically generated chart entries and manually added limit-line entries can appear together without replacing one another; no test file is named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data-visualization
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.