@cascivo/charts 0.3.14 → 0.4.1

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.
package/dist/index.d.ts CHANGED
@@ -227,6 +227,13 @@ interface BarChartSeries<Datum> {
227
227
  label: string;
228
228
  data: readonly Datum[];
229
229
  color?: string;
230
+ /**
231
+ * Per-series Y accessor. Overrides the chart-level `y` for this series only —
232
+ * use it to plot two series from one shared `data` row against different fields
233
+ * (e.g. `y: (d) => d.requests` on one series, `y: (d) => d.errors` on another).
234
+ * Defaults to the chart-level `y`.
235
+ */
236
+ y?: (d: Datum) => number;
230
237
  }
231
238
  interface BarChartProps<Datum = {
232
239
  x: string;
@@ -234,6 +241,11 @@ interface BarChartProps<Datum = {
234
241
  }> {
235
242
  series: readonly BarChartSeries<Datum>[];
236
243
  x: (d: Datum) => string;
244
+ /**
245
+ * Y-value accessor, applied to **every** series' data unless a series provides
246
+ * its own `y`. There is one category (x) domain per chart, so `x` is chart-level
247
+ * only; to plot multiple fields from one row, give each series its own `y`.
248
+ */
237
249
  y: (d: Datum) => number;
238
250
  title: string;
239
251
  description?: string;
@@ -1124,6 +1136,13 @@ interface LineChartSeries<Datum> {
1124
1136
  color?: string;
1125
1137
  /** Which y-axis this series is measured against. Default 'left'. */
1126
1138
  axis?: 'left' | 'right';
1139
+ /**
1140
+ * Per-series Y accessor. Overrides the chart-level `y` for this series only —
1141
+ * use it to plot two series from one shared `data` row against different fields
1142
+ * (e.g. `y: (d) => d.requests` on one series, `y: (d) => d.errors` on another).
1143
+ * Defaults to the chart-level `y`.
1144
+ */
1145
+ y?: (d: Datum) => number;
1127
1146
  }
1128
1147
  interface LineChartProps<Datum = {
1129
1148
  x: number;
@@ -1131,6 +1150,11 @@ interface LineChartProps<Datum = {
1131
1150
  }> {
1132
1151
  series: readonly LineChartSeries<Datum>[];
1133
1152
  x: (d: Datum) => number | Date;
1153
+ /**
1154
+ * Y-value accessor, applied to **every** series' data unless a series provides
1155
+ * its own `y`. There is one x-domain per chart, so `x` is chart-level only; to
1156
+ * plot multiple fields from one row, give each series its own `y`.
1157
+ */
1134
1158
  y: (d: Datum) => number;
1135
1159
  title: string;
1136
1160
  description?: string;
@@ -1235,6 +1259,13 @@ interface AreaChartSeries<Datum> {
1235
1259
  color?: string;
1236
1260
  /** Which y-axis this series is measured against (ignored when `stacked`). Default 'left'. */
1237
1261
  axis?: 'left' | 'right';
1262
+ /**
1263
+ * Per-series Y accessor. Overrides the chart-level `y` for this series only —
1264
+ * use it to plot two series from one shared `data` row against different fields
1265
+ * (e.g. `y: (d) => d.requests` on one series, `y: (d) => d.errors` on another).
1266
+ * Defaults to the chart-level `y`.
1267
+ */
1268
+ y?: (d: Datum) => number;
1238
1269
  }
1239
1270
  interface AreaChartProps<Datum = {
1240
1271
  x: number;
@@ -1242,6 +1273,11 @@ interface AreaChartProps<Datum = {
1242
1273
  }> {
1243
1274
  series: readonly AreaChartSeries<Datum>[];
1244
1275
  x: (d: Datum) => number;
1276
+ /**
1277
+ * Y-value accessor, applied to **every** series' data unless a series provides
1278
+ * its own `y`. There is one x-domain per chart, so `x` is chart-level only; to
1279
+ * plot multiple fields from one row, give each series its own `y`.
1280
+ */
1245
1281
  y: (d: Datum) => number;
1246
1282
  title: string;
1247
1283
  description?: string;