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

View File

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

View File

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

View File

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