more beautiful chart
Gitea Actions Demo / build_and_push (push) Has been cancelled Details

This commit is contained in:
artem 2024-11-03 07:47:12 +03:00
parent f001054b72
commit fe4b037d0c
2 changed files with 36 additions and 12 deletions

View File

@ -11,8 +11,8 @@ import axios from 'axios';
import { AxiosResponse } from "axios";
import { createYmaps } from 'vue-yandex-maps';
const HOST = "https://cycle-rider.ru";
// const HOST = "http://localhost:8000";
// const HOST = "https://cycle-rider.ru";
const HOST = "http://localhost:8000";
axios.defaults.baseURL = HOST;

View File

@ -26,7 +26,8 @@
}"
/>
</yandex-map>
<LineWithLineChart id="my-chart-id" :options="chartOptions" :data="data" />
<!-- @vue-ignore -->
<LineWithLineChart id="my-chart-id" :options="chartOptions" :data="data" />
</template>
<script setup lang="ts">
import { useRoute } from 'vue-router'
@ -131,17 +132,40 @@ const chartOptions ={
}
},
plugins: {
zoom: {
tooltip: {
enabled: true,
intersect: false,
footerMarginTop: 10,
displayColors: false,
callbacks: {
label: function(context: any) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
if (context.parsed.x !== null) {
console.log(typeof context)
label += new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(context.parsed.y);
}
return ["Скорость: " + data.value.datasets[0].data[context.dataIndex],
"Пульс: " + data.value.datasets[1].data[context.dataIndex],
"Мощность: " + data.value.datasets[2].data[context.dataIndex],
];
}
}
},
zoom: {
drag: {
enabled: true,
},
pinch: {
enabled: true
},
mode: 'x',
zoom: {
drag: {
enabled: true,
},
pinch: {
enabled: true
},
mode: 'x',
}
}
}
}
}
const msToKmh = (ms: number) => ms * 3.6;