highcharts / highcharts-ios

iOS wrapper for Highcharts.
Other
125 stars 39 forks source link

How to Display next line in X-Axis? #205

Closed barotbhavesh closed 5 years ago

barotbhavesh commented 5 years ago

Screenshot 2019-07-02 at 4 15 45 PM chart.events = HIEvents() chart.events.load = HIFunction(jsFunction: "function () { this.xAxis[0].update({ labels: { autoRotation: false } }); }")

this solution is only a few lines breaks to the next line, not all lines.

ihnatmoisieiev commented 5 years ago

@barotbhavesh see https://github.com/highcharts/highcharts-ios/issues/204#issuecomment-506638481

barotbhavesh commented 5 years ago

Firstly Thanks for your time, but not all X-Axis title going to the next line only Some X-Axis display in the next line. please see in the screenshot.

ihnatmoisieiev commented 5 years ago

@barotbhavesh did you try the first option from https://github.com/highcharts/highcharts-ios/issues/204#issuecomment-506638481 ?

barotbhavesh commented 5 years ago

yes, I tried and also add a screenshot in upper you can see only some text is going to down.

ihnatmoisieiev commented 5 years ago

@barotbhavesh send me please your chart options.

You can't use both options at the same time.

The first option works excellent for me.

barotbhavesh commented 5 years ago

This is my Chart options

    let options = HIOptions()
    options.colors = COMMON_SHARED.aryStaticColorForChart
    options.chart = chart
    options.title = title
    options.xAxis = [xaxis]
    options.yAxis = [yaxis]
    options.series = aryHIColumn
    options.exporting = exporting
    options.tooltip  = tooltip
    options.plotOptions = plotoptions
    viewFirstCharts.options = options

This My Response:- response is Dynamic

{"ErrorData":null,"ResponseStatus":true,"ResponseData":[{"POSSub":[{"SubData":[{"Field2":"30","Field5":null,"Field3":"true","Field4":null,"Field1":"Drop-In  "},{"Field2":"248","Field5":null,"Field3":"true","Field4":null,"Field1":"Hybrid Memberships  "},{"Field2":"1127","Field5":null,"Field3":"true","Field4":null,"Field1":"Legacy  "},{"Field2":"11","Field5":null,"Field3":"true","Field4":null,"Field1":"Nutrition Challenge  "},{"Field2":"27","Field5":null,"Field3":"true","Field4":null,"Field1":"Other"},{"Field2":"131","Field5":null,"Field3":"true","Field4":null,"Field1":"Private Training  "},{"Field2":"0","Field5":null,"Field3":"false","Field4":null,"Field1":"Class Plan"},{"Field2":"0","Field5":null,"Field3":"false","Field4":null,"Field1":"Class Session"}],"SubParent":""}],"Parent":"Diamond Bar Crossfit "},{"POSSub":[{"SubData":[{"Field2":"0","Field5":null,"Field3":"false","Field4":null,"Field1":"Drop-In  "},{"Field2":"0","Field5":null,"Field3":"false","Field4":null,"Field1":"Hybrid Memberships  "},{"Field2":"0","Field5":null,"Field3":"false","Field4":null,"Field1":"Legacy  "},{"Field2":"0","Field5":null,"Field3":"false","Field4":null,"Field1":"Nutrition Challenge  "},{"Field2":"18","Field5":null,"Field3":"true","Field4":null,"Field1":"Other"},{"Field2":"0","Field5":null,"Field3":"false","Field4":null,"Field1":"Private Training  "},{"Field2":"125","Field5":null,"Field3":"true","Field4":null,"Field1":"Class Plan"},{"Field2":"25","Field5":null,"Field3":"true","Field4":null,"Field1":"Class Session"}],"SubParent":""}],"Parent":"Dynamis Athletics LLC"}]}

ihnatmoisieiev commented 5 years ago

@barotbhavesh try to use staggerLines e.g.

xAxis.labels = HILabels()
xAxis.labels.staggerLines = 2

Of course, you can change the value of staggerLines.

barotbhavesh commented 5 years ago

it's working but the Looks very bad.

Screenshot 2019-07-08 at 3 32 13 PM

ihnatmoisieiev commented 5 years ago

@barotbhavesh you can also try:

chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function () { this.xAxis[0].update({ labels: { autoRotation: false, useHTML: true, style: { 'textOverflow': 'none', 'word-break': 'break-all' } } }); }")
barotbhavesh commented 5 years ago

It is working for me thank you again @ihnatmoisieiev