Core-Plot DataLabel Z-Ordering - ios

I try to add data labels to a bar graph in Core-Plot (on iOS). The user selects individual plots and then the values are shown.
The main problem is shown in the image, the other plots overdraw the data labels.
Is it possible to have the labels always at the top?
As the user sets the ordering of the bars, I cannot reorder the bars. (Also if I did, the user experience would be terrible as the whole graph appearance would change on selection.)
Other possibility: Can I reorder the plots for Z-ordering but have the positions remain unchanged?
Any other ideas? I also tried CPTPlotSpaceAnnotations, but I cannot align them on the bar precise enough (see the "1037" label at the year (x-axis) 1980).

I came up with a solution by myself: I just remove the plot and add it back. In that way the plot is raised in the z-Hierarchy.
[self.graph removePlot:plot];
[self.graph addPlot:plot];

Related

How Do I Keep Bar Width the Same Across Multiple Charts?

Suppose I want to create two charts with horizontal bars. The names of the objects are listed on the y-axis and the horizontal bars represents some quantity. The first chart has 100 items and the second chart has 5 items.
When I create the charts the horizontal bars have different widths. I'd like the bars to be the same width across all of my charts.
I know I can try different values for the height parameter to the AddShape function. But that seems time-consuming and unreliable since the number of items can change. I'd like to do something like:
Chart.BarWidth = 10
The "thickness" of each bar will be primarily determined by the number of data points that need to be plotted. The more data points to plot, the thinner the bars will be. There are some options to further tweak them, such as IChartGroup.GapWidth, and you're welcome to try to adjust this so that both charts match. But I suspect that it will be very difficult to do this reliably, particularly if the number of plotted points is expected to change over time.
To maintain the same bar thickness for multiple charts, I think your best option will be to ensure both charts' series refer to the same size range. So if your first chart refers to 100 cells, have your second chart refer to 100 cells, even if only 5 are populated with values. The empty cells should not plot but will still take up space and therefore maintain consistent bar thicknesses between your two charts.

Coreplot: Axis Labels Fixed Location

I'm trying to customize a Coreplot graph in many ways I can and the next thing I would like to do is place the X Axis Labels (one that is custom as well) at the bottom of the graph, independent of the X axis' position (whether it's scrolled up or down).
To make it clear, it is similar to giving the labels an offset value of something like 50.0. But offset is not the property I'm looking for since it fixes the labels location relative to the X axis.
Any way this can be done? Or do I have to skip the axisLabels property and place and layer or something manually at the bottom of the graph?
EDIT: Alright, I managed to place an axis on the bottom with CPTConstraints. But it's not on the bottommost. If a plot point is on those levels, the plot line overlaps the labels. I tired padding of the graph but of course, it moves the whole graph, hence the issue persists.
Thanks in advance
Make a second x-axis. Have the first one draw the axis line, tick marks, etc., as normal but no labels. Label the second one and set all of the line style properties to nil so it doesn't draw any of the lines.
Turns out that aside from the graph, the plotAreaFrame property of the CPTGrpah also has paddings. If you give more paddings to plotAreaFrame than that of the graph, the plot will be drawn in a smaller frame and the rest of the graph area will be for you to add what you want (i.e., a second Axis).
Big thanks to #Eric, for trying to answer Every single CorePlot question as soon as possible.
CorePlot does have a lot of customisation than I thought.

Highcharts Show x-axis on top

Is it possible to show the x-axis and corresponding labels on top of the graph instead of the bottom?
Inverting or reversing the data is not what I am looking for design wise.
Yes. In your xAxis properties, set 'opposite:true'
http://api.highcharts.com/highcharts#xAxis.opposite

How to set the bar width to a fixed value in Shinobi Charts?

I am trying to get used to Shinobi charts developed for iOS. I've downloaded trial version on same and trying to plot some sample charts using it. The charts look pretty good in demo apps. But one thing I noticed that while using class SChartColumnSeries to plot bar chart, the width of the bars is adjusted according to the frame available to plot the chart. I want it to be fixed (say 20 pixels) regardless of number of bars present and if the width required is more than what is assigned (while assigning frame to the chart) then only some part of the chart will be visible and user can scroll the chart to view remaining bars (This is possible in Core Plot). How can I achieve this using Shinobi charts?
This is possible with Shinobi, but it's not a simple case of setting a fixed width property I'm afraid. I've just tried to do this though and its isn't too complicated!
My advice would be to set up the chart like this:
chart = [[ShinobiChart alloc] initWithFrame:self.view.bounds];
[chart setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
[chart setDatasource:d];
[chart setXAxis:[SChartNumberAxis new]];
[chart setYAxis:[SChartNumberAxis new]];
[[chart xAxis] setEnableGesturePanning:YES];
[[chart xAxis] setEnableGestureZooming:NO];
[chart.xAxis setDefaultRange:[[SChartNumberRange alloc] initWithMinimum:#5 andMaximum:#10]];
The most important part is the last 3 lines. By turning zooming off you allow your charts to have a fixed zoom level, meaning the bars stay the same width. You can turn the panning on to allow users to scroll to see different bars.
The last line sets the default range. Here, i've just set it to values between 5 and 10. That means that the chart displays values between 5 and 10 along the x-axis.
By doing the above, this means that your columns will have a fixed width! You might have to do some tweaking and / or calculation depending on how many data points you have, in order to find out what you have to set your default range to. If they are variable for example, you will need to take into account the number of data points, the padding between the columns and inter column padding and the number of pixels you have available).
I realise this is quite a simplified answer but it should give you a good starting point!

Shinobi Charts bar graph Customising

I'm using Shinobi Controls Charts to do this project and i'm having some trouble to find ou how to customise my chart to look as close as possible to this:
Here is what i have so far:
The labels at the bottom are the ones that are represented as [name] in the first chart.
The colores of the bars are ok i know how to change them. My problem resides on the labels on the top of each bar and the grid and background grid.
1) How can i remove the grid and change the graph color to transparant? chart.xAxis.style.gridStripeStyle.showGridStripes = NO; does not remove the grid.
2) The radial series had a callback where i could change the labels position, but after taking a look at all the documentation that comes with the demo i can't find anything to change the position of the axis's labels for a bar graph and add more complexity like an image and 2 or 3 labels to it. Also those boxes have to move along with bars.
Does anyone know how to do this 2 topics?
Thank you in advance for any given help.
EDIT :
I've been able to remove the axis with
axis.style.gridStripeStyle.showGridStripes = NO; // removes the main bar
axis.style.majorGridLineStyle.showMajorGridLines = NO; // removes the grid bars
Regarding your second point, use
- (void)sChart:(ShinobiChart *)chart alterTickMark:(SChartTickMark *)tickMark
beforeAddingToAxis:(SChartAxis *)axis
Regarding your first point use
chart.axis.style.majorGridLineStyle.showMajorGridLines = NO

Resources