@ixfx/components 0.1.5 → 0.2.0
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/bundle/index.d.ts +105 -37
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +471 -156
- package/bundle/index.js.map +1 -1
- package/dist/charts/plot.d.ts +104 -36
- package/dist/charts/plot.d.ts.map +1 -1
- package/dist/charts/plot.js +621 -175
- package/dist/charts/plot.js.map +1 -1
- package/package.json +13 -13
package/dist/charts/plot.d.ts
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
import { LitElement, type PropertyValues } from "lit";
|
|
2
2
|
import { type Ref } from "lit/directives/ref.js";
|
|
3
3
|
import { CanvasHelper } from "ixfx/visual.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { type RectPositioned } from "ixfx/geometry.js";
|
|
5
|
+
import * as Numbers from 'ixfx/numbers.js';
|
|
6
|
+
import { type DrawingHelper } from "ixfx/visual.js";
|
|
7
|
+
export type SeriesColourGenerator = (seriesName: string) => string;
|
|
8
|
+
export declare class PlotAxis {
|
|
9
|
+
#private;
|
|
10
|
+
name: string;
|
|
11
|
+
bounds: PlotAxisBounds;
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
humanFormatValue(value: number[]): string;
|
|
14
|
+
getRange(series: Iterable<PlotSeries>): Numbers.NumericRange;
|
|
15
|
+
getCurrentRange(): Readonly<{
|
|
16
|
+
min: number;
|
|
17
|
+
max: number;
|
|
18
|
+
}> | undefined;
|
|
19
|
+
getValueScaler(series: Iterable<PlotSeries>): (value: number) => number;
|
|
20
|
+
computeActualRange(seriesOnAxis: Iterable<PlotSeries>, column?: number): {
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export type PlotSeriesDefault = {
|
|
26
|
+
limit: number;
|
|
27
|
+
};
|
|
6
28
|
/**
|
|
7
29
|
* Attributes
|
|
8
30
|
* * streaming: true/false (default: true)
|
|
@@ -12,7 +34,7 @@ import { Colour, type DrawingHelper } from "ixfx/visual.js";
|
|
|
12
34
|
*
|
|
13
35
|
* * line-width: stroke width of drawing line (default:2)
|
|
14
36
|
*
|
|
15
|
-
* * render: 'dot' or '
|
|
37
|
+
* * render: 'dot', 'line' or 'bar'(default: 'dot')
|
|
16
38
|
* * hide-legend: If added, legend is not shown
|
|
17
39
|
* * manual-draw: If added, automatic drawning is disabled
|
|
18
40
|
*
|
|
@@ -21,21 +43,29 @@ import { Colour, type DrawingHelper } from "ixfx/visual.js";
|
|
|
21
43
|
*/
|
|
22
44
|
export declare class PlotElement extends LitElement {
|
|
23
45
|
#private;
|
|
24
|
-
streaming: boolean;
|
|
25
46
|
hideLegend: boolean;
|
|
26
|
-
|
|
27
|
-
dataWidth: number;
|
|
28
|
-
fixedMax: number;
|
|
29
|
-
fixedMin: number;
|
|
30
|
-
lineWidth: number;
|
|
31
|
-
renderStyle: string;
|
|
32
|
-
manualDraw: boolean;
|
|
47
|
+
renderStyle: PlotElementRenderStyle;
|
|
33
48
|
padding: number;
|
|
49
|
+
readonly primaryAxis: PlotAxis;
|
|
50
|
+
readonly secondaryAxis: PlotAxis;
|
|
34
51
|
paused: boolean;
|
|
52
|
+
plotAreaFormat: PlotObjectFormatting;
|
|
53
|
+
/**
|
|
54
|
+
* Settings used for automatically generating series colour
|
|
55
|
+
*/
|
|
56
|
+
automaticSeriesColour: {
|
|
57
|
+
saturation: number;
|
|
58
|
+
lightness: number;
|
|
59
|
+
alpha: number;
|
|
60
|
+
};
|
|
61
|
+
seriesDefault: Partial<PlotSeriesDefault>;
|
|
35
62
|
canvasEl: Ref<HTMLCanvasElement>;
|
|
36
|
-
|
|
63
|
+
tooltipEl: Ref<HTMLDivElement>;
|
|
64
|
+
seriesColourGenerate: SeriesColourGenerator;
|
|
37
65
|
get series(): PlotSeries[];
|
|
38
66
|
get seriesCount(): number;
|
|
67
|
+
getSeriesFormatting(seriesName: string, createIfNeeded: boolean): SeriesFormatting | undefined;
|
|
68
|
+
setSeriesFormatting(seriesName: string, formatting: Partial<SeriesFormatting>): void;
|
|
39
69
|
/**
|
|
40
70
|
* Returns a `PlotElement` instance based on a query
|
|
41
71
|
* ```js
|
|
@@ -68,23 +98,24 @@ export declare class PlotElement extends LitElement {
|
|
|
68
98
|
* Keeps all series, but deletes their data
|
|
69
99
|
*/
|
|
70
100
|
clearData(): void;
|
|
71
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
72
101
|
connectedCallback(): void;
|
|
73
102
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
74
103
|
updateColours(): void;
|
|
75
|
-
|
|
76
|
-
|
|
104
|
+
setRawValues(values: number[], seriesName: string, automaticallyDraw: boolean): PlotSeries;
|
|
105
|
+
/**
|
|
106
|
+
* Treats each property of an object as the series name
|
|
107
|
+
* @param value
|
|
108
|
+
* @param automaticallyDraw
|
|
109
|
+
*/
|
|
110
|
+
appendObjectBySeries(value: object, automaticallyDraw: boolean): void;
|
|
111
|
+
appendRawValues(values: number[] | number, seriesName: string, automaticallyDraw: boolean): void;
|
|
77
112
|
/**
|
|
78
113
|
* Draw a set of key-value pairs as a batch.
|
|
79
114
|
* @param value
|
|
80
115
|
*/
|
|
81
|
-
plotObject(value: object): void;
|
|
82
|
-
colourGenerator(_series: string): Colour.Colourish;
|
|
83
116
|
draw(): void;
|
|
84
117
|
drawLegend(cl: RectPositioned, d: DrawingHelper): void;
|
|
85
|
-
|
|
86
|
-
drawDotSeries(data: number[], cp: Rect, d: DrawingHelper, colour: string): void;
|
|
87
|
-
computePlot(c: CanvasHelper, plotHeight: number, axisYwidth: number, padding: number): {
|
|
118
|
+
calculatePlotDataArea(c: CanvasHelper, plotHeight: number, axisYwidth: number, padding: number): {
|
|
88
119
|
x: number;
|
|
89
120
|
y: number;
|
|
90
121
|
width: number;
|
|
@@ -103,29 +134,66 @@ export declare class PlotElement extends LitElement {
|
|
|
103
134
|
y: number;
|
|
104
135
|
}[];
|
|
105
136
|
};
|
|
137
|
+
getOrCreateSeries(name: string): PlotSeries;
|
|
106
138
|
getSeries(name: string): PlotSeries | undefined;
|
|
139
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
107
140
|
static styles: import("lit").CSSResult;
|
|
108
141
|
}
|
|
142
|
+
export type SolidColourDrawStyle = Readonly<{
|
|
143
|
+
type: `solid`;
|
|
144
|
+
colour: string;
|
|
145
|
+
}>;
|
|
146
|
+
export type NoneDrawStyle = Readonly<{
|
|
147
|
+
type: `none`;
|
|
148
|
+
}>;
|
|
149
|
+
export type FillDrawStyle = SolidColourDrawStyle | NoneDrawStyle;
|
|
150
|
+
export type OutlineDrawStyle = SolidColourDrawStyle | NoneDrawStyle;
|
|
151
|
+
export type SeriesFormatting = PlotObjectFormatting & Readonly<{
|
|
152
|
+
axis: `primary` | `secondary`;
|
|
153
|
+
bar: BarSeriesFormatting;
|
|
154
|
+
dot: DotSeriesFormatting;
|
|
155
|
+
line: LineSeriesFormatting;
|
|
156
|
+
}>;
|
|
157
|
+
export type PlotObjectFormatting = Readonly<{
|
|
158
|
+
fill: FillDrawStyle;
|
|
159
|
+
outline: OutlineDrawStyle;
|
|
160
|
+
}>;
|
|
161
|
+
export type BarSeriesFormatting = {
|
|
162
|
+
gapWidth: number;
|
|
163
|
+
};
|
|
164
|
+
export type DotSeriesFormatting = {
|
|
165
|
+
gapWidth: number;
|
|
166
|
+
radius: `automatic` | number;
|
|
167
|
+
};
|
|
168
|
+
export type LineSeriesFormatting = {
|
|
169
|
+
width: number;
|
|
170
|
+
cap: `round` | `butt` | `square`;
|
|
171
|
+
join: `bevel` | `miter` | `round`;
|
|
172
|
+
};
|
|
109
173
|
export declare class PlotSeries {
|
|
110
|
-
|
|
111
|
-
|
|
174
|
+
#private;
|
|
175
|
+
readonly name: string;
|
|
112
176
|
private plot;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
177
|
+
constructor(name: string, plot: PlotElement);
|
|
178
|
+
get length(): number;
|
|
179
|
+
getValuesForColumn(column: number): Generator<[value: number, index: number]>;
|
|
180
|
+
getValue(index: number): number[] | undefined;
|
|
181
|
+
pushValue(value: number[] | number, automaticallyDraw: boolean): void;
|
|
182
|
+
setValues(values: number[][], automaticallyDraw: boolean): void;
|
|
183
|
+
humanFormatValue(value: number[]): string;
|
|
184
|
+
setRawValues(values: number[], automaticallyDraw: boolean): void;
|
|
185
|
+
setCapacityLimit(v: number): void;
|
|
186
|
+
unsetCapacityLimit(): void;
|
|
187
|
+
setFormatting(formatting: Partial<SeriesFormatting>): void;
|
|
188
|
+
getFormatting(): SeriesFormatting;
|
|
189
|
+
get isDirty(): boolean;
|
|
190
|
+
set isDirty(value: boolean);
|
|
191
|
+
get onPrimaryAxis(): boolean;
|
|
192
|
+
set onPrimaryAxis(value: boolean);
|
|
117
193
|
clear(): void;
|
|
118
|
-
/**
|
|
119
|
-
* Returns a copy of the data scaled by the current
|
|
120
|
-
* range of the data
|
|
121
|
-
* @returns
|
|
122
|
-
*/
|
|
123
|
-
getScaled(): number[];
|
|
124
|
-
getScaledBy(scaler: (v: number) => number): number[];
|
|
125
|
-
push(value: number): void;
|
|
126
|
-
setValues(values: number[]): void;
|
|
127
|
-
resetScale(): void;
|
|
128
194
|
}
|
|
195
|
+
export type PlotAxisBounds = `automatic` | Numbers.NumericRange;
|
|
196
|
+
export type PlotElementRenderStyle = `dot` | `line` | `bar`;
|
|
129
197
|
declare global {
|
|
130
198
|
interface HTMLElementTagNameMap {
|
|
131
199
|
"ixfx-plot-element": PlotElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/charts/plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/charts/plot.ts"],"names":[],"mappings":"AAAA,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