@cfasim-ui/docs 0.4.11 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,6 +59,127 @@ charts, set `x` and `y` (or `data`) on each `Series`.
59
59
 
60
60
  When `x` is omitted, `y`/`data` values are plotted at indices 0, 1, 2, etc.
61
61
 
62
+ ### Dates
63
+
64
+ Pass ISO date strings (`YYYY-MM-DD`) or `Date` objects as `x` and the
65
+ chart auto-detects a date axis: ticks anchor to year / month / week /
66
+ day / hour boundaries depending on the visible range, and labels
67
+ format themselves accordingly. Numeric `x` arrays keep their existing
68
+ behavior — auto-detection is content-driven and never promotes plain
69
+ numbers.
70
+
71
+ <ComponentDemo>
72
+ <LineChart
73
+ :x="['2026-01-05', '2026-01-12', '2026-01-19', '2026-01-26', '2026-02-02', '2026-02-09', '2026-02-16', '2026-02-23', '2026-03-02', '2026-03-09']"
74
+ :y="[4, 9, 18, 32, 41, 38, 27, 18, 11, 6]"
75
+ :height="220"
76
+ y-label="% ED visits"
77
+ />
78
+
79
+ <template #code>
80
+
81
+ ```vue
82
+ <LineChart
83
+ :x="[
84
+ '2026-01-05',
85
+ '2026-01-12',
86
+ '2026-01-19',
87
+ '2026-01-26',
88
+ '2026-02-02',
89
+ '2026-02-09',
90
+ '2026-02-16',
91
+ '2026-02-23',
92
+ '2026-03-02',
93
+ '2026-03-09',
94
+ ]"
95
+ :y="[4, 9, 18, 32, 41, 38, 27, 18, 11, 6]"
96
+ :height="220"
97
+ y-label="% ED visits"
98
+ />
99
+ ```
100
+
101
+ </template>
102
+ </ComponentDemo>
103
+
104
+ Override the format via `x-tick-format`. Presets: `"iso"`,
105
+ `"iso-datetime"`, `"year"`, `"month-year"`, `"month-day"`, `"day"`,
106
+ `"time"`, `"datetime"`, `"medium"`. You can also pass an
107
+ `Intl.DateTimeFormatOptions` literal, or a function `(ms, unit?) =>
108
+ string` for full control.
109
+
110
+ <ComponentDemo>
111
+ <LineChart
112
+ :x="['2026-01-05', '2026-01-12', '2026-01-19', '2026-01-26', '2026-02-02']"
113
+ :y="[4, 9, 18, 32, 41]"
114
+ x-tick-format="iso"
115
+ :height="220"
116
+ y-label="% ED visits"
117
+ />
118
+
119
+ <template #code>
120
+
121
+ ```vue
122
+ <LineChart
123
+ :x="['2026-01-05', '2026-01-12', '2026-01-19', '2026-01-26', '2026-02-02']"
124
+ :y="[4, 9, 18, 32, 41]"
125
+ x-tick-format="iso"
126
+ :height="220"
127
+ y-label="% ED visits"
128
+ />
129
+ ```
130
+
131
+ </template>
132
+ </ComponentDemo>
133
+
134
+ By default the chart parses bare `YYYY-MM-DD` (and offset-less
135
+ `YYYY-MM-DDTHH:mm:ss`) as UTC and renders tick labels in UTC. Set
136
+ `timezone="local"` to interpret offset-less strings in the browser's
137
+ timezone instead. Strings that include an explicit offset (`Z` or
138
+ `+05:00`) are always parsed exactly as written.
139
+
140
+ > **Annotations on a date axis.** `ChartAnnotation.x` is always in the
141
+ > chart's resolved coordinate space — that's **epoch-ms** when the axis
142
+ > is in date mode. Pass `Date.UTC(2026, 0, 15)`, `new Date("2026-01-15").getTime()`,
143
+ > or `Date.parse("2026-01-15T00:00:00Z")`. Passing a small integer like
144
+ > `0` will place the annotation at 1970-01-01 (off-screen).
145
+ >
146
+ > **`xLabels` on a date axis.** When both `x: [...date strings]` and
147
+ > `xLabels` are supplied, the date axis wins — `xLabels` is ignored.
148
+ > Date strings carry their own labeling.
149
+
150
+ ### Title
151
+
152
+ The `title` prop accepts `\n` to break across lines. Use `titleStyle`
153
+ to override `fontSize`, `lineHeight`, `color`, `fontWeight`, and
154
+ `align` (`"left" | "center" | "right"`, default `"left"`). Top padding
155
+ grows automatically for additional lines.
156
+
157
+ <ComponentDemo>
158
+ <LineChart
159
+ :data="[0, 4, 8, 15, 22, 30, 28, 20, 12, 5, 2]"
160
+ :height="220"
161
+ :title="'Daily ED visits\nInfluenza-like illness, last 11 days'"
162
+ :title-style="{ fontSize: 16, lineHeight: 20, color: '#0057b7' }"
163
+ x-label="Days"
164
+ y-label="Cases"
165
+ />
166
+
167
+ <template #code>
168
+
169
+ ```vue
170
+ <LineChart
171
+ :data="[0, 4, 8, 15, 22, 30, 28, 20, 12, 5, 2]"
172
+ :height="220"
173
+ :title="'Daily ED visits\nInfluenza-like illness, last 11 days'"
174
+ :title-style="{ fontSize: 16, lineHeight: 20, color: '#0057b7' }"
175
+ x-label="Days"
176
+ y-label="Cases"
177
+ />
178
+ ```
179
+
180
+ </template>
181
+ </ComponentDemo>
182
+
62
183
  ### Multiple series
63
184
 
64
185
  <ComponentDemo>
@@ -558,8 +679,9 @@ Pin callouts to data points with `annotations`. Each annotation anchors at
558
679
  respects `xMin` and explicit `x` values), with a pixel
559
680
  `offset: { x, y }` for the label position. Text supports `\n` for line
560
681
  breaks. A curved
561
- pointer line connects the anchor to the label, and the label gets a halo
562
- stroke matching the background so it stays legible over series lines.
682
+ pointer line connects the anchor to the label, and the label gets an
683
+ outline stroke matching the background so it stays legible over series
684
+ lines.
563
685
 
564
686
  <ComponentDemo>
565
687
  <LineChart
@@ -644,9 +766,9 @@ interface ChartAnnotation {
644
766
  color?: string; // text / pointer color (default: currentColor)
645
767
  fontSize?: number; // default: 13 (matches axis labels)
646
768
  fontWeight?: string | number; // default: "normal"
647
- haloColor?: string; // background-matched halo (default: var(--color-bg-0, #fff))
648
- haloWidth?: number; // default: 3
649
- textAnchor?: "start" | "middle" | "end"; // default: derived from offset[0] sign
769
+ outlineColor?: string; // background-matched outline (default: var(--color-bg-0, #fff))
770
+ outlineWidth?: number; // default: 3
771
+ align?: "left" | "center" | "right"; // default: derived from offset[0] sign
650
772
  lineColor?: string; // connector-line color override (default: color)
651
773
  lineWidth?: number; // default: 1
652
774
  lineDash?: string | number | readonly number[]; // SVG stroke-dasharray
@@ -699,7 +821,7 @@ positioned from the anchor as usual via `offset`.
699
821
  y: 30,
700
822
  offset: { x: -8, y: -6 },
701
823
  text: 'Max',
702
- textAnchor: 'end',
824
+ align: 'right',
703
825
  pointer: 'ruleFromLeft',
704
826
  lineDash: '4 3',
705
827
  },
@@ -729,7 +851,7 @@ positioned from the anchor as usual via `offset`.
729
851
  y: 30,
730
852
  offset: { x: -8, y: -6 },
731
853
  text: 'Max',
732
- textAnchor: 'end',
854
+ align: 'right',
733
855
  pointer: 'ruleFromLeft',
734
856
  lineDash: '4 3',
735
857
  },
@@ -807,6 +929,10 @@ until the user clicks Download:
807
929
  | `width` | `number` | No | — |
808
930
  | `height` | `number` | No | — |
809
931
  | `title` | `string` | No | — |
932
+ | `titleStyle` | `TitleStyle` | No | — |
933
+ | `axisLabelStyle` | `LabelStyle` | No | — |
934
+ | `tickLabelStyle` | `LabelStyle` | No | — |
935
+ | `legendStyle` | `LabelStyle` | No | — |
810
936
  | `xLabel` | `string` | No | — |
811
937
  | `yLabel` | `string` | No | — |
812
938
  | `debounce` | `number` | No | — |
@@ -822,7 +948,7 @@ until the user clicks Download:
822
948
  | `chartPadding` | `ChartPadding` | No | — |
823
949
  | `y` | `LineChartData` | No | — |
824
950
  | `data` | `LineChartData` | No | — |
825
- | `x` | `LineChartData` | No | — |
951
+ | `x` | `LineChartXInput` | No | — |
826
952
  | `series` | `Series[]` | No | — |
827
953
  | `areas` | `Area[]` | No | — |
828
954
  | `areaSections` | `AreaSection[]` | No | — |
@@ -832,7 +958,10 @@ until the user clicks Download:
832
958
  | `xMin` | `number` | No | — |
833
959
  | `xTicks` | `number \| number[]` | No | — |
834
960
  | `yTicks` | `number \| number[]` | No | — |
835
- | `xTickFormat` | `NumberFormat \| ((value: number, index: number) =&gt; string)` | No | — |
961
+ | `xTickFormat` | `\| NumberFormat
962
+ \| ((value: number, index: number) =&gt; string)
963
+ \| DateFormat` | No | — |
964
+ | `timezone` | `DateTimezone` | No | — |
836
965
  | `yTickFormat` | `NumberFormat` | No | — |
837
966
  | `xLabels` | `string[]` | No | — |
838
967
  | `xGrid` | `boolean` | No | — |