How to disable bounding box padding in NMAMapView (HEREMaps)? - ios

I'm trying to pass the bounding box of one NMAMapView to another NMAMapView but the result is not the same. For testing purpose I've tried:
mapView.set(boundingBox: mapView.boundingBox!, animation: .none)
After this call the map always zooms a little bit out.
Other SDKs have an edgePadding which could be set to zero. Is this also possible in here-maps for iOS?

Instead of passing view state via NMAGeoBoundingBox you can try using passing geoCenter and zoomLevel via setGeoCenter:zoomLevel: and see if this works better for your use case. Alternatively, you could heuristicly reduce the zoomLevel after calling setBoundingBox. There is no edge padding concept.

Related

How to make a vertical range plot filled with color using CorePlot in iOS?

I need to show a graph in my iOS app something like
We have been using CorePlot for all the graphs and now I need to add a new kind as shown above. I found I could draw a graph like the above with CPTRangePlot. My problem is I can only draw a horizontal graph as shown below.
Is there any way to make it vertical? For a single curve we can easily do that by switching the value on X-axis and Y-axis. But for this kind of "range plot", I could not find a way to make it work for drawing the upper-bound and lower-bound lines and filling range with color can only be achieved on a normal horizontal graph. And yes, I can easily rotate the container view by 90 degrees, as I did in my testbed app. But I just cannot do this in our current app because this new added "range plot" graph is not the only one on the view. We have many other curves sharing the same plot space. So is there any hidden property or method to achieve the job? Thanks in advance!
I just added a fillDirection property to the range plot to enable this feature. You'll need to use the latest code from the release-2.3 branch.

Changing UILabel position to strokeEnd of CGPath

I'm trying to achieve something similar to the attached image, where the circle is animated depending on your level progress and then a label is attached to both the end of the animated path to show the gained experience and also the undrawn part of the circle to show the remaining experience. I have the circle animating as wanted but am having trouble coming up with a solution to the labels to appear in the right spot.
I've tried setting the position of the label to the path.currentPoint but that always seems to be the start of the drawn path and not the end.
Any pointers on how to achieve this would be great!
I had been working on your question, first of all to achieve this you must animate the path the real path, not only the strokeEnd, if you animate only the strokeEnd your path.currentPoint will always return the circle endPoint of the path, in order to animate the path you need to make a KeyFramed Animation animating the “path” as keyPath and passing an array of paths from current angle to desired one, then in order to set the correct position for your label you need to get de currentPoint of all this paths values and making another keyFramed animation with “position” keyPath and passing as values all this points collected from paths array
This is a basic example working
The code is in GitHub in this Repo
You have a lot of work to do yet but, this can be an starting point for your final solution
Hope this helps, best regards

Coreplot - selecting area below line

I am using coreplot to draw a scatter plot like that:
I use 4 different plots (as coloured) and create a "bar like" feeling by adding 0-value points at the beginning/end of each "bar".
I want to determine which bar was selected by the user and then change alphas of other plots.
I've tried using
-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)point {
//here I translate the selected point to Data points coordinates
//and check which of the plot sources has value >0 (that means bar is visible)
//and is closest to the selected point
}
This method works, but when I want to scroll the data, the method above is called as well.
There must be some easier solution to do that. Thanks.
Return YES from your delegate method to inform the plot space that you've taken action on the event and it does not need to start the scroll. You may need to handle the other events, too, so your app can differentiate between a tap and a drag.

ios-charts - Changing Y axis value by a drag and drop

I am using ios-charts library to draw charts on a swift2 app. I am wondering if, for a given X value, I can change its Y associated value by a drag and drop gesture on the chart.
If this is not possible on this library, is it possible to do such a thing using another library?
technically you can. Every time you scroll/zoom the chart, it will trigger a redraw, so everything is redrawing, you can decide your own logic how you want the y axis value changed.
It has two parts:
In computeAxisValues in y axis renderer, the y axis labels(values) are determined. Then in renderAxisLabels, it is drawn using the calculated values.
So you can take a look at these functions and implement your logic. Note, it's your responsibility to make sure what you are doing is valid in your scenario, because if something weird happens, you may not get support on github, because it's not a bug, and sometimes not easy to answer.

In gmaps4rails, how do I move the map so the marker is in view?

I have a set of locations that I want to bring up, individually through ajax calls, and some of them aren't within the current bounds of the map. Is there a way to move the map so the marker is in view?
I don't need it to be in the center, just as long as it's in view.
I figured it out after some research. I'd still be curious to know how to NOT have to center if the marker is visible on the map.
var centerpoint = new google.maps.LatLng(lat_value, long_value);
Gmaps4Rails.map.setCenter(centerpoint)
edit: Found answer to how to not center map every time.
Pseudo code version.
1. Get values from Gmaps4Rails.map.getBounds().
2. Use resulting ta and la values to see if the marker is within those values.
3. If marker is outside of those values, center map, otherwise place marker without centering map.
Thanks guys. I should post more questions. It really helps me to think through my problems.
Jim's answer was probably right when he posted it. But as of now the right way to do it would be :
var centerpoint = new google.maps.LatLng(lat_value, long_value);
Gmaps.map.map.setCenter(centerpoint);
What you expect is automatically done as long as you pass the auto_adjust setting to true. See here.
Then, you should just use the js function Gmaps4Rails.add_markers described here.

Resources