Skip to content
Snippets Groups Projects
Verified Commit 2a761e2e authored by BARBIER Marc's avatar BARBIER Marc
Browse files

fixed anomaly display and improved perofrmance

parent 6fabe75e
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ export default defineComponent({
selectedPatternSet: "",
patterns: null as Table | null,
patternsOcc: null as Table | null,
scores: null as Record<string, Table> | null,
scores: {} as Record<string, Table>,
showedColumns: [] as number[],
chartScale: [] as Array<string | number>,
chartData: [] as ChartElement[],
......@@ -62,12 +62,12 @@ export default defineComponent({
this.loadAnomalyScores()
},
scores() {
selectedColumns() {
this.generateChartData()
},
selectedColumns() {
this.generateChartData()
selectedAnomalyPatterns() {
this.loadAnomalyScores()
},
async slider() {
......@@ -126,16 +126,16 @@ export default defineComponent({
const scores = this.fileItem?.scores.filter(e => this.selectedAnomalyPatterns.includes(e.label))
if(!scores || !scores.length) {
this.scores = {}
return
}
const item = {} as Record<string, Table>
for(const score of scores) {
item[score.label] = await (await secureFetch(this, `http://localhost:8080/rest/load-anomaly-score?filename=${score.filename}&id=${localStorage.getItem('datasetId')}`)).json()
} else {
for(const score of scores) {
//don't load twice the same data
if(!this.scores[score.label]) {
this.scores[score.label] = await (await secureFetch(this, `http://localhost:8080/rest/load-anomaly-score?filename=${score.filename}&id=${localStorage.getItem('datasetId')}`)).json()
}
}
}
this.scores = item
this.generateChartData()
},
async generateChartBackground(chartData: ChartElement[], dataset: Table) {
......@@ -179,6 +179,7 @@ export default defineComponent({
const windows = this.extractColumn(dataset, this.columnId('Window')).map(e => parseFloat(e))
if(scores) {
for(const patternScore of this.selectedAnomalyPatterns) {
console.log(Object.keys(scores))
const visibleScore = scores[patternScore].rowsStartingFrom1.filter(e => windows.includes(parseFloat(e[0])))
chartData.push({
type: 'SelfScaledLine',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment