Non-scaling / absolute gradient for scatter plots in CorePlot? - ios

I've added a gradient to my scatter plot in the usual manner:
CPTFill areaGradientFill = [CPTFill fillWithGradient:areaGradient1];
boundLinePlot.areaFill = areaGradientFill;
boundLinePlot.areaBaseValue = 0;
Setting the minimum for the gradient is easy to do with the areaBaseValue property. However, the gradient will always stretch such that the entire range of color defined by areaGradient1 appears below the line plot.
What I'd like to do is set an absolute y-axis range (e.g., 0 to 100) and have the gradient always be set to that range. So if my line is at y=50, only the bottom 50% of the gradient would be rendered below the line. I thought setting boundLinePlot.areaBaseValue2 = 100; would do this, but it doesn't have any effect.
Does CorePlot support this? If not, what's the 'right' way to go about implementing it?
(This is my first question so apologies if I'm not clear. Be gentle. :) )

While there's no direct way to make this happen you could use a trick. Make your horizontal global range wider than what you would show normally and do not make the graph horizontally scrollable. Add a value to the graph in the hidden area that is always your maximum value. This will be filled with the full gradient. Other parts however will only get a partial gradient, depending on their height.
I found this trick by accident while looking at one of my graphs. Look:
The overview at the top shows where the big graph is currently (the green limit band). Now compare this with another part:
You can clearly see that the tip of the large value has a different gradient value as the tip of the smaller one.

You can use a "background limit band" to draw a fill at a certain size behind the plots, but that won't be clipped to the plot line.

Related

I want to add border radius in stack graph in high charts for some particular data

enter image description here See in the example, when I don't have blue data then border-radius should come on black part in the last case. How I can achieve that??
Add border radius on black part if blue is hidden
The problem here is that setting a borderRadius for a single point is not possible according to Highchart's API. You can only set a borderRadius for the whole series. Splitting your points into several series would work, but I'm not sure if the whole demo still makes sense.
API reference: https://api.highcharts.com/highcharts/series.bar.borderRadius

How to prevent values of x axis points from overlapping each other when Graph has more than one series.?

Couldn't show the value of point on the red line which is covered black circle.
Probably, near points are squishing each other. Is there a solution for fixing this ? Showing it in tooltip not a solution for my task.

Core Plot horizontal bar chart on negative y-axis

I have a requirement to draw Core Plot horizontal bar chart with everything on the negative y-axis. I.e. the first index should appear at -1, like below:
I have figured out how to draw horizontal Bar Chart. But figuring out how to draw them in an "inverted" manner (to let user scroll downward with the tallest bar on top). My thought:
1) Convert the Y-index to negative
2) offset the Y-axis to the top of the graph instead of bottom
Is there any better way to do it?
I have found a historical article that's similar to my request (core-plot iOS reversed Y axis).
I have got what I needed after using this:
CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-yMax-1) length:CPTDecimalFromFloat(yMax)
P.S. you need to add the -1 to the Location parameter (-yMax-1) otherwise the horizontal bar at index 0 will not be shown clearly.

How to draw an effect (Gloss with metallic lustre) on concentric circle such as following?

I referred to following article. What I actually need to draw is concentric/ Concrete circles with an effect as shown in image below.
I am finding it difficult to a) Draw the white streaks radially b) Find some key terms to search for related articles to proceed further on this.
Any hint or link to read about this will be of great help.
Try these
Metallic Knob
Metallic Knob 2
http://maniacdev.com/2012/06/ios-source-code-example-making-reflective-metallic-buttons-like-the-music-app
This is a tutorial on making reflective metal buttons. You can apply the techniques from the source code to whatever object you're trying to make. The source code is found here on github. I just googled "ios objective c metal effect" because that's what you're trying to do, right? The metal effect appears in concentric circles and changes as you tilt your phone, just as the iOS6 music slider does.
I don't have any code for you but the idea is actually quite simple. You're drawing a number of lines radiating from a single, central point (say 50,50) to four different sets of points. First set is for x = 0 to 100, y = 0. Second set is for y = 0 to 100, x = 0. Third set is for x = 0 to 100, y = 100. Fourth set is for y = 0 to 100, x = 100. And for each step you need to either change the colour from white to black or white to grey in increments or use a look up table with your colour values in it.

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.

Resources