This commit is contained in:
2022-03-01 23:29:06 +00:00
parent fee9961785
commit d50a44d30a
4 changed files with 31 additions and 52 deletions

View File

@@ -74,13 +74,6 @@
v-model="localSettings.customTitle"
:label="$ay.t('Name')"
></v-text-field>
<v-color-picker
v-model="localSettings.color"
hide-mode-switch
hide-inputs
mode="hexa"
></v-color-picker>
</v-card-text>
<v-divider></v-divider>
@@ -134,7 +127,8 @@ export default {
},
gridLines: {
drawOnChartArea: false
}
},
offset: true
}
],
yAxes: [
@@ -154,35 +148,20 @@ export default {
computed: {
chartData() {
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);
// }
let userData = this.obj.filter(d => d.z == m.userid);
if (userData.length > 0) {
ret.push({
label: m.name,
backgroundColor: m.uicolor,
data: userData.map(d => {
return { x: d.x, y: d.y };
})
});
}
});
console.log(JSON.stringify({ datasets: ret }));
return { datasets: ret };
// datasets: [
// {
// label: "usernamehere",
// backgroundColor: this.settings.color ?? "#000000",
// data: this.obj
// }
// ]
}
},
async created() {

View File

@@ -77,13 +77,6 @@
v-model="localSettings.customTitle"
:label="$ay.t('Name')"
></v-text-field>
<v-color-picker
v-model="localSettings.color"
hide-mode-switch
hide-inputs
mode="hexa"
></v-color-picker>
</v-card-text>
<v-divider></v-divider>
@@ -118,6 +111,7 @@ export default {
data() {
return {
obj: {},
meta: [],
visible: true,
context: false,
localSettings: {},
@@ -128,7 +122,6 @@ export default {
chartOptions: {
responsive: true,
maintainAspectRatio: false,
// legend: { display: false },
scales: {
xAxes: [
{
@@ -157,19 +150,25 @@ export default {
},
computed: {
chartData() {
return {
datasets: [
{
label: "UserNameHere",
borderColor: this.settings.color ?? "#000000",
let ret = [];
this.meta.forEach(m => {
let userData = this.obj.filter(d => d.z == m.userid);
if (userData.length > 0) {
ret.push({
label: m.name,
borderColor: m.uicolor,
fill: false,
pointRadius: 2,
pointHoverRadius: 6,
pointHitRadius: 3,
data: this.obj
}
]
};
data: userData.map(d => {
return { x: d.x, y: d.y };
})
});
}
});
//console.log(JSON.stringify({ datasets: ret }));
return { datasets: ret };
}
},
async created() {
@@ -225,6 +224,7 @@ export default {
timeZone: this.timeZoneName
});
});
this.meta = res.meta;
this.obj = res.data;
}
} catch (error) {

View File

@@ -119,7 +119,8 @@ export default {
},
gridLines: {
drawOnChartArea: false
}
},
offset: true
}
],
yAxes: [

View File

@@ -115,7 +115,6 @@ export default {
chartOptions: {
responsive: true,
maintainAspectRatio: false,
// legend: { display: false },
scales: {
xAxes: [
{