简体   繁体   English

尝试在CartoDB中按列值设置颜色

[英]Trying to set color point by column value in CartoDB

This is my first time using CartoDB. 这是我第一次使用CartoDB。 My dataset is a simulation of the behaviour of users arround the campus. 我的数据集是对校园内用户行为的模拟。 My rows have latitude, longitude and the class column depending of the cluster in which the user is. 我的行具有纬度,经度和类列,具体取决于用户所在的群集。

I saw an option to visualize the animation of the behaviour (cartodb transforms the data into a time lapse), but I'm trying to see the points colored by the class value. 我看到了一个可视化行为动画的选项(cartodb将数据转换为时间间隔),但我试图看到由类值着色的点。 In the platform, there is an option to do that, but when I choose the "animation" mode then I can't choose any of the columns to set the color. 在平台中,有一个选项可以做到这一点,但是当我选择“动画”模式时,我无法选择任何列来设置颜色。

I show you an image: 我给你看一个图像:

在此输入图像描述

However, if I choose the "By points" mode, I can display the points color by the class column value. 但是,如果我选择“按点”模式,我可以按类列值显示点颜色。

Is there anyone who has had the same problem? 有没有人遇到过同样的问题? Do you have any recommendation? 你有什么建议吗?

I think the problem is on the column type, you need your column to be a string to be offered as a value, so maybe you want add a column to your SELECT statement on the DATA tab to reclassify your clusters. 我认为问题出在列类型上,您需要将列作为一个字符串作为值提供,因此可能需要在DATA选项卡上的SELECT语句中添加一列来重新分类集群。 If you rename then you can also show them on the legend can reflect a better name for your clusters: 如果您重命名,那么您也可以在图例上显示它们,以反映群集的更好名称:

select *,
       case cluster
         when 1 then 'Cluster 1'
         when 2 then 'Cluster 2'
         else 'unknown'
       end as cluster_named
from my_table

Something around that should help to convert cluster numeric field into a string one, then you'll see it offered to animate by that value. 周围的东西应该有助于将cluster数字字段转换为字符串1,然后你会看到它提供给该值的动画。

Disclaimer : I work at CARTO 免责声明 :我在CARTO工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQLAlchemy - 使用数据库列名而不是属性名在 model 中设置值 - SQLAlchemy - set value in model using database column name, not property name 成功的CartoDB Python API调用不会更新地图吗? - Successful CartoDB Python API call doesn't update map? 如何使用Mapping By Code在nhibernate 3.2中设置表列的默认值? - How to set default value for table column in nhibernate 3.2 using Mapping By Code? 弹出内容不会出现在 UI 中 - CartoDB Web Mapping Application - Popup content will not appear in the UI - CartoDB Web Mapping Application 将浮点值映射到JS中的十六进制范围? - Map floating point value to hexadecimal range in JS? 为什么(2,3)映射到点的y值,而不是分别将2和3映射到该点的x和y值? 普通Lisp - Why does the (2, 3) map to the y value of a point instead of mapping 2 and 3 respectively to x and y value of that point? Common Lisp 如何使用Openlayers设置新点的坐标? - How do I set the coordinates of a new point using Openlayers? 如果列的值等于某个值,则更改下一列的值(python) - If value of column is equal to a certain value then change the value of the next column (python) 尝试使用 integer 键从字典中获取值 - trying to get value from a dict with integer key MyBatis - 一对多 - 未为映射列设置的值 - MyBatis - One to many - values not set for mapped column
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM