setting yAxis in iOS-charts swift iOS 8 - ios

I'm learning ios-charts and I was wondering how to manipulare the yAxis since there is no method related to that. On the contrary xAxis can be customized.
A small example, by default I have two set of labels for the yAxis as the figure shows.
I managed to move the xAxis labels using
lineChartView.xAxis.labelPosition = .Bottom
but there is no such thing for the yAxis.
Is it possible to leave just the labels on the left clearing the labels on the right?

use rightAxis.drawLabelsEnabled = false or even rightAxis.enabled = false.
The xAxis is rendered by xIndex, which means the distance between each data point on xAxis is equal. But yAxis is rendered by the data value and the yaxis range.
So be careful, when you are setting the dataSet, you got a chance to set the axis dependency, like dataSet.axisDependency = axisDependencyRight. Then it will use rightAxis to render your line chart, not left axis. By default, it is axisDependencyLeft
You can choose which yAxis you would like to have, and just disable the other one. rightAxis.drawLabelsEnabled = false just don't render the label, but still calculated and rendererd. Watch out for this.

I think that the only way to do it is the following
let yaxis = lineChartView.getAxis(ChartYAxis.AxisDependency.Right)
yaxis.drawLabelsEnabled = false

Related

X-axis action strange - Charts iOS

I'm using the Charts library on iOS, but I'm having troubles with one of my charts in my TableView. The X-axis looks strange, and I loose resolution in my data. Here is how it currently looks:
My data is typically between 900 and 1100.
I configured the chart like this:
let dataSet = LineChartDataSet(values: entries, label: "")
dataSet.drawCirclesEnabled = false
dataSet.lineWidth = 2
dataSet.mode = .horizontalBezier
dataSet.colors = UIColor.gray
dataSet.drawValuesEnabled = false
let lineChartData = LineChartData(dataSets: [dataSet])
self.chartEntries.append(lineChartData)
Any ideas on why my X-axis looks like this? My others charts look fine and dandy.
The chart looks fine, since it's trying to squeeze your data that's around value 1000 into a very small space. If you have a look at the MPAndroidChart lib wiki, you can see that you can adjust the min and max range per axis, so you can effectively zoom in closer to your values to better see the distribution:
setAxisMaximum(float max): Set a custom maximum value for this axis.
If set, this value will not be calculated automatically depending on
the provided data.
setAxisMinimum(float min): Set a custom minimum value for this axis.
If set, this value will not be calculated automatically depending on
the provided data.
It would look something like:
graph.yAxis.axisMinimum = 900
graph.yAxis.axisMaximum = 1100

iOS Charts library and LineChart xAxis

I'm trying to create a LineChartView with values representing expenses for the current quarter. I need to print months and days with a custom number of labels for the xAxis. Unfortunately the LineChart is generating a set of entries that doesn't suit my needs and I cannot change them. I need the grid lines at my custom positions that are the first day of the month and a set of days for the month and I want them at specific positions not where the LineChart wants. I've checked the code and seen that the entry values for the xAxis are calculate in XAxisRenderer.computeAxisValues and it looks like I have no way to specify their number and positions. The number of labels that I set it is not taken into account ... and I do not have time to customise it.
There are 2 ways might achieve what you needed:
Set the number of labels for x-axis, for example,
let xAxis = chartView.xAxis
xAxis.labelCount = 7
//xAxis.drawLabelsEnabled = true
Through this, exactly 7 grid lines as will be drawn, if you set
drawLabelsEnabled as false, the min and max lines will be added in
additional to those 7
Use limit lines
You can disable the drawing of grid lines, and use limit lines
instead. In this way, you can draw line for whatever values you
need, for example,
let limitLine = ChartLimitLine(limit: xValue, label:
labelForThisLine)
limitLine.lineWidth = 0.5
limitLine.lineColor = .black
limitLine.valueTextColor = .black
chartView.xAxis.addLimitLine(limitLine)

xAxis values on both sides of Line Charts

I am using the iOS Charts library in my application. Charts are plotted correctly but the X axis values are shown on both sides in Line Charts. Is there any way to hide it or remove it ?
You can use lineChartView.rightAxis.enabled = false to hide rightAxis or replace with leftAxis

iOS-charts radar chart removing labels and filling the web with color

Probably a very basic question.
I am using iOS-charts and am working with a radar chart.
I am struggling to figure out how to remove the labels from the graph and I am really struggling to FILL the web. I can change the outer lines but I want to fill the web/data in a specific colour.
any help would be much appreciated.
Kind regards
Wayne
So, there are two types of labels on a radar chart, the axis label that shows you the list of possible values on the chart from min to max and the labels that correspond to each point on your graph.
REMOVING AXIS LABELS
Grab either the x or y axis on your radar chart view and set drawLabelsEnabled to false depending on the axis of the labels that you wish to hide
let yAxis = radarChartView.yAxis
let xAxis = radarChartView.xAxis
yAxis.drawLabelsEnabled = false
xAxis.drawLabelsEnabled = false
REMOVING LABELS FOR VALUE OF EACH POINT
Go to the location that you create your RadarChartDataSet
Before using it to create your RadarChartData, set the drawValuesEnabled property to false
let radarChartDataSet = RadarChartDataSet(yVals: dataEntries, label: "label")
radarChartDataSet.drawValuesEnabled = false
Also, here's a link to the Charts documentation page which can also be helpful (although it is not fully filled-in): http://cocoadocs.org/docsets/Charts/2.0.9/index.html

Axis Lables Rotation

Hi I am using HighStock 1.2.4
I do have multiple series and separate yAxis for each series. I am calculating height and topPadding and creating stacked series.
Now, I am facing two problems.
I have used rotation with yAxis to rotate labels but its not rendering correctly.
Example: http://jsfiddle.net/mhardik/uZaWz/9/
I have also used rotation for X Axis labels, but the last series position is getting messed with X Axis Labels.
http://jsfiddle.net/mhardik/uZaWz/10/
1) I'm not sure why it's not rendering correctly, if you want to move a little to the left use x: property for title.
2) First, I think you need to set proper align for xAxis.labels (right). Then make higher chart to make sure you have enough space for a chart.
And jsFiddle: http://jsfiddle.net/Fusher/uZaWz/12/

Resources