This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
>
|
||||
<template slot="main">
|
||||
<div>
|
||||
<!-- {{ chartData }} -->
|
||||
<gz-chart-bar :chart-data="chartData" :options="chartOptions" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -114,6 +115,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
obj: {},
|
||||
meta: [],
|
||||
context: false,
|
||||
localSettings: {},
|
||||
selectLists: {
|
||||
@@ -151,15 +153,36 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
chartData() {
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: "usernamehere",
|
||||
backgroundColor: this.settings.color ?? "#000000",
|
||||
data: this.obj
|
||||
}
|
||||
]
|
||||
};
|
||||
let ret = [];
|
||||
//build data sets here
|
||||
//format should be broken out by user
|
||||
//iterate data and lookup what's needed in meta for each change of data
|
||||
//or, is it the other way around, maybe iterate meta and if find in data then build dataset!!
|
||||
this.meta.forEach(m => {
|
||||
let userData=this.obj.filter(d=>d.z==m.userid);
|
||||
|
||||
if(userData.length>0){
|
||||
let item = {
|
||||
label: m.name,
|
||||
backgroundColor: m.uicolor,
|
||||
data: userData.map(d => {
|
||||
return { x: d.x, y: d.y };
|
||||
})
|
||||
};
|
||||
// }
|
||||
// if (item.data.length > 0) {
|
||||
// ret.push(item);
|
||||
// }
|
||||
});
|
||||
console.log(JSON.stringify({ datasets: ret }));
|
||||
return { datasets: ret };
|
||||
// datasets: [
|
||||
// {
|
||||
// label: "usernamehere",
|
||||
// backgroundColor: this.settings.color ?? "#000000",
|
||||
// data: this.obj
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
@@ -215,6 +238,7 @@ export default {
|
||||
timeZone: this.timeZoneName
|
||||
});
|
||||
});
|
||||
this.meta = res.meta;
|
||||
this.obj = res.data;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user