Is it possible to add space between legends in ios charts? - ios

So I want to add space between the legend of a multiple line chart. There is only the option to adjust center | left | right
What it looks like now - The labels are aligned according to the "label size":
What I want to look like - It should be 3 colums of 2 labels each Or maybe, add some space or set a minimum size for each legend:
This is the part of the code that enables the legend.
lineChartView.legend.enabled = true
lineChartView.legend.horizontalAlignment = .center
I've tried chartView.legend.stackSpace | chartView.legend.xEntrySpace | chartView.legend.yEntrySpace but nothing seems to change.
Anyone can help ?

There is a property of Chart "extraBottomOffset" and its datatype is CGFloat, try to give some value and see the change

PLease use legend.yEntrySpace = "value" for legend.orientation = .vertical.

Related

How do I change the color of the separator between two slices of a pie chart in charts for iOS?

I am using the Charts pod for iOS (github here: https://github.com/danielgindi/Charts ) to make a pie chart.
There is a 1 pixel line in between each slice of the chart. I would like to change the color of this line and/or make it thicker. However, I have not been able to find a way to do either of these things. How do I do this?
Here is what I tried unsuccessfully based on what I found in the PieChartView docs:
chart.tintColor = .blue
chart.maxAngle = 5
Its slice spacing between each slice of Pie Chart. If you want to change or increase that space then you can set space using yourPieChartDataSet.sliceSpace = 5.
i think ther are no seprators you can change the background color of your view and set the corner radius to height / 2

Show left axis label width fixed or mulitline in Charts library?

I am using charts(https://github.com/danielgindi/Charts) library for design charts in my application.
I am facing issue with display label width, I am trying to set fixed width label so that I can display the chart in max space. but now title text taking too much space of the screen.
how can we avoid this problem?
here is the screenshot for reference.
Try set multiline mode for label:
label.numberOfLines = 2
label.text = "Regional Safety\nWalks"

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

setting yAxis in iOS-charts swift iOS 8

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

Teechart Extra Legend Tool

I Want to Show Mean, Median and Standard Deviation in chart area in case of Box Plot.Since Custom Legend tool is not avaiable taught of using Extra Legend tool.
The problem is that I am not able to Position the extra legend in blank space after my bottom Axis.Can anyone help me in this.
I think your problem is produced because you need repaint the Chart, before try to calculate the custom position the ExtraLegend Tool. You can do something similar as I do in next simple code, where I have drawn a ExtraLegend Tool align to original Legend:
Private Sub Form_Load()
TChart1.AddSeries scBox
TChart1.AddSeries scBox
TChart1.Series(0).FillSampleValues 5
TChart1.Series(1).FillSampleValues 5
TChart1.Legend.LegendStyle = lsValues
TChart1.Series(0).asBoxPlot.Box.Brush.Color = vbRed
TChart1.Series(1).asBoxPlot.Box.Brush.Color = vbBlue
TChart1.Tools.Add tcExtraLegend
TChart1.Tools.Items(0).asExtraLegend.Series = TChart1.Series(1)
'Use internal Repaint to calculate the position of Legend.
TChart1.Environment.InternalRepaint
With TChart1.Tools.Items(0).asExtraLegend.Legend
.CustomPosition = True
.Left = TChart1.Legend.Left
.Top = TChart1.Legend.ShapeBounds.Bottom + 10
End With
End Sub
Could you tell us if my suggestion code help you to solve your problem?
I hope will helps.
Thanks,

Resources