@@ -16,7 +16,7 @@ The interval transform is often used for time-series bar charts. For example, co
16
16
month: 'short',
17
17
});
18
18
19
- const tickFormat = (date: Date) => DAY_MONTH.format(date).split(' ');
19
+ const tickFormat = (date: Date) => DAY_MONTH.format(date).split(' ').reverse() ;
20
20
21
21
import { page } from '$app/state';
22
22
let { aapl } = $derived(page.data.data);
@@ -37,9 +37,15 @@ In contrast, a [rectY](/marks/rect) mark with the interval option and the day in
37
37
38
38
import { page } from '$app/state';
39
39
let { aapl } = $derived(page.data.data);
40
+
41
+ const DAY_MONTH = new Intl.DateTimeFormat('en-US', {
42
+ day: 'numeric',
43
+ month: 'short',
44
+ });
45
+ const tickFormat = (date: Date) => DAY_MONTH.format(date).split(' ').reverse();
40
46
</script>
41
47
42
- <Plot marginLeft={40} x={{ type: 'time' }} grid>
48
+ <Plot marginLeft={40} x={{ tickFormat }} grid>
43
49
<RectY
44
50
data={aapl.slice(-40)}
45
51
x="Date"
@@ -51,7 +57,7 @@ In contrast, a [rectY](/marks/rect) mark with the interval option and the day in
51
57
```
52
58
53
59
``` svelte
54
- <Plot marginLeft={40} x={{ type: 'time' }} grid>
60
+ <Plot marginLeft={40} x={{ tickFormat }} grid>
55
61
<RectY
56
62
data={aapl.slice(-40)}
57
63
x="Date"
@@ -77,7 +83,7 @@ The meaning of the interval mark option depends on the associated mark, such as
77
83
month: 'short',
78
84
});
79
85
80
- const tickFormat = (date: Date) => DAY_MONTH.format(date).split(' ');
86
+ const tickFormat = (date: Date) => DAY_MONTH.format(date).split(' ').reverse() ;
81
87
</script>
82
88
83
89
<Plot marginLeft={40} x={{ tickFormat }} grid>
0 commit comments