crossfilter | animate through date range - date

I've built a d3 world (heat)map. Each country has a fill colour corresponding to a value.
I want to improve the map by using crossfilter to allow users to see historic as well as current data. So far so good. But as well as all the funky features of crossfilter, I want the user to be able to press 'play' and see how the shading of countries changes over time.
Has anyone done this or do you know of native support for this that i'm missing? I can't find anything on it via google.
thanks
Emma

I haven't done exactly this, but the basic idea would be that after the user presses "play", you would want to programmatically change the filter on your Crossfilter date dimension over time and re-render your charts after each change. You'll probably want to use requestAnimationFrame (https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) to do this.

Related

How to make google timeline chart with vertical orientation?

Google charts powerful and easy tool. I really like it. Unfortunately I didn't found the way to make it show timeline in vertical orientation. For example I need columns to represent weekdays and rows to represent time. May some one know if it is possible to do with google charts at all?
https://developers.google.com/chart/interactive/docs/gallery/timeline
I've tried to find for example option named "orientation":"vertical" but nothing like this.

Mapbox: show only one country on base map?

I'm using Mapbox GL JS. Is there any way I can style my base layer to look like the Mapbox Light example, but showing only the UK?
I assume I would use Mapbox Studio to build my own base layer, but I can't see any way in Studio to filter by country.
If that's not possible, is there any way I could show labels on the UK only, and show other countries as filled polygons? (As per this unanswered question.)
Unfortunately it is not possible to filter by a certain geography when selecting the data source for a layer. If you're working with Mapbox's tiles, they'll always cover the entire planet.
There is the possibility to restrict the map to a certain (rectangular) bounds, with the map.setMaxBounds method (https://www.mapbox.com/mapbox-gl-js/api/#Map#setMaxBounds). This might work reasonably well since you want to restrict the view to the UK, but might not be suitable depending on the geometry you want to restrict the view to.
As a workaround you could create a dataset and add a polygon that covers the entire planet except for the extent you want to show in your map. Then add this dataset in your style as the top most layer and style it with whatever you'd like the empty space in your map to look like.
The workaround has been also suggested in this SO answer, if you can get maptiles for the UK only (the SO answer gives a link, but for Germany) you can
upload them to Mapbox as a dataset, export it to tilesets, and then
to a map as a layer. Delete all other layers
You have also the possibility to Style a single country in Mapbox
studio ref this tutorial. The other countries are still shown, but you can style your map in a way to highlight UK
There is a option that allows you to show only one country highlighted. But drawback is, you lose all the layers and tile-level details. Here is the link https://www.mapbox.com/videos/how-to/map-a-single-country-in-mapbox-studio/.
But if you want to include the tile details as well as whole world map but in that map only one or two or custom amount of countries highlighted, then, from above link of Natural Earth download the zipped file of ne_10m_admin_0_countries and upload.
Go back to your map style, and instead of making a blank one. Add another layer of ne_10m_admin_0_countries in your current map. Select the country in the filter option (in same way as shown in video). And change its opacity. That's it.
Hope it helps. Have a great day.

How to achieve density/heat map effect in iOS (iPhone/iPad)?

http://www.econguru.com/heat-map-of-worldwide-gdp-ppp-per-capita-2008/
This is CIA world Factbook map, each country has different color depth based on their GDP number. High GDP country has deeper color.
Right now, I am considering to develop such effect into my iPhone/iPad map app. I may want to use the apple map (probably not google map since iOS 6 has its own map), but I am not sure how to get such effect based on the country the user visited.
For example, the user visited US the most, then the map shows deeper color in US.
I haven't seen such effect in iPhone app yet. Any suggestion would be appreciated!
This should be doable using MapKit and overlays. You would need to construct an overlay for each area of the heat map and then set the color according to the data. I suspect the hardest part is going to be getting the geographic data you need to construct the paths for each region. AFAICT, there's no -pathForState: or -pathForCountry: type of functions in MapKit, so you're going to need to find another source for that information. But in terms of drawing overlays, it's all there in MapKit. Check out this sample code.
EDIT:
This question has some pointers on where to get that data.
You can get the coordinates ready to go in json format from the D3 project on github:
https://github.com/latentflip/d3/blob/master/data/world-countries.json
You can download this json, use NSJsonSerialization with the file to load the json into a Dictionary or an array, and then build your overlays from there.
One other thing: you aren't technically after a heat map; what you're afer is more of a "thematic" map.
Try the LFHeatMap class. Seems to be what you're looking for.
https://github.com/gpolak/LFHeatMap

With the new maps in iOS6, is it possible to change colors of layers (parks, water, building)

I understand it's not ideal to change mapkit colors but specifically for a location based game I'm creating I'd like to have to colors much less dramatic and more dark. Is there a built in way that I can accomplish this? Since the game won't be specific to a certain region custom overlays wouldn't really work. I know with the old google maps the only way to do so was to create a javascript version of the map and add it in a webview (not ideal for the game) but with this new apple maps is there a way to redraw the shapes of these elements (parks, water, building) with a different color.
I don't have a complete understanding how the previous or current mapkits work from the ground up so if I'm missing any information or am confusing I apologize.
No there is no way you can do that in the current iOS6 maps.
The MapKit Reference does not have any inbuilt functions to do that.
I would seriously ask you to reconsider changing colors of the current MapKit even if you could do it through some other hack. You might get rejected from the App Store.
You have 2 options
a. Instead use your own maps from other vendors if you want to change colors and so for different places.
b. Overlays are a good way to go too but they are heavy work on REST side of downloading maps. I am currently using this in my map right now because all my map tiles are generated on the fly and I do not have to do too intensive work on the iPhone.

Is there a way to use GflAx to incorporate gradient colours?

Ok, narrow question of the day. I'm using GflAx (from xnview) to create some graphic tiles. I would like to put some gradients in as well though.
Is there a way I can do this within this product?
There is also an SDK which is part of this product but I can't find that info there.
You can not do this but you can create the gradient in another program and then do a "LoadBitmap" make the mods you need ontop of that 'background' and then save to a new file.