mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-18 05:02:14 +01:00
adapt new activity graph structure, add activity graph labels
This commit is contained in:
@@ -13,9 +13,10 @@ import {
|
|||||||
} from 'echarts/components';
|
} from 'echarts/components';
|
||||||
import { CanvasRenderer } from 'echarts/renderers';
|
import { CanvasRenderer } from 'echarts/renderers';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
import { formatDate, formatTime } from '@/utils/time';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
dailyHoursTracked: [string, number][];
|
dailyHoursTracked: { duration: number; date: string }[];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
use([
|
use([
|
||||||
@@ -29,7 +30,10 @@ use([
|
|||||||
|
|
||||||
provide(THEME_KEY, 'dark');
|
provide(THEME_KEY, 'dark');
|
||||||
|
|
||||||
const max = Math.max(...props.dailyHoursTracked.map((el) => el[1]));
|
const max = Math.max(
|
||||||
|
Math.max(...props.dailyHoursTracked.map((el) => el.duration)),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
const option = ref({
|
const option = ref({
|
||||||
tooltip: {},
|
tooltip: {},
|
||||||
@@ -67,10 +71,19 @@ const option = ref({
|
|||||||
series: {
|
series: {
|
||||||
type: 'heatmap',
|
type: 'heatmap',
|
||||||
coordinateSystem: 'calendar',
|
coordinateSystem: 'calendar',
|
||||||
data: props.dailyHoursTracked,
|
data: props.dailyHoursTracked.map((el) => [el.date, el.duration]),
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
},
|
},
|
||||||
|
tooltip: {
|
||||||
|
valueFormatter: (value: string, dataIndex: number) => {
|
||||||
|
return (
|
||||||
|
formatDate(props.dailyHoursTracked[dataIndex].date) +
|
||||||
|
': ' +
|
||||||
|
formatTime(value)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const props = defineProps<{
|
|||||||
duration: number; // Total duration in seconds
|
duration: number; // Total duration in seconds
|
||||||
history: number[]; // Array representing the duration in seconds of the 3h windows for the day
|
history: number[]; // Array representing the duration in seconds of the 3h windows for the day
|
||||||
}[];
|
}[];
|
||||||
dailyTrackedHours: [string, number][];
|
dailyTrackedHours: { duration: number; date: string }[];
|
||||||
weeklyProjectOverview: {
|
weeklyProjectOverview: {
|
||||||
value: number;
|
value: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user