Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[O2B-1154] QC flags visualization #1781

Open
wants to merge 661 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
661 commits
Select commit Hold shift + click to select a range
c3b2e76
use polygon
xsalonx Feb 8, 2024
0f21b1b
merger main
xsalonx Feb 9, 2024
7d03fe7
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 9, 2024
19d064f
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 9, 2024
d63eedb
merge main
xsalonx Feb 9, 2024
f5a6ce9
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 9, 2024
167f385
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 9, 2024
10703b1
merge main
xsalonx Feb 9, 2024
b946a55
Merge branch 'xsalonx/QCF/O2B-1145/implement-view' into xsalonx/QCF/O…
xsalonx Feb 9, 2024
f3cd8a5
hoovering bars - WORKS
xsalonx Feb 9, 2024
7ddd359
ok, now it work, hoovering bars - WORKS
xsalonx Feb 9, 2024
1b032c6
add TODO
xsalonx Feb 9, 2024
61e3efe
cleanup
xsalonx Feb 9, 2024
fc32303
cleanup
xsalonx Feb 9, 2024
f86a8af
cleanup
xsalonx Feb 9, 2024
94d91b7
cache polygons
xsalonx Feb 9, 2024
c1e8870
docs
xsalonx Feb 9, 2024
92b9b1a
docs
xsalonx Feb 9, 2024
22d570a
docs
xsalonx Feb 9, 2024
24b9a60
cleanup
xsalonx Feb 9, 2024
ab1d3c5
make tooltip movement smooth
xsalonx Feb 9, 2024
09e87ca
correct date in tooltip
xsalonx Feb 9, 2024
e0e0cb8
add colors; refactor
xsalonx Feb 12, 2024
49291fa
a
xsalonx Feb 12, 2024
183a3c7
to separate file
xsalonx Feb 12, 2024
286847d
refactor
xsalonx Feb 12, 2024
3c75832
rename
xsalonx Feb 12, 2024
72289ee
docs
xsalonx Feb 12, 2024
23a1986
extract proper timestamp from run
xsalonx Feb 12, 2024
097f1ff
cleanup
xsalonx Feb 12, 2024
3545e7a
typedefs
xsalonx Feb 12, 2024
bd0f74e
typdefs
xsalonx Feb 12, 2024
66c806a
split
xsalonx Feb 12, 2024
8b1a3de
squash code
xsalonx Feb 13, 2024
fce9a46
hadle incorrect states
xsalonx Feb 13, 2024
10a9f44
add seeder
xsalonx Feb 13, 2024
95d7aa8
time range
xsalonx Feb 13, 2024
ae9dd7a
fix timestamp format
xsalonx Feb 13, 2024
4cff300
add timestamps to seeder
xsalonx Feb 13, 2024
399e9b1
test WIP
xsalonx Feb 13, 2024
d1bfe19
fetching tests ok
xsalonx Feb 13, 2024
0b2693a
WIP
xsalonx Feb 13, 2024
7c82233
amend test
xsalonx Feb 13, 2024
1da66be
test passing
xsalonx Feb 13, 2024
32946d1
amend linter
xsalonx Feb 13, 2024
6d4a53e
docs
xsalonx Feb 13, 2024
bf40fba
ver test WIP
xsalonx Feb 13, 2024
c24960b
ver test OK
xsalonx Feb 13, 2024
845b78d
add addociation name
xsalonx Feb 13, 2024
cc80b9f
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 13, 2024
619b14e
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 13, 2024
8cedb43
Merge branch 'xsalonx/QCF/O2B-1120/qcf-api' into xsalonx/QCF/O2B-1145…
xsalonx Feb 13, 2024
b4dd3ed
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 13, 2024
1df373a
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 13, 2024
3d81d67
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 13, 2024
8aa3c76
merge main
xsalonx Feb 13, 2024
4618226
add controller
xsalonx Feb 13, 2024
da5ff0f
add router
xsalonx Feb 13, 2024
9ff139d
refactor load
xsalonx Feb 13, 2024
dbd0682
amend
xsalonx Feb 13, 2024
40d6ac9
fetching works
xsalonx Feb 13, 2024
cd78155
add getter
xsalonx Feb 13, 2024
26a56f8
docs
xsalonx Feb 13, 2024
c028c28
add breadcramps
xsalonx Feb 13, 2024
822828c
add repo
xsalonx Feb 14, 2024
0250065
add repo
xsalonx Feb 14, 2024
a25c96f
get all reasons service function
xsalonx Feb 14, 2024
0d5903d
add test
xsalonx Feb 14, 2024
da86a6d
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
9cc5a85
add ep,; test WIP
xsalonx Feb 14, 2024
4523c64
add provenenace
xsalonx Feb 14, 2024
eeafc19
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
a2cf638
revoke
xsalonx Feb 14, 2024
78a9a09
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
818022e
test WIP
xsalonx Feb 14, 2024
0d9166b
t WIP
xsalonx Feb 14, 2024
70310df
test
xsalonx Feb 14, 2024
5b1dd31
WIP
xsalonx Feb 14, 2024
d576f5e
simplify test
xsalonx Feb 14, 2024
e25b183
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
a8f6407
wIP
xsalonx Feb 14, 2024
2088433
WIP
xsalonx Feb 14, 2024
961b386
change error messages
xsalonx Feb 14, 2024
47b48ee
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
ef7ab25
qcf creation test ok
xsalonx Feb 14, 2024
26d7287
add coalesc comment to null
xsalonx Feb 14, 2024
631fcd5
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
c946bcb
expose ep
xsalonx Feb 14, 2024
2bb5574
a
xsalonx Feb 14, 2024
e786461
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
e9ab92d
add test ok
xsalonx Feb 14, 2024
748917e
typo
xsalonx Feb 14, 2024
786fa0b
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Feb 14, 2024
0ea4d0f
typo
xsalonx Feb 14, 2024
41e17da
Merge branch 'xsalonx/QCF/O2B-1120/qcf-api' into xsalonx/QCF/O2B-1145…
xsalonx Feb 14, 2024
f34edb8
cherry pick colouring
xsalonx Feb 20, 2024
a5575bd
del
xsalonx Feb 20, 2024
ef51e39
merge main
xsalonx Feb 20, 2024
1f9fd69
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 20, 2024
cd4adba
miss
xsalonx Feb 20, 2024
6eae272
fixed
xsalonx Feb 20, 2024
9be4461
revoke
xsalonx Feb 20, 2024
e6481b9
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 21, 2024
12b22a3
rm verifications
xsalonx Feb 21, 2024
b5b40ca
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 21, 2024
a1a7c8e
cherry-pick
xsalonx Feb 21, 2024
fb02386
name archived
xsalonx Feb 23, 2024
9cd4bd6
obsolate to archived
xsalonx Feb 23, 2024
ad453da
simplify association
xsalonx Feb 23, 2024
a7b880c
a
xsalonx Feb 23, 2024
994f92f
Revert "a"
xsalonx Feb 23, 2024
da61477
Revert "simplify association"
xsalonx Feb 23, 2024
cda8a13
docs
xsalonx Feb 23, 2024
5c057be
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 23, 2024
87e91ee
rename
xsalonx Feb 26, 2024
9c69a94
simplify
xsalonx Feb 26, 2024
a96cf0d
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 26, 2024
c289bbd
refactor
xsalonx Feb 26, 2024
59e6c78
refactor
xsalonx Feb 26, 2024
e05b9ad
refactor
xsalonx Feb 26, 2024
3f42609
a
xsalonx Feb 26, 2024
967a5a0
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 26, 2024
80e32bc
add assoc
xsalonx Feb 26, 2024
5f9f02c
rename
xsalonx Feb 26, 2024
b6895c4
cleanup
xsalonx Feb 26, 2024
2302cf7
fix associations
xsalonx Feb 26, 2024
dc7a8bc
comment
xsalonx Feb 26, 2024
0357af6
rename table
xsalonx Feb 27, 2024
ac18f63
reason to type
xsalonx Feb 27, 2024
7fec93c
rename
xsalonx Feb 27, 2024
9894f1d
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Feb 27, 2024
ec2a0b1
merge main
xsalonx Feb 27, 2024
bf80ec9
rename
xsalonx Feb 27, 2024
4f111dc
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 27, 2024
208204e
docs
xsalonx Feb 27, 2024
c6cac22
cleanup
xsalonx Feb 27, 2024
2bd5f1b
refactor
xsalonx Feb 27, 2024
325df0e
rename
xsalonx Feb 27, 2024
fd85a90
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 27, 2024
9268c73
fix
xsalonx Feb 27, 2024
dac6b06
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 27, 2024
5ec7dbf
WIP
xsalonx Feb 27, 2024
995cc2b
typo
xsalonx Feb 27, 2024
548f461
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 27, 2024
f2bffad
fix
xsalonx Feb 27, 2024
fc2d2fe
WIP
xsalonx Feb 27, 2024
a719283
typo
xsalonx Feb 27, 2024
7e8439d
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 27, 2024
f5cf292
rename
xsalonx Feb 27, 2024
17789b1
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Feb 27, 2024
ab31a38
serv fixed
xsalonx Feb 27, 2024
e19a245
seeders
xsalonx Feb 27, 2024
e7b9aab
fix Test
xsalonx Feb 27, 2024
03922a7
simp
xsalonx Feb 28, 2024
86f3163
docs
xsalonx Feb 28, 2024
7c6c4c3
WIP
xsalonx Mar 1, 2024
4f14b15
add test
xsalonx Mar 1, 2024
e9d5fe8
rename
xsalonx Mar 1, 2024
d8e67d9
fix test
xsalonx Mar 4, 2024
5b15077
Merge branch 'main' into xsalonx/QCF/O2B-1118/migration-files-and-models
xsalonx Mar 4, 2024
abfc255
Merge branch 'xsalonx/QCF/O2B-1118/migration-files-and-models' into x…
xsalonx Mar 4, 2024
6d4e171
merge main WIP
xsalonx Apr 3, 2024
7377141
merge WIP
xsalonx Apr 3, 2024
552303b
Merge branch 'main' into xsalonx/QCF/O2B-1119/qcf-service
xsalonx Apr 3, 2024
58cfe2b
rename
xsalonx Apr 4, 2024
5197ffb
cleanup
xsalonx Apr 4, 2024
9389fdb
rename
xsalonx Apr 4, 2024
2fe02d3
seeders and test
xsalonx Apr 4, 2024
932b9e2
cleanup
xsalonx Apr 4, 2024
f6d5ad0
cleanup
xsalonx Apr 4, 2024
284e133
split
xsalonx Apr 4, 2024
7a34335
test
xsalonx Apr 4, 2024
f6c5fa2
rename
xsalonx Apr 4, 2024
d45597d
fix
xsalonx Apr 4, 2024
d985c1e
Merge branch 'main' into xsalonx/QCF/O2B-1119/qcf-service
xsalonx Apr 4, 2024
1baf735
comment
xsalonx Apr 4, 2024
020853e
fix
xsalonx Apr 4, 2024
b5a1440
f
xsalonx Apr 4, 2024
8164134
docs
xsalonx Apr 4, 2024
f5cae3d
cleaunp
xsalonx Apr 4, 2024
d46eebb
docs
xsalonx Apr 4, 2024
d10c5c2
tfix
xsalonx Apr 4, 2024
9fde51a
fix test
xsalonx Apr 4, 2024
cdfd061
add st wip
xsalonx Apr 4, 2024
cdaf988
restyle'
xsalonx Apr 4, 2024
e2d3cf3
add controller
xsalonx Apr 4, 2024
7912e0a
fix sorting
xsalonx Apr 4, 2024
a709fcf
typo
xsalonx Apr 4, 2024
58383d3
test
xsalonx Apr 4, 2024
46292e2
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Apr 4, 2024
98a787b
extend sorting
xsalonx Apr 4, 2024
9cea08e
test
xsalonx Apr 4, 2024
8de2625
test'
xsalonx Apr 4, 2024
e7a3568
fix test
xsalonx Apr 4, 2024
020c0d0
Merge branch 'xsalonx/QCF/O2B-1119/qcf-service' into xsalonx/QCF/O2B-…
xsalonx Apr 4, 2024
3a91c09
tess wip
xsalonx Apr 4, 2024
e13052c
fix
xsalonx Apr 4, 2024
d97e605
test
xsalonx Apr 4, 2024
86f2d50
test ok
xsalonx Apr 4, 2024
096ab5b
test ok
xsalonx Apr 4, 2024
5df4e5d
revoke
xsalonx Apr 4, 2024
8d196ea
revoke
xsalonx Apr 4, 2024
373055e
revoke
xsalonx Apr 4, 2024
d0217f7
merge main
xsalonx Apr 5, 2024
784ae6a
Merge branch 'main' into xsalonx/QCF/O2B-1119/qcf-fetch-endpoint
xsalonx Apr 5, 2024
b1cf9de
cleanup
xsalonx Apr 5, 2024
f9f8ec3
use dates
xsalonx Apr 5, 2024
4ec3008
desc order
xsalonx Apr 5, 2024
b08591a
test
xsalonx Apr 5, 2024
665e1fb
test
xsalonx Apr 5, 2024
a74b7d3
merge main
xsalonx Apr 5, 2024
0d763b0
rename
xsalonx Apr 5, 2024
eeafbbe
simp, rename
xsalonx Apr 5, 2024
b27ee9c
refactor
xsalonx Apr 5, 2024
bfe757e
merge main
xsalonx Oct 10, 2024
1339d19
cleanup
xsalonx Oct 10, 2024
dee0b38
fix path
xsalonx Oct 10, 2024
61fa88e
cleanup
xsalonx Oct 10, 2024
c81a5fe
docs
xsalonx Oct 10, 2024
922e2b3
move ChartColors back to statistics dir
xsalonx Oct 10, 2024
c2de4d8
cleanup
xsalonx Oct 10, 2024
e0b82ee
cleanup
xsalonx Oct 10, 2024
2b3662c
cleanup
xsalonx Oct 10, 2024
f173e1a
cleanup
xsalonx Oct 10, 2024
c64206f
cleanup
xsalonx Oct 10, 2024
15a3db1
adjust visualization
xsalonx Oct 10, 2024
62efaaa
line chart fixed
xsalonx Oct 10, 2024
c1ad922
docs
xsalonx Oct 10, 2024
02e56b6
wip
xsalonx Oct 10, 2024
3824f71
fix order
xsalonx Oct 11, 2024
9e4e00f
fix order
xsalonx Oct 11, 2024
9e31c14
a
xsalonx Oct 11, 2024
9ed9aaf
keep all records
xsalonx Oct 11, 2024
905f008
cleanup
xsalonx Oct 11, 2024
8759e27
cleanup
xsalonx Oct 12, 2024
38870ea
patterns work
xsalonx Oct 12, 2024
cfa729a
cleanup
xsalonx Oct 12, 2024
0d6d54f
effective periods
xsalonx Oct 12, 2024
4437941
mod pattern
xsalonx Oct 12, 2024
6f96aee
refactor patterns
xsalonx Oct 12, 2024
6579675
docs
xsalonx Oct 12, 2024
d15f1e1
docs
xsalonx Oct 12, 2024
539603b
fix
xsalonx Oct 12, 2024
ecc34bf
cleanup
xsalonx Oct 12, 2024
882fef1
fix tests
xsalonx Oct 12, 2024
b8a513e
remove unnecessary tests
xsalonx Oct 12, 2024
2f24cb1
clenaup
xsalonx Oct 12, 2024
d9745eb
add test
xsalonx Oct 12, 2024
8c554df
Merge branch 'main' into xsalonx/QCF-vis/O2B-1145/O2B-1154/qcf-visual…
xsalonx Oct 12, 2024
1700708
cleanup; handle errors
xsalonx Oct 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/database/adapters/QcFlagAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class QcFlagAdapter {

this.qcFlagTypeAdapter = null;
this.qcFlagVerificationAdapter = null;
this.qcFlagEffectivePeriodAdapter = null;
this.userAdapter = null;
}

Expand All @@ -48,6 +49,7 @@ class QcFlagAdapter {
flagTypeId,
flagType,
verifications,
effectivePeriods,
} = databaseObject;

return {
Expand All @@ -65,6 +67,7 @@ class QcFlagAdapter {
createdAt: createdAt ? new Date(createdAt).getTime() : null,
updatedAt: createdAt ? new Date(updatedAt).getTime() : null,
verifications: (verifications ?? []).map(this.qcFlagVerificationAdapter.toEntity),
effectivePeriods: (effectivePeriods ?? []).map(this.qcFlagEffectivePeriodAdapter.toEntity),
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
class BarChartClassComponent {
/**
* Constructor
* @param {{attrs: {points: Point[], configuration: BarChartComponentConfiguration}}} vnode the component's vnode
* @param {{attrs: {data: Bar[], configuration: BarChartComponentConfiguration}}} vnode the component's vnode
*/
constructor({
attrs: {
points,
data,
configuration,
},
}) {
this._chartRenderer = new BarChartRenderer(configuration.chartConfiguration, points);
this._chartRenderer = new BarChartRenderer(configuration.chartConfiguration, data);

Check warning on line 37 in lib/public/components/common/chart/barChart/barChartComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/barChart/barChartComponent.js#L37

Added line #L37 was not covered by tests
}

/**
Expand Down Expand Up @@ -69,10 +69,10 @@
/**
* Render a line chart component
*
* @param {Point[]} points the points to display
* @param {Bar[]} bars the points to display
* @param {BarChartComponentConfiguration} configuration the configuration of the component
* @return {Component} the resulting component
*/
export const barChartComponent = (points, configuration) => points.length
? h(BarChartClassComponent, { points, configuration })
export const barChartComponent = (bars, configuration) => bars.length
? h(BarChartClassComponent, { data: bars, configuration })

Check warning on line 77 in lib/public/components/common/chart/barChart/barChartComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/barChart/barChartComponent.js#L76-L77

Added lines #L76 - L77 were not covered by tests
: h('.w-100.h-100.flex-row.items-center.justify-center', h('', configuration.placeholder || 'No data'));
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
class LineChartClassComponent {
/**
* Constructor
* @param {{attrs: {points: Point[], configuration: LineChartComponentConfiguration}}} the component's vnode
* @param {{attrs: {data: Point[], configuration: LineChartComponentConfiguration}}} the component's vnode
*/
constructor({ attrs: { points, configuration } }) {
constructor({ attrs: { data, configuration } }) {

Check warning on line 43 in lib/public/components/common/chart/lineChart/lineChartComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/lineChart/lineChartComponent.js#L43

Added line #L43 was not covered by tests
this.configuration = configuration;
this.tooltipElement = null;
this.hoveredPointCoordinates = null;
Expand All @@ -52,7 +52,7 @@

this.updateHoveredPoint = this.updateHoveredPoint.bind(this);
this.handleMouseMove = this.handleMouseMove.bind(this);
this._chartRenderer = new LineChartRenderer(configuration.chartConfiguration, points);
this._chartRenderer = new LineChartRenderer(configuration.chartConfiguration, data);

Check warning on line 55 in lib/public/components/common/chart/lineChart/lineChartComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/lineChart/lineChartComponent.js#L55

Added line #L55 was not covered by tests
this.svgNode = null;
}

Expand All @@ -62,10 +62,10 @@
}

// eslint-disable-next-line require-jsdoc
onupdate({ attrs: { points, configuration } }) {
onupdate({ attrs: { data, configuration } }) {

Check warning on line 65 in lib/public/components/common/chart/lineChart/lineChartComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/lineChart/lineChartComponent.js#L65

Added line #L65 was not covered by tests
this.configuration = configuration;

this._chartRenderer = new LineChartRenderer(configuration.chartConfiguration, points);
this._chartRenderer = new LineChartRenderer(configuration.chartConfiguration, data);

Check warning on line 68 in lib/public/components/common/chart/lineChart/lineChartComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/lineChart/lineChartComponent.js#L68

Added line #L68 was not covered by tests
}

// eslint-disable-next-line require-jsdoc
Expand Down Expand Up @@ -221,5 +221,5 @@
* @return {Component} the resulting component
*/
export const lineChartComponent = (points, configuration) => points.length
? h(LineChartClassComponent, { points, configuration })
? h(LineChartClassComponent, { data: points, configuration })

Check warning on line 224 in lib/public/components/common/chart/lineChart/lineChartComponent.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/lineChart/lineChartComponent.js#L224

Added line #L224 was not covered by tests
: h('.w-100.h-100.flex-row.items-center.justify-center', h('', configuration.placeholder || 'No data'));
89 changes: 75 additions & 14 deletions lib/public/components/common/chart/rendering/BarChartRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,97 @@
* Constructor
*
* @param {BarChartConfiguration} configuration the chart configuration
* @param {Point[]} points the points to render
* @param {Bar[]} data the bars to render
*/
constructor(configuration, points) {
super(configuration, points);
constructor(configuration, data) {
super(configuration, data);

Check warning on line 37 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L36-L37

Added lines #L36 - L37 were not covered by tests

if (this._stackedY) {
if (this._stackedDependent) {

Check warning on line 39 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L39

Added line #L39 was not covered by tests
throw new Error('Bar chart not implemented for stacked values');
}

/**
* Get bar length - size along axis of dependnet variable
* @param {Bar} bar bar
* @return {number} bar length
*/
const getBarLength = ({ x, y }) => {
if (this._independentVariable === 'x') {
if (Array.isArray(y)) {
throw new Error('Range and stacked bars not implemented for independent variable \'x\'');

Check warning on line 51 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L48-L51

Added lines #L48 - L51 were not covered by tests
}
return this._chartDrawingZone.top + this._chartDrawingZone.height - this.yScale(y);
} else if (Array.isArray(x)) { // (this._independentVariable === 'y')
if (!this._stackedDependent) {
if (x.length === 2) {
return this.xScale(x[1]) - this.xScale(x[0]);
} else {
throw new Error('For range bars you need to provide array of two numbers');

Check warning on line 59 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L53-L59

Added lines #L53 - L59 were not covered by tests
}
} else {
throw new Error('Bar chart not implemented for stacked values');

Check warning on line 62 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L61-L62

Added lines #L61 - L62 were not covered by tests
}
} else {
return this.xScale(x);

Check warning on line 65 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L64-L65

Added lines #L64 - L65 were not covered by tests
}
};

/**
* Get bars thickness - size along axis of independnet variable
* @return {number} thickness of bars
*/
const getBarThickness = () => this.independentVariableScale.bandwidth();

Check warning on line 73 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L73

Added line #L73 was not covered by tests

/**
* @type {BarPropertiesProvider}
*/
this._barPropertiesProvider = {
getX: ({ x }) => {
if (this._independentVariable === 'x') {
return this.xScale(x);
} else if (Array.isArray(x)) { // (this._independentVariable === 'y')
if (!this._stackedDependent) {
if (x.length === 2) {
return this.xScale(x[0]);
} else {
throw new Error('For range bars you need to provide array of two numbers');

Check warning on line 87 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L78-L87

Added lines #L78 - L87 were not covered by tests
}
} else {
throw new Error('Bar chart not implemented for stacked values');

Check warning on line 90 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L89-L90

Added lines #L89 - L90 were not covered by tests
}
} else {
return this._chartDrawingZone.left;

Check warning on line 93 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L92-L93

Added lines #L92 - L93 were not covered by tests
}
},
getY: ({ y }) => {
if (this._independentVariable === 'x') {
if (Array.isArray(y)) {
throw new Error('Range and stacked bars not implemented for independent variable \'x\'');

Check warning on line 99 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L96-L99

Added lines #L96 - L99 were not covered by tests
}
}
return this.yScale(y);

Check warning on line 102 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L102

Added line #L102 was not covered by tests
},
getWidth: this._independentVariable === 'x' // Size along x-axis
? getBarThickness
: getBarLength,

Check warning on line 106 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L105-L106

Added lines #L105 - L106 were not covered by tests
getHeight: this._independentVariable === 'x' // Size along y-axis
? getBarLength
: getBarThickness,

Check warning on line 109 in lib/public/components/common/chart/rendering/BarChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/BarChartRenderer.js#L108-L109

Added lines #L108 - L109 were not covered by tests
};
}

// eslint-disable-next-line valid-jsdoc
/**
* @inheritDoc
*/
renderDataset(datasetIndex, svg) {
/** @type {PointLocator} */
const pointLocator = {
getX: ({ x }) => this.xScale(x),
getY: ({ y }) => this.yScale(y),
};

const { bar: barConfiguration } = this._datasets[datasetIndex] || {};

// Display datasets
renderDatasetAsBars(
svg,
this._points,
this.xScale.bandwidth(),
this._chartDrawingZone,
pointLocator,
this._data,
this._barPropertiesProvider,
barConfiguration,
);
}
Expand Down
78 changes: 56 additions & 22 deletions lib/public/components/common/chart/rendering/ChartRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,33 @@
* @template T
*
* @param {ChartConfiguration<T>} configuration the chart's configuration
* @param {(Point[])} points the data to draw. If datasets configuration is an array, each point is expected to have an array as y value,
* one per dataset
* @param {(DrawableData[])} data the data to draw.
* If datasets configuration is an array:
* - and if independent variable is 'x' then each point is expected to have an array as y value, one per dataset
* - and if independent variable is 'y', 'x' must contain an array in the same manner
*/
constructor(configuration, points) {
if (!points.length) {
throw new Error('The points list can not be empty');
constructor(configuration, data) {
if (!data.length) {
throw new Error('The data list can not be empty');

Check warning on line 61 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L59-L61

Added lines #L59 - L61 were not covered by tests
}
this._data = data;

Check warning on line 63 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L63

Added line #L63 was not covered by tests

const {
chartMargins: configurationChartMargins = {},
forceZero = false,
axis = {},
independentVariable = 'x',
renderGrid = true,

Check warning on line 70 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L69-L70

Added lines #L69 - L70 were not covered by tests
datasets: configurationDatasets = {},
} = configuration;

if (independentVariable !== 'x' && independentVariable !== 'y') {
throw new Error(`Independent variable can be only 'x' or 'y', it cannot be '${this._independentVariable}'`);

Check warning on line 75 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L74-L75

Added lines #L74 - L75 were not covered by tests
}
this._independentVariable = independentVariable;

Check warning on line 77 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L77

Added line #L77 was not covered by tests

this._renderGrid = renderGrid;

Check warning on line 79 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L79

Added line #L79 was not covered by tests

// Configuration

this._chartMargins = {
Expand All @@ -76,9 +88,8 @@
};

this._forceZero = forceZero;
this._stackedY = Array.isArray(configurationDatasets);

this._datasets = this._stackedY ? configurationDatasets : [configurationDatasets];
this._stackedDependent = Array.isArray(configurationDatasets);
this._datasets = this._stackedDependent ? configurationDatasets : [configurationDatasets];

Check warning on line 92 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L91-L92

Added lines #L91 - L92 were not covered by tests

this._axis = axis;

Expand All @@ -94,27 +105,39 @@
height: 0,
};

this._points = points;
const dependentVariable = this._independentVariable === 'x' ? 'y' : 'x';

Check warning on line 108 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L108

Added line #L108 was not covered by tests
const { [dependentVariable]: {
min: dependetnVarMin,
max: dependentVarMax,
} } = this.getAxisConfiguration();

Check warning on line 112 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L112

Added line #L112 was not covered by tests

const { y: { min: yMin, max: yMax } } = this.getAxisConfiguration();
this._xAxisScaleFactory = new EnumerableBasedScaleFactory({ point: this.isPoint });
const yAxisScaleFactoryConfiguration = { forceRange: { min: yMin, max: yMax } };
const independentAxisScaleFactory = new EnumerableBasedScaleFactory({ point: this.isPoint });
const dependentAxisScaleFactoryConfiguration = { forceRange: { min: dependetnVarMin, max: dependentVarMax } };

Check warning on line 115 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L114-L115

Added lines #L114 - L115 were not covered by tests
if (this._forceZero) {
yAxisScaleFactoryConfiguration.minimalRange = { min: 0, max: 0 };
dependentAxisScaleFactoryConfiguration.minimalRange = { min: 0, max: 0 };

Check warning on line 117 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L117

Added line #L117 was not covered by tests
}
this._yAxisScaleFactory = new RangeBasedScaleFactory(yAxisScaleFactoryConfiguration);
const dependantAxisScaleFactory = new RangeBasedScaleFactory(dependentAxisScaleFactoryConfiguration);

Check warning on line 119 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L119

Added line #L119 was not covered by tests

for (const point of points) {
this._xAxisScaleFactory.processValue?.(point.x);
if (this._stackedY) {
for (const value of point.y) {
this._yAxisScaleFactory.processValue?.(value);
for (const point of data) {
independentAxisScaleFactory.processValue?.(point[independentVariable]);

Check warning on line 122 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L121-L122

Added lines #L121 - L122 were not covered by tests

if (Array.isArray(point[dependentVariable])) {
for (const value of point[dependentVariable]) {
dependantAxisScaleFactory.processValue?.(value);

Check warning on line 126 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L124-L126

Added lines #L124 - L126 were not covered by tests
}
} else {
this._yAxisScaleFactory.processValue?.(point.y);
dependantAxisScaleFactory.processValue?.(point[dependentVariable]);

Check warning on line 129 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L129

Added line #L129 was not covered by tests
}
}

if (independentVariable === 'x') {
this._xAxisScaleFactory = independentAxisScaleFactory;
this._yAxisScaleFactory = dependantAxisScaleFactory;
} else {
this._xAxisScaleFactory = dependantAxisScaleFactory;
this._yAxisScaleFactory = independentAxisScaleFactory;

Check warning on line 138 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L133-L138

Added lines #L133 - L138 were not covered by tests
}

this._refreshScales();
}

Expand Down Expand Up @@ -178,7 +201,9 @@
yAxisRenderer.render(this.yScale, this._chartDrawingZone);

// Render the horizontal grid
renderHorizontalGrid(yAxisRenderer.getCurrentAxis(), this._chartDrawingZone.width);
if (this._renderGrid) {
renderHorizontalGrid(yAxisRenderer.getCurrentAxis(), this._chartDrawingZone.width);

Check warning on line 205 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L204-L205

Added lines #L204 - L205 were not covered by tests
}

this.registerEvents(svg);
}
Expand Down Expand Up @@ -216,7 +241,7 @@
}

/**
* States if the points are rendered as points or bars
* States if the data are rendered as points or bars
* @return {boolean} true if points
*/
get isPoint() {
Expand Down Expand Up @@ -272,6 +297,15 @@
return this._yScale;
}

/**
* Returns the current independent-variable-axis scale
*
* @return {d3.AxisScale} the scale
*/
get independentVariableScale() {
return this._independentVariable === 'x' ? this._xScale : this._yScale;

Check warning on line 306 in lib/public/components/common/chart/rendering/ChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/ChartRenderer.js#L305-L306

Added lines #L305 - L306 were not covered by tests
}

/**
* Recompute the scales with the current chart drawing zone
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
*/
constructor(configuration, points) {
super(configuration, points);
if (this._independentVariable !== 'x') {
throw new Error('LiceChartRendered only supports \'x\' as independent variable');

Check warning on line 49 in lib/public/components/common/chart/rendering/LineChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/LineChartRenderer.js#L48-L49

Added lines #L48 - L49 were not covered by tests
}

this._pointHoverMargin = configuration.pointHoverMargin || DEFAULT_POINT_HOVER_MARGIN;
this._computeHoveredPoint = new Array(this._datasets.length).fill(0);
Expand All @@ -66,14 +69,14 @@
/** @type {PointLocator} */
const pointLocator = {
getX: ({ x }) => this.xScale(x),
getY: this._stackedY ? ({ y }) => this.yScale(y[datasetIndex]) : ({ y }) => this.yScale(y),
getY: this._stackedDependent ? ({ y }) => this.yScale(y[datasetIndex]) : ({ y }) => this.yScale(y),

Check warning on line 72 in lib/public/components/common/chart/rendering/LineChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/LineChartRenderer.js#L72

Added line #L72 was not covered by tests
};

const { line: lineConfiguration, point: pointConfiguration, legend: legendConfiguration } = this._datasets[datasetIndex] || {};

// Display datasets

const points = this._points.filter((point) => (pointLocator.getY(point) ?? null) !== null);
const points = this._data.filter((point) => (pointLocator.getY(point) ?? null) !== null);

Check warning on line 79 in lib/public/components/common/chart/rendering/LineChartRenderer.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/common/chart/rendering/LineChartRenderer.js#L79

Added line #L79 was not covered by tests

// Display line
if (lineConfiguration) {
Expand All @@ -99,7 +102,7 @@
const datasetQuadtree = quadtree()
.x(pointLocator.getX)
.y(pointLocator.getY)
.addAll(this._points);
.addAll(this._data);

/**
* Compute the point hovered by the mouse and call the onPointHover function accordingly
Expand Down
Loading
Loading