mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-17 20:52:14 +01:00
unify and fix chart styles in dashboard and reporting view, fixes ST-356
This commit is contained in:
@@ -40,11 +40,11 @@ const groupChartData = computed(() => {
|
|||||||
const name = getNameForReportingRowEntry(entry.key, props.type);
|
const name = getNameForReportingRowEntry(entry.key, props.type);
|
||||||
let color = getRandomColorWithSeed(entry.key ?? 'none');
|
let color = getRandomColorWithSeed(entry.key ?? 'none');
|
||||||
if (name && props.type && emptyPlaceholder[props.type] === name) {
|
if (name && props.type && emptyPlaceholder[props.type] === name) {
|
||||||
color = '#CCC';
|
color = '#CCCCCC';
|
||||||
} else if (props.type === 'project') {
|
} else if (props.type === 'project') {
|
||||||
color =
|
color =
|
||||||
projects.find((project) => project.id === entry.key)
|
projects.find((project) => project.id === entry.key)
|
||||||
?.color ?? '#CCC';
|
?.color ?? '#CCCCCC';
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
value: entry.seconds,
|
value: entry.seconds,
|
||||||
@@ -61,7 +61,12 @@ const seriesData = computed(() => {
|
|||||||
...el,
|
...el,
|
||||||
...{
|
...{
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: el.color,
|
color: `${el.color}BB`,
|
||||||
|
},
|
||||||
|
emphasis: {
|
||||||
|
itemStyle: {
|
||||||
|
color: `${el.color}`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -88,7 +93,7 @@ const option = ref({
|
|||||||
},
|
},
|
||||||
data: seriesData,
|
data: seriesData,
|
||||||
radius: ['30%', '60%'],
|
radius: ['30%', '60%'],
|
||||||
top: '-50%',
|
top: '-45%',
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -97,7 +102,7 @@ const option = ref({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-chart
|
<v-chart
|
||||||
class="background-transparent h-[450px]"
|
class="background-transparent h-[460px]"
|
||||||
:autoresize="true"
|
:autoresize="true"
|
||||||
:option="option" />
|
:option="option" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import VChart, { THEME_KEY } from 'vue-echarts';
|
import VChart, { THEME_KEY } from 'vue-echarts';
|
||||||
import { provide, ref } from 'vue';
|
import { provide, ref } from 'vue';
|
||||||
import LinearGradient from 'zrender/lib/graphic/LinearGradient';
|
|
||||||
import { use } from 'echarts/core';
|
import { use } from 'echarts/core';
|
||||||
import { CanvasRenderer } from 'echarts/renderers';
|
import { CanvasRenderer } from 'echarts/renderers';
|
||||||
import { PieChart } from 'echarts/charts';
|
import { PieChart } from 'echarts/charts';
|
||||||
@@ -24,28 +23,6 @@ use([
|
|||||||
|
|
||||||
provide(THEME_KEY, 'dark');
|
provide(THEME_KEY, 'dark');
|
||||||
|
|
||||||
function hexToRGBA(hex: string, opacity = 1) {
|
|
||||||
// Remove the hash at the start if it's there
|
|
||||||
hex = hex.replace(/^#/, '');
|
|
||||||
|
|
||||||
// Parse the hex color
|
|
||||||
let r, g, b;
|
|
||||||
if (hex.length === 3) {
|
|
||||||
r = parseInt(hex.charAt(0) + hex.charAt(0), 16);
|
|
||||||
g = parseInt(hex.charAt(1) + hex.charAt(1), 16);
|
|
||||||
b = parseInt(hex.charAt(2) + hex.charAt(2), 16);
|
|
||||||
} else if (hex.length === 6) {
|
|
||||||
r = parseInt(hex.substring(0, 2), 16);
|
|
||||||
g = parseInt(hex.substring(2, 4), 16);
|
|
||||||
b = parseInt(hex.substring(4, 6), 16);
|
|
||||||
} else {
|
|
||||||
throw new Error('Invalid HEX color.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the RGBA color string
|
|
||||||
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
weeklyProjectOverview: {
|
weeklyProjectOverview: {
|
||||||
value: number;
|
value: number;
|
||||||
@@ -59,16 +36,12 @@ const seriesData = props.weeklyProjectOverview.map((el) => {
|
|||||||
...el,
|
...el,
|
||||||
...{
|
...{
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: new LinearGradient(0, 0, 0, 1, [
|
color: `${el.color}BB`,
|
||||||
{
|
},
|
||||||
offset: 0,
|
emphasis: {
|
||||||
color: hexToRGBA(el.color, 0.8),
|
itemStyle: {
|
||||||
},
|
color: `${el.color}`,
|
||||||
{
|
},
|
||||||
offset: 1,
|
|
||||||
color: hexToRGBA(el.color, 0.4),
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -78,8 +51,8 @@ const option = ref({
|
|||||||
trigger: 'item',
|
trigger: 'item',
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
orient: 'vertical',
|
|
||||||
bottom: 'bottom',
|
bottom: 'bottom',
|
||||||
|
top: '250px',
|
||||||
},
|
},
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
series: [
|
series: [
|
||||||
@@ -93,7 +66,8 @@ const option = ref({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
data: seriesData,
|
data: seriesData,
|
||||||
radius: ['30%', '65%'],
|
top: '-45%',
|
||||||
|
radius: ['30%', '60%'],
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -101,12 +75,8 @@ const option = ref({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-chart class="chart" :autoresize="true" :option="option" />
|
<v-chart
|
||||||
|
class="h-[420px] bg-transparent"
|
||||||
|
:autoresize="true"
|
||||||
|
:option="option" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.chart {
|
|
||||||
height: 300px;
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ const page = usePage<{
|
|||||||
href="/billing"></NavigationSidebarItem>
|
href="/billing"></NavigationSidebarItem>
|
||||||
<NavigationSidebarItem
|
<NavigationSidebarItem
|
||||||
v-if="canUpdateOrganization()"
|
v-if="canUpdateOrganization()"
|
||||||
title="Import / Export"
|
title="Import / Export"
|
||||||
:icon="ArrowsRightLeftIcon"
|
:icon="ArrowsRightLeftIcon"
|
||||||
:current="route().current('import')"
|
:current="route().current('import')"
|
||||||
:href="route('import')"></NavigationSidebarItem>
|
:href="route('import')"></NavigationSidebarItem>
|
||||||
|
|||||||
@@ -146,7 +146,10 @@ async function createTag(tag: string) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppLayout title="Reporting" data-testid="reporting_view" class="overflow-hidden">
|
<AppLayout
|
||||||
|
title="Reporting"
|
||||||
|
data-testid="reporting_view"
|
||||||
|
class="overflow-hidden">
|
||||||
<MainContainer
|
<MainContainer
|
||||||
class="py-3 sm:py-5 border-b border-default-background-separator flex justify-between items-center">
|
class="py-3 sm:py-5 border-b border-default-background-separator flex justify-between items-center">
|
||||||
<div class="flex items-center space-x-3 sm:space-x-6">
|
<div class="flex items-center space-x-3 sm:space-x-6">
|
||||||
@@ -340,7 +343,7 @@ async function createTag(tag: string) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="px-2 lg:px-4">
|
||||||
<ReportingPieChart
|
<ReportingPieChart
|
||||||
:type="aggregatedTableTimeEntries?.grouped_type"
|
:type="aggregatedTableTimeEntries?.grouped_type"
|
||||||
:data="
|
:data="
|
||||||
|
|||||||
Reference in New Issue
Block a user