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 { AxiosResponse } from "axios";
import { createYmaps } from 'vue-yandex-maps'; import { createYmaps } from 'vue-yandex-maps';
const HOST = "https://cycle-rider.ru"; // const HOST = "https://cycle-rider.ru";
// const HOST = "http://localhost:8000"; const HOST = "http://localhost:8000";
axios.defaults.baseURL = HOST; axios.defaults.baseURL = HOST;

View File

@ -26,6 +26,7 @@
}" }"
/> />
</yandex-map> </yandex-map>
<!-- @vue-ignore -->
<LineWithLineChart id="my-chart-id" :options="chartOptions" :data="data" /> <LineWithLineChart id="my-chart-id" :options="chartOptions" :data="data" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -131,17 +132,40 @@ const chartOptions ={
} }
}, },
plugins: { 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: { zoom: {
drag: { zoom: {
enabled: true, drag: {
}, enabled: true,
pinch: { },
enabled: true pinch: {
}, enabled: true
mode: 'x', },
mode: 'x',
}
} }
}
} }
} }
const msToKmh = (ms: number) => ms * 3.6; const msToKmh = (ms: number) => ms * 3.6;