In Table charts and on x-axis labels, Chartio automatically formats dates into a more legible format when detected. Formatted date labels will be spaced evenly along the x-axis. In order for Chartio to recognize dates, they need to be formatted in a certain way in your query.
This formatting is automatically applied in Interactive Mode. In SQL Mode, please use the following input formats:
|Date Bucket||Input Format||Default Output Format1|
|Second||2014-01-01T12:01:01||Jan 01, 2014 12:01:01|
|Minute||2014-01-01T12:01||Jan 01, 2014 12:01|
|Hour||2014-01-01T12||Jan 01, 2014 12:00|
|Day||2014-01-01||Jan 01, 2014|
|Week||2014-W01||Dec 30 2013-Jan 5 2014|
- X-axis label format will vary based on the width of your chart and the number of data points. For example, in a line chart with dates bucketed by day, the labels may be grouped by month to save space.
For more information on SQL date formatting syntax, please see the documentation specific to your database type.
Custom date formats
For Table charts, the date format can be set in your Chart Settings, under the Columns tab.
Note: It is not currently possible to customize the auto-generated date formatting on the x-axis under Columns. For chart types other than Table charts, dates on the x-axis can be formatted under the Axis tab. From there, select either Default or ISO-8601 from the Label Format dropdown.
Date columns grouped by hour, minute, or seconds can be formatted in the following ways:
- Twelve hour clock (ex. Jan 1, 2015 06:10:45 PM)
Date columns grouped by day can be formatted in the following ways:
- Long (ex. 1 January 2015)
Date columns grouped by week can be formatted in the following ways:
- Long (start day - end day) (ex. Oct 22-28, 2018)
Month and Year Columns
Date columns grouped by month and year can be formatted in the following ways:
Date columns grouped by quarter will be formatted by default to the following format:
- YYYY QQ (ex. 2019 Q3)