@pushwoosh/kit-charts 0.0.9 → 0.0.10
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/ai-documentation.md
CHANGED
|
@@ -356,9 +356,11 @@ and pass numbers through the chart's `numberFormat`.
|
|
|
356
356
|
Inline markup in a template is rendered rather than stripped, so the default
|
|
357
357
|
Highcharts `pointFormat` arrives looking like itself. The whitelist is `<br>`,
|
|
358
358
|
`<b>`/`<strong>`, `<i>`/`<em>` and `<span>` carrying a `style` of `color`,
|
|
359
|
-
`font-size`, `font-weight` or `font-style
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
`font-size`, `font-weight` or `font-style`. Anything else loses its tag and keeps
|
|
360
|
+
its text, so `<script>bad()</script>` prints a visible `bad()` — nothing runs, but
|
|
361
|
+
nothing disappears either. Nothing is parsed as HTML: the tags become React elements
|
|
362
|
+
and a filled token is always a text child, so a series name out of the API cannot
|
|
363
|
+
carry markup in.
|
|
362
364
|
A token may sit inside the `style` attribute, as `{point.color}` does, and the
|
|
363
365
|
filled value is checked against a plain-CSS pattern before it is used.
|
|
364
366
|
|
|
@@ -16,6 +16,11 @@ import { computeStacks } from '../stack/stack';
|
|
|
16
16
|
/** Key for a switched-off series, or for one of its points. */
|
|
17
17
|
export const hiddenKey = (seriesIndex, pointIndex) => pointIndex === undefined ? `${seriesIndex}` : `${seriesIndex}:${pointIndex}`;
|
|
18
18
|
const DEFAULT_SPACING = [10, 10, 15, 10];
|
|
19
|
+
/** `spacingTop` and friends each override their side of the `spacing` tuple. */
|
|
20
|
+
const resolveSpacing = chart => {
|
|
21
|
+
const [top, right, bottom, left] = chart?.spacing ?? DEFAULT_SPACING;
|
|
22
|
+
return [chart?.spacingTop ?? top, chart?.spacingRight ?? right, chart?.spacingBottom ?? bottom, chart?.spacingLeft ?? left];
|
|
23
|
+
};
|
|
19
24
|
const isBand = scale => scale.kind === 'band';
|
|
20
25
|
const isContinuous = scale => scale.kind === 'linear' || scale.kind === 'time';
|
|
21
26
|
const asText = label => ({
|
|
@@ -405,7 +410,7 @@ export function buildChartModel({
|
|
|
405
410
|
max: acc.x.max + pad
|
|
406
411
|
} : acc.x;
|
|
407
412
|
const yDomains = acc.y;
|
|
408
|
-
const spacing = options.chart
|
|
413
|
+
const spacing = resolveSpacing(options.chart);
|
|
409
414
|
const [spaceTop, spaceRight, spaceBottom, spaceLeft] = spacing;
|
|
410
415
|
const labelsOnTop = xAxisOptions.opposite === true;
|
|
411
416
|
const labelStyle = xAxisOptions.labels?.style;
|
package/core/types/options.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export interface ChartRootOptions {
|
|
|
29
29
|
width?: number | string | null;
|
|
30
30
|
backgroundColor?: string;
|
|
31
31
|
spacing?: Spacing;
|
|
32
|
+
/** One side of `spacing`, which it overrides — the Highcharts pair. */
|
|
33
|
+
spacingTop?: number;
|
|
34
|
+
spacingRight?: number;
|
|
35
|
+
spacingBottom?: number;
|
|
36
|
+
spacingLeft?: number;
|
|
32
37
|
marginTop?: number;
|
|
33
38
|
marginRight?: number;
|
|
34
39
|
marginBottom?: number;
|