ChartsOrg / ChartsOrg/Charts

One label per one bar

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

Description

I want a single label only per single bar and also I want the same label on the y-axis with 0 to 100 with 25 of the gap in each step.

## What did you do?

chartView.chartDescription?.enabled = false
chartView.dragEnabled = false
chartView.setScaleEnabled(false)
chartView.pinchZoomEnabled = false
chartView.drawBarShadowEnabled = false
chartView.rightAxis.enabled = false
chartView.rightAxis.drawAxisLineEnabled = false
chartView.drawBordersEnabled = false
chartView.legend.form = .none

let xAxis = chartView.xAxis
xAxis.drawGridLinesEnabled = false
xAxis.drawAxisLineEnabled = false
xAxis.labelPosition = .bottom
xAxis.labelFont = .boldFont(13)
xAxis.labelTextColor = .darkGray

let leftAxisFormatter = NumberFormatter()
leftAxisFormatter.minimumFractionDigits = 0
leftAxisFormatter.maximumFractionDigits = 1
leftAxisFormatter.negativeSuffix = "%"
leftAxisFormatter.positiveSuffix = "%"

let leftAxis = chartView.leftAxis
leftAxis.drawAxisLineEnabled = false
leftAxis.labelFont = .boldFont(13)
leftAxis.labelTextColor = .darkGray
leftAxis.valueFormatter = DefaultAxisValueFormatter(formatter: leftAxisFormatter)

## What did you expect to happen?

![Screenshot 2020-11-27 at 10 10 41 AM](https://user-images.githubusercontent.com/41230403/100411823-cef11380-3098-11eb-9492-2550632989c8.png)

## What happened instead?

![Screenshot 2020-11-27 at 10 10 52 AM](https://user-images.githubusercontent.com/41230403/100411839-d6b0b800-3098-11eb-8108-0338c62dbead.png)

Issues I have:

-It shows multiple labels on the x-axis with the same text
-It also shows that grid line as well. I want to remove it
-I want the y-axis to be fixed values from 0 to 100 with 25 of margin in between.

I want to remove that extra X-Axis labels other than what it's below the bar and also I want 0 to 100% with 25% of the range between them and remove that grid lines.

## Charts Environment

**Charts version/Branch/Commit Number:** 3.6.0
**Xcode version:** XCode 12
**Swift version:** Swift 5.3

Contributor guide

Open the contributing guide

Research direction

Start with the chartView.xAxis and chartView.leftAxis configuration shown in the issue, then read the axis-label, grid-line, and value-range behavior for Charts 3.6.0. Reproduce the setup and determine whether the reported duplicate labels, grid line, and 0–100% range can be configured; done means one label per bar, no unwanted grid line, and 25% intervals from 0 to 100%.

Written by the indexing model from the issue text.

Assessment

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