mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-20 18:21:21 +00:00
More layout stuff
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "DataConverter",
|
||||
@@ -24,6 +20,64 @@
|
||||
this.newDataSet.count = this.newDataSet.datasets.length;
|
||||
return this.newDataSet;
|
||||
},
|
||||
|
||||
colorizeData(dataSet) {
|
||||
this.dataSet = dataSet;
|
||||
this.newDataSet = {
|
||||
count: 0,
|
||||
labels: [],
|
||||
datasets: []
|
||||
};
|
||||
// colors
|
||||
let colourSet = [
|
||||
[53, 124, 165],
|
||||
[0, 141, 76], // green
|
||||
[219, 139, 11],
|
||||
[202, 25, 90], // paars rood-ish #CA195A
|
||||
[85, 82, 153],
|
||||
[66, 133, 244],
|
||||
[219, 68, 55], // red #DB4437
|
||||
[244, 180, 0],
|
||||
[15, 157, 88],
|
||||
[171, 71, 188],
|
||||
[0, 172, 193],
|
||||
[255, 112, 67],
|
||||
[158, 157, 36],
|
||||
[92, 107, 192],
|
||||
[240, 98, 146],
|
||||
[0, 121, 107],
|
||||
[194, 24, 91]
|
||||
];
|
||||
|
||||
let fillColors = [];
|
||||
//let strokePointHighColors = [];
|
||||
|
||||
|
||||
for (let i = 0; i < colourSet.length; i++) {
|
||||
fillColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.5)");
|
||||
//strokePointHighColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.9)");
|
||||
}
|
||||
this.newDataSet.labels = this.dataSet.labels;
|
||||
this.newDataSet.count = this.dataSet.count;
|
||||
for (let setKey in this.dataSet.datasets) {
|
||||
if (this.dataSet.datasets.hasOwnProperty(setKey)) {
|
||||
var dataset = this.dataSet.datasets[setKey];
|
||||
dataset.fill = false;
|
||||
dataset.backgroundColor = dataset.borderColor = fillColors[setKey];
|
||||
this.newDataSet.datasets.push(dataset);
|
||||
}
|
||||
}
|
||||
return this.newDataSet;
|
||||
},
|
||||
convertLabelsToDate(dataSet) {
|
||||
for (let labelKey in dataSet.labels) {
|
||||
if (dataSet.labels.hasOwnProperty(labelKey)) {
|
||||
const unixTimeZero = Date.parse(dataSet.labels[labelKey]);
|
||||
dataSet.labels[labelKey] = new Intl.DateTimeFormat(window.localeValue).format(unixTimeZero);
|
||||
}
|
||||
}
|
||||
return dataSet;
|
||||
},
|
||||
getLabels() {
|
||||
let firstSet = this.dataSet[0];
|
||||
for (const entryLabel in firstSet.entries) {
|
||||
@@ -40,6 +94,7 @@
|
||||
newSet.label = oldSet.label;
|
||||
newSet.type = oldSet.type;
|
||||
newSet.currency_symbol = oldSet.currency_symbol;
|
||||
newSet.currency_code = oldSet.currency_code;
|
||||
newSet.yAxisID = oldSet.yAxisID;
|
||||
newSet.data = [];
|
||||
for (const entryLabel in oldSet.entries) {
|
||||
@@ -54,7 +109,3 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user