@pioneer-code/pioneer-charts 22.2.24 → 22.2.25

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/README.md CHANGED
@@ -12,13 +12,29 @@ Guides, the API reference, live examples, and theming instructions all live on t
12
12
 
13
13
  **https://pioneercharts.com**
14
14
 
15
+ ## Charts
16
+
17
+ Each chart has its own page with live examples, markup and its full configuration:
18
+
19
+ - [Angular Bar Chart](https://pioneercharts.com/docs/components/charts/bar-chart) - vertical and horizontal; single, grouped and stacked, with thresholds
20
+ - [Angular Line Chart](https://pioneercharts.com/docs/components/charts/line-chart) - with zoom, hover effects, point images and ranges
21
+ - [Angular Area Chart](https://pioneercharts.com/docs/components/charts/area-chart) - with zoom, hover effects, point images and ranges
22
+ - [Angular Scatter Plot Chart](https://pioneercharts.com/docs/components/charts/plot-chart) - with zoom and fan-out for overlapping points
23
+ - [Angular Pie Chart](https://pioneercharts.com/docs/components/charts/pie-chart) - animated, with click events for each slice
24
+ - [Angular Donut Chart](https://pioneercharts.com/docs/components/charts/donut-chart) - with a total or any label in its center
25
+ - [Angular Dot Plot Chart](https://pioneercharts.com/docs/components/charts/dot-plot-chart) - values stacked into columns along one axis
26
+ - [Angular Proximity Chart](https://pioneercharts.com/docs/components/charts/proximity-chart) - one item in the middle, its closest matches around it
27
+ - [Legend](https://pioneercharts.com/docs/components/charts/legend) - a chart's series, with click events
28
+
29
+ Or see them all together on the [chart examples](https://pioneercharts.com/charts) page.
30
+
15
31
  ## Features
16
32
 
17
33
  - Bar (vertical and horizontal), line, area, plot, pie, donut, dot plot and proximity charts, plus a legend.
18
- - Beautiful default theme, customizable via CSS or by overriding the source Sass variables.
34
+ - Beautiful default theme, customizable via CSS or by overriding the source Sass variables ([theming guide](https://pioneercharts.com/docs/guides/theme)).
19
35
  - Strongly typed configuration contracts.
20
36
  - Outputs for user interaction (bar, slice, dot, and legend clicks), plus the size a dot plot fitted its marks to.
21
- - Custom tooltips via a projected template.
37
+ - [Custom tooltips](https://pioneercharts.com/docs/guides/tooltip) via a projected template.
22
38
  - Standalone components — no `NgModule`s required.
23
39
  - Charts automatically re-render when their container resizes.
24
40
  - Zoneless-compatible.
@@ -36,7 +52,7 @@ The D3 modules the charts use are installed with the package, so there's nothing
36
52
  npm install --save @pioneer-code/pioneer-charts
37
53
  ```
38
54
 
39
- Then follow the [Introduction](https://pioneercharts.com) on the docs site to import the components and theme into your app.
55
+ Then follow [Getting Started](https://pioneercharts.com/docs/guides/introduction) on the docs site to import the components and theme into your app.
40
56
 
41
57
  ## Contributing
42
58
 
@@ -1555,6 +1555,7 @@ class PcacChart {
1555
1555
  // size it was drawn at, or a container that comes back at that same width (a hidden tab
1556
1556
  // shown again) would read as unchanged to `containerSizeChanged()` and never be redrawn.
1557
1557
  this.lastContainerWidth = null;
1558
+ this.reserveSvgHeight(chartElm, config);
1558
1559
  return false;
1559
1560
  }
1560
1561
  this.width = measuredWidth;
@@ -1571,6 +1572,23 @@ class PcacChart {
1571
1572
  this.lastHeightFull = config.heightFull === true;
1572
1573
  return true;
1573
1574
  }
1575
+ /**
1576
+ * Gives a chart that can't draw yet the height it will draw at, so the page doesn't jump when it
1577
+ * does. On the server (pre-rendering, SSR) no chart can draw - there's no layout to measure - and
1578
+ * an empty `<svg>` is drawn 150px tall by the browser; everything below it moved once the app
1579
+ * started and the chart grew to its real height, which is what search engines measure as layout
1580
+ * shift (CLS). The height is exactly what `buildContainer()` will set without `heightFull`: room
1581
+ * the builder made in the vertical margins comes back out of the plot height (`reservedHeight`),
1582
+ * so the total is the configured height plus the margins as the builder has set them by now.
1583
+ * With `heightFull` it's that floor, the container's own CSS deciding the rest. Width is left
1584
+ * alone: it's the container's, and the chart takes it once it can measure it.
1585
+ */
1586
+ reserveSvgHeight(chartElm, config) {
1587
+ const height = Math.max(0, config.height - this.reservedHeight) + this.margin.top + this.margin.bottom;
1588
+ if (height > 0) {
1589
+ select(chartElm.nativeElement).attr('height', height);
1590
+ }
1591
+ }
1574
1592
  /**
1575
1593
  * `config.height` normally *is* the height of the drawing area. With `config.heightFull` on it
1576
1594
  * becomes a floor instead: the chart fills its container, and only falls back to `config.height`