Code Monkey home page Code Monkey logo

Comments (25)

DevangiDesai avatar DevangiDesai commented on July 30, 2024 19

Found solution for spacing on xAxis
chartView.xAxis.spaceMin = 0.5
chartView.xAxis.spaceMax = 0.5

from charts.

seriyvolk83 avatar seriyvolk83 commented on July 30, 2024 5

Not the solution, but will help anyone who searches for how to remove the paddings:

chartView.xAxis.avoidFirstLastClippingEnabled = true
chartView.minOffset = 0

from charts.

danielgindi avatar danielgindi commented on July 30, 2024 4

@BurhanMughal Please, you are creating too much noise in the system. If there were new, you would have known. You are welcome to try to implement whatever feature is missing, or wait until someone else or I make it.

from charts.

iraklivasha avatar iraklivasha commented on July 30, 2024 4

Hi Guys,

Can someone point the exact configuration for LineChartView so it displays paddings from left and right ? @DevangiDesai I tried code below too, but with no luck. Is there any chance that some other configuration is overlapping this settings ?

chartView.xAxis.spaceMin = 0.5
chartView.xAxis.spaceMax = 0.5

Screen Shot 2019-08-16 at 11 31 28 AM

from charts.

BurhanMughal avatar BurhanMughal commented on July 30, 2024 1

Sorry Daniel if you feel bad. But i was just looking to get informed that the issue is still in process because you closed this issue.

from charts.

odedharth avatar odedharth commented on July 30, 2024 1

tried @PhilJay suggestion but it's problematic when you have few entries...
photo 19-04-2016 3 38 25 pm

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

@PhilJay what do you think? do we have an easy way of "skipping" x-indexes?

from charts.

PhilJay avatar PhilJay commented on July 30, 2024

Well an easy workaround could be to use "" as the first x value and then insert the first entry at x index 1

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

@msanders did that solve your problem?

from charts.

msanders avatar msanders commented on July 30, 2024

@danielgindi No, that insets it much more than I wanted. Is it not possible to add an inset property just for layout?

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

Not right now - we'll have to look into it

from charts.

BurhanMughal avatar BurhanMughal commented on July 30, 2024

Any News about above mentioned issue ?

from charts.

msanders avatar msanders commented on July 30, 2024

@danielgindi Any thoughts as to how we could go about implementing this? Would it just be an update to ChartXAxisRenderer?

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

Well it wouldn't be just about the XAxisRenderer as the other renders (the
chart renderers) would need the spacing also.
So I guess it would be in the ViewPort, but I did not have the time to look
into it yet, as we have other things on our plate :)

‏בתאריך יום רביעי, 13 במאי 2015, Daniel Cohen Gindi [email protected]
כתב:

I closed it earlier when there was no response to the suggestions

from charts.

SvenMuc avatar SvenMuc commented on July 30, 2024

Tried to analyze the ChartViewPortHandler.swift file in order to set the inset. So far without any success. It's hard to understand the code.

I tried to modify the _contentRect, but this changes the size of the whole diagram. As a next step I will try to test different effects by changing the affine transformation.

Does someone can give me a short hint?

from charts.

liuxuan30 avatar liuxuan30 commented on July 30, 2024

speaking of view port handler, you need to think about the transformers. ios-charts need the transformer to calculate the postions. will adding slight offset in transformer help?

from charts.

liuxuan30 avatar liuxuan30 commented on July 30, 2024

did anyone try to change chartXMin so it will have slight offset at the beggining? I remember I tried once, and deltaX potentially impacts the offset on right side

from charts.

danielgindi avatar danielgindi commented on July 30, 2024

Implemented in Charts 3.0 (v3 branch) (Use axisMinValue/axisMaxValue)

from charts.

liuxuan30 avatar liuxuan30 commented on July 30, 2024

does it hold a property for that?

from charts.

jetboh avatar jetboh commented on July 30, 2024

spaceMin / spaceMax didn't work for me but adjusting axisMinValue / axisMaxValue slightly did.

from charts.

29satnam avatar 29satnam commented on July 30, 2024

@DevangiDesai solution does work if you want to add padding on xAxis at right and left.

self.chartView.xAxis.spaceMin = 10; self.chartView.xAxis.spaceMax = 2;

Here's a preview for future viewers:

screen shot 2018-05-09 at 1 50 45 pm

from charts.

juancarlosdmz avatar juancarlosdmz commented on July 30, 2024

Hi, this is an old issue, but I have a problem when I try to do this:
lineChartView.xAxis.valueFormatter = IndexAxisValueFormatter(values: model.months) lineChartView.xAxis.setLabelCount(model.months.count, force: true) lineChartView.xAxis.spaceMin = 0.2; lineChartView.xAxis.spaceMax = 0.2

the space is working, but I'm not being able to draw the twelve months, any idea?

from charts.

elliotcz97 avatar elliotcz97 commented on July 30, 2024

Today i faced the same problem as you guys. The methods to use are:

    chartView.xAxis.spaceMin = 0.5
    chartView.xAxis.spaceMax = 0.5

If you want it to work you have to set these properties before you set the data of the chart (at least i got it this way to work)

So for my project i did it this way:

    let data = LineChartData(dataSet: dataSet)
    chartView.xAxis.spaceMin = 0.2
    chartView.xAxis.spaceMax = 0.2
    chartView.data = data

I hope this helps someone in the future. Great library btw, i love it!

from charts.

cameronehrlich avatar cameronehrlich commented on July 30, 2024

Not the solution, but will help anyone who searches for how to remove the paddings:

chartView.xAxis.avoidFirstLastClippingEnabled = true
chartView.minOffset = 0

Thank you @seriyvolk83, this solved the problem I was having!

from charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.