0

I am using the Carto builder animated time-series widget based on a number column that contains a year as a four digit integer. In the widget's horizontal axis, the buckets are not labeled with integer values but with decimal values (e.g. 1.8k instead of 1800). People using the map are confused by this.

How can I configure the time-series to use four digit integers for the labels in the timeline?

ts widget

2
  • Are you using a histogram widget or a timeseries widget? Could you share a screenshot of the map or widget? Mar 8, 2021 at 10:22
  • I am using a time-series widget (image added to original post).
    – user101840
    Mar 8, 2021 at 12:30

1 Answer 1

0

As far as I understand, the field you are using is stored as an integer. Try to convert it or cast it as date/timestamp. Something like this should work:

SELECT
  *,
  to_date(time_date_t::varchar, 'yyyy') as date
FROM
  table_name

SELECT 
  *,
  TO_TIMESTAMP(
    time_date_t || '-01-01 00:00:00',
    'YYYY-MM-DD HH:MI:SS'
  ) as date
FROM
  table_name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.