Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two line in X-Axis #888

Closed
hardikdevios opened this issue Mar 28, 2016 · 6 comments
Closed

Two line in X-Axis #888

hardikdevios opened this issue Mar 28, 2016 · 6 comments

Comments

@hardikdevios
Copy link

Hello,
My Current data is something like this

["Sun\n12:00 AM", "Sun\n03:11 AM", "Sun\n03:12 AM", "Sun\n03:27 AM", "Sun\n03:46 AM", "Today\n12:00 AM", "Today\n12:05 PM"]

 func chartSetup(){ 

        lineChartView.descriptionText = ""
        lineChartView.extraRightOffset = 10
        lineChartView.rightAxis.enabled = false
        lineChartView.highlightPerTapEnabled = false
        lineChartView.drawGridBackgroundEnabled = false

        lineChartView.borderLineWidth = 1.0
        lineChartView.leftAxis.axisLineWidth = 0.5
        lineChartView.xAxis.axisLineWidth = 0.5
        lineChartView.legend.enabled = false
        lineChartView.pinchZoomEnabled = false
        lineChartView.dragEnabled = false
        lineChartView.doubleTapToZoomEnabled = false

        lineChartView.leftAxis.startAtZeroEnabled = false
        lineChartView.leftAxis.spaceBottom = 0
        lineChartView.leftAxis.gridLineDashLengths = [(3.0)]
        lineChartView.leftAxis.drawGridLinesEnabled = true
        lineChartView.xAxis.labelPosition = .Bottom
        lineChartView.xAxis.drawGridLinesEnabled = true
        lineChartView.leftAxis.xOffset = 7
        lineChartView.leftAxis.valueFormatter = NSNumberFormatter()
        lineChartView.leftAxis.valueFormatter?.alwaysShowsDecimalSeparator = false

        lineChartView.xAxis.avoidFirstLastClippingEnabled = true

        lineChartView.extraLeftOffset = 5
        lineChartView.extraRightOffset = 25
        lineChartView.infoTextColor = APP_COLOR_COMPUTED

        lineChartView.xAxis.wordWrapEnabled = true
        lineChartView.xAxis.labelHeight = 200
        lineChartView.animate(xAxisDuration: 1.0, yAxisDuration: 1.0, easingOption: .EaseInBounce)



    }

Here is the correct View
screen shot 2016-03-28 at 2 36 12 pm

I want to display

Today
12:00AM

Possible ? if yes please let me know,
Thanks
Regards

@liuxuan30
Copy link
Member

x axis support word wrapping but does not support two lines. you can customize yourself.

@hardikdevios
Copy link
Author

Any Good example ?

@hardikdevios
Copy link
Author

Found one mistake please update(Repeated data)

screen shot 2016-03-28 at 5 03 40 pm

@liuxuan30
Copy link
Member

there is no good example, but all you need is take a look at x axis renderer and understand how it works

@hardikdevios
Copy link
Author

Already did it thanks man :)

@liuxuan30
Copy link
Member

don't forget to override the width/height calcuation for the label requiredSize/rotatedSize and max size etc. since you are taking more space on x axis. You don't want any offset/size weird or text out of bound

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants