@pacem/pacem-charts 1.0.0-bessel → 1.0.0-dirac

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -14,6 +14,9 @@ import { PacemSeriesChartElement } from './types';
14
14
  //namespace Pacem.Components.Charts {
15
15
  const SVG_NS = "http://www.w3.org/2000/svg";
16
16
  const PADDING_PIXELS = 24;
17
+ /**
18
+ * Renders a clustered or stacked column (bar) chart out of one or more {@link PacemChartSeriesElement} series.
19
+ */
17
20
  let PacemColumnChartElement = class PacemColumnChartElement extends PacemSeriesChartElement {
18
21
  constructor() {
19
22
  super(...arguments);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -45,6 +45,9 @@ const DEL_VAL = CustomElementUtils.deleteAttachedPropertyValue;
45
45
  const PADDING_PIXELS = 24;
46
46
  const SERIES_MAGNITUDE = 'pacem:chart-series:area';
47
47
  const SVG_NS = "http://www.w3.org/2000/svg";
48
+ /**
49
+ * Renders a line, spline, area or spline-area chart out of one or more {@link PacemChartSeriesElement} series.
50
+ */
48
51
  let PacemChartElement = class PacemChartElement extends PacemSeriesChartElement {
49
52
  constructor() {
50
53
  super(...arguments);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
package/dist/esm/pie.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -12,6 +12,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  import { CustomElement, Watch, PropertyConverters, P, PCSS, Components, Utils, CustomElementUtils, Debounce } from '@pacem/pacem-core';
13
13
  import { MANAGED_EVENTS } from './types';
14
14
  //namespace Pacem.Components.Charts {
15
+ /**
16
+ * Represents a single slice within a `<pacem-pie-chart>`.
17
+ */
15
18
  let PacemPieSliceElement = class PacemPieSliceElement extends Components.PacemItemElement {
16
19
  constructor() {
17
20
  super(...arguments);
@@ -77,6 +80,9 @@ PacemPieSliceElement = __decorate([
77
80
  export { PacemPieSliceElement };
78
81
  const TWO_PI = Math.PI * 2;
79
82
  const PI1_2 = Math.PI * .5;
83
+ /**
84
+ * Renders a pie or doughnut chart out of one or more {@link PacemPieSliceElement} slices.
85
+ */
80
86
  let PacemPieChartElement = class PacemPieChartElement extends Components.PacemItemsContainerElement {
81
87
  constructor() {
82
88
  super();
package/dist/esm/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @pacem/pacem-charts v1.0.0-bessel (https://js.pacem.it)
2
+ * @pacem/pacem-charts v1.0.0-dirac (https://js.pacem.it)
3
3
  * Pacem (https://pacem.it)
4
4
  * Licensed under Apache-2.0
5
5
  */
@@ -116,11 +116,15 @@ function gcd(a, b) {
116
116
  }
117
117
  return gcd(b % a, a);
118
118
  }
119
+ /** Custom UI event dispatched by chart elements when the user interacts with a rendered data point (e.g. `itemclick`, `itemmouseover`). */
119
120
  export class ChartEvent extends CustomUIEvent {
120
121
  constructor(type, eventInit, originalEvent) {
121
122
  super(type, eventInit, originalEvent);
122
123
  }
123
124
  }
125
+ /**
126
+ * Represents a single data series to be plotted within a `<pacem-chart>`-like element.
127
+ */
124
128
  let PacemChartSeriesElement = class PacemChartSeriesElement extends Components.PacemItemElement {
125
129
  get values() {
126
130
  return this.datasource;
@@ -146,6 +150,10 @@ PacemChartSeriesElement = __decorate([
146
150
  ], PacemChartSeriesElement);
147
151
  export { PacemChartSeriesElement };
148
152
  const SVG_NS = "http://www.w3.org/2000/svg";
153
+ /**
154
+ * Abstract base class for chart elements hosting a collection of {@link PacemChartSeriesElement} items.
155
+ * Provides axis/grid computation and SVG drawing helpers shared by concrete chart-series elements (e.g. `PacemChartElement`, `PacemColumnChartElement`).
156
+ */
149
157
  export class PacemSeriesChartElement extends Components.PacemItemsContainerElement {
150
158
  constructor() {
151
159
  super();
package/package.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "dist/browser/*.*",
5
5
  "dist/bundle/*.*",
6
6
  "dist/esm/*.*",
7
+ "dist/docs/*.*",
7
8
  "typings/*.*",
8
9
  "README.md",
9
10
  "LICENSE",
@@ -24,7 +25,7 @@
24
25
  "types": "./typings/index.d.ts"
25
26
  }
26
27
  },
27
- "version": "1.0.0-bessel",
28
+ "version": "1.0.0-dirac",
28
29
  "author": {
29
30
  "name": "Pacem",
30
31
  "url": "https://pacem.it"
@@ -3,19 +3,27 @@ import { CustomUIEvent } from '@pacem/pacem-core';
3
3
  import { Point } from '@pacem/pacem-foundation';
4
4
  import { Size } from '@pacem/pacem-foundation';
5
5
 
6
+ /** A single labeled value belonging to a {@link ChartDataSeries}. */
6
7
  declare interface ChartDataItem {
7
8
  label: any;
8
9
  value: number;
9
10
  }
10
11
 
12
+ /** A named collection of {@link ChartDataItem}s to be plotted on a chart. */
11
13
  declare interface ChartDataSeries {
14
+ /** Gets the (already sorted) set of chart data items. */
12
15
  readonly values: ChartDataItem[];
16
+ /** Gets the series label. */
13
17
  readonly label: any;
18
+ /** Gets the series color. */
14
19
  readonly color?: string;
20
+ /** Gets the CSS class(es) to apply to the series' rendered elements. */
15
21
  readonly className?: string;
22
+ /** Gets a value indicating whether the single data points should be rendered too. */
16
23
  readonly datapoints?: boolean;
17
24
  }
18
25
 
26
+ /** Flattened representation of a single data point along with its owning series' label and color, used as the payload of {@link ChartEventArgs}. */
19
27
  declare type ChartDataSeriesItem = {
20
28
  series: any;
21
29
  label: any;
@@ -23,14 +31,19 @@ declare type ChartDataSeriesItem = {
23
31
  value: number;
24
32
  };
25
33
 
34
+ /** A chart's whole datasource: a collection of {@link ChartDataSeries}. */
26
35
  declare type ChartDatasource = ChartDataSeries[];
27
36
 
37
+ /** Custom UI event dispatched by chart elements when the user interacts with a rendered data point (e.g. `itemclick`, `itemmouseover`). */
28
38
  declare class ChartEvent extends CustomUIEvent<ChartEventArgs> {
29
39
  constructor(type: string, eventInit: CustomEventInit<ChartEventArgs>, originalEvent: MouseEvent | TouchEvent | KeyboardEvent);
30
40
  }
31
41
 
42
+ /** Payload carried by {@link ChartEvent}. */
32
43
  declare interface ChartEventArgs {
44
+ /** Gets the data item (and owning series) the event refers to. */
33
45
  readonly dataItem: ChartDataSeriesItem;
46
+ /** Gets the point (in page coordinates) to anchor tooltips or popups to. */
34
47
  readonly anchorPoint: Point;
35
48
  }
36
49
 
@@ -60,8 +73,12 @@ export declare namespace Components {
60
73
 
61
74
  declare const MANAGED_EVENTS: string[];
62
75
 
76
+ /**
77
+ * Renders a line, spline, area or spline-area chart out of one or more {@link PacemChartSeriesElement} series.
78
+ */
63
79
  declare class PacemChartElement extends PacemSeriesChartElement {
64
80
  #private;
81
+ /** Gets or sets the chart rendering type. Default is `line`. */
65
82
  type: 'line' | 'spline' | 'area' | 'splinearea';
66
83
  /** Gets or sets how aspect ratio between x- and y-axis must be handled (considered only when xAxisType is `numeric`). Default is `adapt`. */
67
84
  aspectRatio: 'adapt' | 'monometric' | 'logaritmic';
@@ -81,12 +98,17 @@ declare class PacemChartElement extends PacemSeriesChartElement {
81
98
  protected drawSeries(datasource: ChartDatasource): void;
82
99
  }
83
100
 
101
+ /**
102
+ * Represents a single data series to be plotted within a `<pacem-chart>`-like element.
103
+ */
84
104
  declare class PacemChartSeriesElement extends Components_2.PacemItemElement implements ChartDataSeries {
85
105
  /** Gets or sets the - already sorted - set of chart data items. */
86
106
  datasource: ChartDataItem[];
87
107
  /** Gets or sets the series label. */
88
108
  label: string;
109
+ /** Gets or sets the series color. */
89
110
  color: string;
111
+ /** Gets or sets a value indicating whether the single data points should be rendered too. */
90
112
  datapoints: boolean;
91
113
  get values(): ChartDataItem[];
92
114
  /** @internal
@@ -94,7 +116,11 @@ declare class PacemChartSeriesElement extends Components_2.PacemItemElement impl
94
116
  _uiElements: Element[];
95
117
  }
96
118
 
119
+ /**
120
+ * Renders a clustered or stacked column (bar) chart out of one or more {@link PacemChartSeriesElement} series.
121
+ */
97
122
  declare class PacemColumnChartElement extends PacemSeriesChartElement {
123
+ /** Gets or sets whether series' columns are clustered side-by-side or stacked. Default is `cluster`. */
98
124
  type: 'cluster' | 'stack';
99
125
  /** Set a value between 0 and 1, for the columns' stack/cluster horizontal size (percentage of the available space). */
100
126
  groupWidth: number;
@@ -103,6 +129,9 @@ declare class PacemColumnChartElement extends PacemSeriesChartElement {
103
129
  drawSeries(datasource: ChartDatasource): void;
104
130
  }
105
131
 
132
+ /**
133
+ * Renders a pie or doughnut chart out of one or more {@link PacemPieSliceElement} slices.
134
+ */
106
135
  declare class PacemPieChartElement extends Components_2.PacemItemsContainerElement<PacemPieSliceElement> {
107
136
  constructor();
108
137
  validate(item: PacemPieSliceElement): boolean;
@@ -110,7 +139,9 @@ declare class PacemPieChartElement extends Components_2.PacemItemsContainerEleme
110
139
  propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
111
140
  /** Set a value between 0 and 1, for doughnut appearance. */
112
141
  cutout: number;
142
+ /** Gets or sets the target element the chart will be rendered into (a `<div>` is created and inserted, if not set). */
113
143
  target: HTMLElement;
144
+ /** Gets or sets a value indicating whether slices are rendered using an SVG mask (needed to properly render slice padding) instead of plain paths. */
114
145
  maskBasedRendering: boolean;
115
146
  /** Distance between two consecutive slices, in pixels. */
116
147
  slicePadding: number;
@@ -132,12 +163,19 @@ declare class PacemPieChartElement extends Components_2.PacemItemsContainerEleme
132
163
  draw(): void;
133
164
  }
134
165
 
166
+ /**
167
+ * Represents a single slice within a `<pacem-pie-chart>`.
168
+ */
135
169
  declare class PacemPieSliceElement extends Components_2.PacemItemElement implements ChartDataItem {
136
170
  protected findContainer(): PacemPieChartElement;
137
171
  private get chart();
172
+ /** Gets or sets the slice value. */
138
173
  value: number;
174
+ /** Gets or sets the slice label. */
139
175
  label: string;
176
+ /** Gets or sets the slice color. */
140
177
  color: string;
178
+ /** Gets or sets the slice's polar coordinates (radius and angle, both normalized), computed automatically while drawing. */
141
179
  normalizedPolarCoords: {
142
180
  radius: number;
143
181
  angle: number;
@@ -153,15 +191,22 @@ declare class PacemPieSliceElement extends Components_2.PacemItemElement impleme
153
191
  private _broadcastHandler;
154
192
  }
155
193
 
194
+ /**
195
+ * Abstract base class for chart elements hosting a collection of {@link PacemChartSeriesElement} items.
196
+ * Provides axis/grid computation and SVG drawing helpers shared by concrete chart-series elements (e.g. `PacemChartElement`, `PacemColumnChartElement`).
197
+ */
156
198
  declare abstract class PacemSeriesChartElement extends Components_2.PacemItemsContainerElement<PacemChartSeriesElement> {
157
199
  constructor();
158
200
  validate(item: PacemChartSeriesElement): boolean;
201
+ /** Gets or sets the target element the chart will be rendered into (a `<div>` is created and inserted, if not set). */
159
202
  target: HTMLElement;
160
203
  /**
161
204
  Gets or sets the x-axis type for sorting, measuring and labeling.
162
205
  */
163
206
  xAxisType: 'string' | 'date' | 'number';
207
+ /** Gets or sets where the x-axis labels are positioned, or `none` to hide them. */
164
208
  xAxisPosition: 'bottom' | 'top' | 'none';
209
+ /** Gets or sets the chart datasource, overriding the series declared as child `<pacem-chart-series>` elements. */
165
210
  datasource: ChartDatasource;
166
211
  /** Maximum number of horizontal grid lines. */
167
212
  yAxisDensity: number;
@@ -171,7 +216,9 @@ declare abstract class PacemSeriesChartElement extends Components_2.PacemItemsCo
171
216
  yAxisMin: number;
172
217
  /** Maximum y value. */
173
218
  yAxisMax: number;
219
+ /** Gets or sets the `Intl.NumberFormat` options used to format the y-axis labels. */
174
220
  yAxisFormat: Intl.NumberFormatOptions;
221
+ /** Gets or sets the `Intl.NumberFormat` or `Intl.DateTimeFormat` options used to format the x-axis labels. */
175
222
  xAxisFormat: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions;
176
223
  register(item: PacemChartSeriesElement): boolean;
177
224
  unregister(item: PacemChartSeriesElement): boolean;