1

How do I set the minimum x-axis (horizontal line). In the example below it has 7 lines. How do I make it to have only 4 intervals?

Also, is there a way to remove the circle on every point to make it just plain line?

For reference, I'm using the iOS-Charts library

example graph

3
  • For clarification, is this the library you're using: github.com/danielgindi/ios-charts? Commented Mar 24, 2016 at 18:05
  • yes the same library I am using Commented Mar 24, 2016 at 18:12
  • @SandeshSardarHave you got the solution for this? I am facing the same issue. Commented Oct 16, 2020 at 10:57

3 Answers 3

2

If you want to show only 4 intervals then you can set the label count to 4.

 chartView.xAxis.labelCount = 4

To hide the circle, disable the drawCircleEnabled for ChratDataSet

chartDataSet.drawCirclesEnabled = false
Sign up to request clarification or add additional context in comments.

Comments

0

To set the minimum of the axis you need to set the customAxisMin property of the axis.

For example in swift:

lineChartView.leftAxis.customAxisMin = 0

To remove the circle you have to set the drawCirclesEnabled property to false on your LineChartDataSet

1 Comment

lineChartView.leftAxis.customAxisMin = 0 is for y-axis, but I need for x-axis
0

For the dot, disable dataSet.isDrawCirclesEnabled.

For the range, check below out. BTW, you have to understand that because you have 7 x axis values, it will draw every one of it by default. If you want fine-grained control, you need to change the renderer logic.

You can set the max range is 4, so only 4 x axis values will be displayed, otherwise you should only pass 4 data values into the chart.

/// Sets the size of the area (range on the x-axis) that should be maximum visible at once (no further zomming out allowed).
/// If this is e.g. set to 10, no more than 10 values on the x-axis can be viewed at once without scrolling.
public func setVisibleXRangeMaximum(maxXRange: CGFloat)
{
    let xScale = _deltaX / maxXRange
    _viewPortHandler.setMinimumScaleX(xScale)
}

/// Sets the size of the area (range on the x-axis) that should be minimum visible at once (no further zooming in allowed).
/// If this is e.g. set to 10, no less than 10 values on the x-axis can be viewed at once without scrolling.
public func setVisibleXRangeMinimum(minXRange: CGFloat)
{
    let xScale = _deltaX / minXRange
    _viewPortHandler.setMaximumScaleX(xScale)
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.