Make aggregated values available for labels
See original GitHub issueUse case: We want to make a cluster map. We can use our clusterCount function for that, for example:
const viz = new carto.Viz(`
@c_count: clusterCount()
color: red
width: @c_count
resolution: 16
`);
It’s a common convention for cluster maps to be labeled with the number of features represented by the cluster marker:
However we can’t use the clusterCount in a label.
Right now VL requires us to use an original dataset attribute for labels instead, like in this example: https://carto.com/developers/carto-vl/examples/#example-point-labels
const viz = new carto.Viz(`
@c_count: clusterCount()
@v_features: viewportFeatures($poi_name)
color: red
width: @c_count
resolution: 16
`);
....
const features = viz.variables.v_features.value;
...
"label_field": `${f.properties['poi_name']}`,
Can we create a way to use aggregated values for labels, so something like this would work?
const viz = new carto.Viz(`
color: fuchsia
width: 6
strokeColor: white
strokeWidth: 2
filter: $major == "YES"
@cc: clusterCount()
@v_features: viewportFeatures($poi_name, @cc)
`);
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Aggregate values into related features—ArcGIS Pro
You can visualize features through aggregation by precomputing the values or by using query ... Run the Make Aggregation Query Layer geoprocessing tool....
Read more >Labels by datapoint and aggregation on label for single serie?
QUESTION : Is aggregation on labels possible? I have a form which accepts 20 -25 inputs , now i have to get time...
Read more >Data Aggregation in Tableau
When you add a measure to the view, Tableau automatically aggregates its values. Sum, average, and median are common aggregations; for a complete...
Read more >How to aggregate rows with inverse labels? - sql
LGA-LAX and LAX-LGA are both one-ways on a single route, and so I want to combine them into a single row with aggregated...
Read more >Aggregate data - IBM
Aggregate Data aggregates groups of cases into single cases and creates a new aggregated file, or creates new variables in the active dataset...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Merged in master ✨ We’ll have to document it properly and research how can we improve the labels visualization. Meanwhile, we’ve added a couple of examples 👍
Also, you can use Gencat data as I did in this example (not working because of the API Key)
https://bl.ocks.org/ramiroaznar/f856209982304290f1152828a7bf7f2b