I am formatting a chart with share price values on the y-axis and date values (by day) on the x-axis. I am trying to control the x-axis labels for the chart. The chart is currently displaying the x axis in mmm yyyy format (ie Jan 2021, Jul 2021) by default. I would like to control the labeling using a field I built instead. This field displays the periods in quarters (ie Q1 '21, Q2 '21). The x-axis date values (by day) still need to be used to control their position since I have data for every day throughout this period, but the labeling should be controlled by the “quarter” field.
Similar to this question, can you convert (or Format) X-axis to a custom Text Field if axis Type was “quantitative” for graphic purposes? For example; I used “quarter” number 1-4 in a graphic to get in right order visually, but would like to replace with “1Q 2023”, “2Q 2023”…and so forth for the visual for the users.
Hi @luz58. In Deneb, you can add an axis block to the x-encoding desired axis block complete with an expression to create the axis label you want. Here’s an example of creating your desired format:
Due to inactivity, a response on this post has been tagged as “Solution”.
If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box.