I'm trying to remove Antarctica from this Vega-lite world map. Example in vega-editor here. Wondering how I can get hold of specific data w.r.t country or continent
Use filter transnform:
{
"name": "world", // <---- Your map
"url": "https://vega.github.io/editor/data/world-110m.json",
"format": {
"type": "topojson",
"feature": "countries"
},
"transform": [
{
"type": "filter",
"expr":"datum.id!=10" //<---- Antarctica has id 10
}
]
},
See on your example
Related
I have the following scenario: I have an index with all possible ads of my platform. These ads contain an object with coordinates (latitude/longitude).
{
"id": "123",
"slug": "my-ad-slug",
"location": {
"coordinates": {
"latitude": 1.123456,
"longitude": 1.987654
}
}
I also have another index with some locations and their polygons and shapes for geolocation searches.
{
"id": "456",
"name": "my location",
"geo_location": {
"type": "Polygon",
"coordinates": [...]
}
}
My question is: how can I query all ads that are within a certain polygon, since I have two different indexes in this case? Do you see an easy way on doing so?
Thanks y'all!
I am quite new to graphQL, and after searching the whole afternoon, i didn't found my answer to a relative quite simple problem.
I have two objects in my strapi backend :
"travels": [
{
"id": "1",
"title": "Bolivia: La Paz y Salar de Uyuni",
"travel_types": [
{
"name": "Culturales"
},
{
"name": "Aventura"
},
{
"name": "Ecoturismo"
}
]
},
{
"id": "2",
"title": "Europa clásica 2020",
"travel_types": [
{
"name": "Clasicas"
},
{
"name": "Culturales"
}
]
}
]
I am trying to get a filter where I search for travels containing ALL the user-selected travel_types.
I then wrote a query like that :
query($where: JSON){
travels (where:$where) {
id # Or _id if you are using MongoDB
title
travel_types {name}
}
And the parameter i try to input for testing :
{
"where":{
"travel_types.name_contains": ["Aventura"],
"travel_types.name_contains": ["Clasicas"]
}
}
This should return an empty array, because none of the travels have both Aventura and Clasicas travel-types.
But instead it returns the travel with id=2. It seems that only the second filter is taken.
I searched for a query which would be like Array.every() in javascript, but i wasn't able to find.
Does someone has an idea how to achieve this type of filtering ?
Thank you very much,
How can I change the title of a loaded chart using javascript? The following doesn't work with external data
https://codepen.io/abdfahim/pen/zYOPvPx
var chart = am4core.createFromConfig({
"titles": [
{
"text": "ABCD",
"fontSize": 25,
"marginBottom": 10
}
],
"dataSource": {
"url": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-160/sample_data_serial.json"
},
"xAxes": [
{
"type": "CategoryAxis",
"dataFields": {
"category": "year"
}
}
],
"yAxes": [
{
"type": "ValueAxis"
}
],
"series": [
{
"type": "ColumnSeries",
"name": "Cars",
"dataFields": {
"categoryX": "year",
"valueY": "cars"
}
}
]
}, "chartdiv", am4charts.XYChart);
function changeTitle()
{
chart.titles[0].text = "New Title";
}
AmCharts v4 uses lists for the majority of its array-like objects, so using subscripts will not work. It's recommended to use the accessor methods provided by the list to get at the object you want to change, such as getIndex:
chart.titles.getIndex(0).title = "New title"
Updated codepen
Just in case some one will hit my same issue, I found this solution working for me
chart.titles.getIndex(0).text = "new title";
this is particularly handy if you are going to refresh the chart each x seconds
While amcharts shows the India map correctly (showing the disputed regions as part of India) when displaying only India (http://jsfiddle.net/zxhseguw/5/)
"dataProvider": {
"map": "indiaLow",
"areas": [ {
"id": "IN-KA",
"value": 4447100,
}, {
"id": "IN-UP",
"value": 38763
}]
},
it shades it differently when rendering it on world map (http://jsfiddle.net/zxhseguw/6/)
"dataProvider": {
"map": "worldLow",
"areas": [ {
"id": "IN",
"value": 4447100,
}, {
"id": "AU",
"value": 387633
}]
},
I wonder, if there is a way to make it render India correctly, just like its possible in Google Charts by setting origin='India'
I'm assuming you're referring to the region around Kashmir, correct? Try using worldIndiaLow instead of worldLow, which includes more of that disputed area as part of India.
"dataProvider": {
"map": "worldIndiaLow",
"areas": [ {
"id": "IN",
"value": 4447100,
}, {
"id": "AU",
"value": 387633
}]
},
Updated fiddle
I am learning and trying to understand how to optimizing my FireBase database for my use case.
Looking at the code below: Lets say that the US/STREET_ADDRESS get pushed 150 million entries(the number of street addresses in the US), and I want to sort on the "path": key, since its a unique identifier for all addresses. What would the performance be here when it comes to responce time? If this setup regarding my question is not advicable how can I change the US/STREET_ADDRESS?
Reading about fan-out but dont think i need that because of no multichat or other multi anything. In my case I simply want to create a databas that holdes the intere worlds all street addresses, for whatever reason :).
Should I denormalize the US/STREET_ADDRESS even more, like splitting the 10 million entries into US/A/STREET_ADDRESS, US/B/STREET_ADDRESS and US/C/STREET_ADDRESS. This can be done since the "path": "US/California/Orange County/3138 E Maple Ave" in the sample code below is unique, and could even be used as a Key instead of Firebase postsRef.push() auto key, that this code sample use. But still there will be 100 millions
{
"AE": {
"name": "United Arab Emirates"
},
"GB": {
"name": "United Kingdom"
},
"US": {
"name": "United States",
"STREET_ADDRESS": {
"-KUxrqYlItjme2v1I_W5": {
"id": "hjg86-tg33-8hu4-yh5u",
"path": "US/California/Orange County/3138 E Maple Ave"
},
"-KUJHjj7HG5gGHNNJ_T5": {
"id": "ds86-tg12-7eu4-juw3",
"path": "US/Florida/Tampa/104 Biscayne Ave"
}
}
},
"CH": {
"name": "Switzerland"
},
"SY": {
"name": "Syrian Arab Republic"
},
"TW": {
"name": "Taiwan"
},
"TJ": {
"name": "Tajikistan"
},
"TZ": {
"name": "Tanzania, United Republic of"
},
"TH": {
"name": "Thailand"
}
}