preloader, point marker
Gitea Actions Demo / build_and_push (push) Successful in 1m30s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m30s
Details
This commit is contained in:
parent
ef8dc5ce91
commit
72790a5753
|
|
@ -20,6 +20,9 @@
|
||||||
stroke: [{ color: '#007afce6', width: 4 }],
|
stroke: [{ color: '#007afce6', width: 4 }],
|
||||||
},
|
},
|
||||||
}" />
|
}" />
|
||||||
|
<yandex-map-default-marker v-if="currentCoordinates" :settings="{
|
||||||
|
coordinates: currentCoordinates,
|
||||||
|
}" />
|
||||||
</yandex-map>
|
</yandex-map>
|
||||||
</div>
|
</div>
|
||||||
<div id="workout-short-data">
|
<div id="workout-short-data">
|
||||||
|
|
@ -63,7 +66,15 @@
|
||||||
<VaZoomOut />
|
<VaZoomOut />
|
||||||
</VaButton>
|
</VaButton>
|
||||||
<!-- @vue-ignore -->
|
<!-- @vue-ignore -->
|
||||||
<LineWithLineChart id="chart" ref="chart" :options="chartOptions" :data="data" />
|
<LineWithLineChart
|
||||||
|
id="chart"
|
||||||
|
ref="chart"
|
||||||
|
:options="chartOptions"
|
||||||
|
:plugins="chartPlugins"
|
||||||
|
:data="data"
|
||||||
|
pointerAxies="currentCoordinates"
|
||||||
|
>
|
||||||
|
</LineWithLineChart>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<VaInnerLoading
|
<VaInnerLoading
|
||||||
|
|
@ -97,14 +108,15 @@ import {
|
||||||
} from 'chart.js'
|
} from 'chart.js'
|
||||||
import LineWithLineChart from './components/LineWithLineChart.js'
|
import LineWithLineChart from './components/LineWithLineChart.js'
|
||||||
import type { YMap } from '@yandex/ymaps3-types';
|
import type { YMap } from '@yandex/ymaps3-types';
|
||||||
import { YandexMap, YandexMapDefaultSchemeLayer, YandexMapFeature, YandexMapDefaultFeaturesLayer } from 'vue-yandex-maps';
|
import { YandexMap, YandexMapDefaultSchemeLayer, YandexMapFeature, YandexMapDefaultFeaturesLayer, YandexMapDefaultMarker } from 'vue-yandex-maps';
|
||||||
import { WorkoutItem, Attachment, secondsToDuration, distConvert, speedConvert } from "./Definitions.vue";
|
import { WorkoutItem, distConvert, speedConvert } from "./Definitions.vue";
|
||||||
|
|
||||||
//Можно использовать для различных преобразований
|
//Можно использовать для различных преобразований
|
||||||
const map = shallowRef<null | YMap>(null);
|
const map = shallowRef<null | YMap>(null);
|
||||||
const chart = ref();
|
const chart = ref();
|
||||||
let mapCenter = ref<Array<number>>([37.617644, 55.755819]);
|
let mapCenter = ref<Array<number>>([37.617644, 55.755819]);
|
||||||
let lineCoordinates = ref<Array<Array<number>>>([]);
|
let lineCoordinates = ref<Array<Array<number>>>([]);
|
||||||
|
let currentCoordinates = ref<Array<number> | null>([]);
|
||||||
ChartJS.register(
|
ChartJS.register(
|
||||||
Title,
|
Title,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
|
|
@ -118,7 +130,6 @@ ChartJS.register(
|
||||||
TimeScale
|
TimeScale
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
const { init } = useToast();
|
const { init } = useToast();
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
|
|
@ -133,11 +144,27 @@ type ChartData = {
|
||||||
"labels": Array<string>,
|
"labels": Array<string>,
|
||||||
"datasets": Array<ChartDataset>,
|
"datasets": Array<ChartDataset>,
|
||||||
}
|
}
|
||||||
|
type afterEventEvent = {
|
||||||
|
"type": string
|
||||||
|
}
|
||||||
|
type afterEventArgs = {
|
||||||
|
"event": afterEventEvent,
|
||||||
|
}
|
||||||
let workoutItem = ref<WorkoutItem>();
|
let workoutItem = ref<WorkoutItem>();
|
||||||
const data = ref<ChartData>({
|
const data = ref<ChartData>({
|
||||||
labels: [],
|
labels: [],
|
||||||
datasets: [],
|
datasets: [],
|
||||||
})
|
})
|
||||||
|
const chartPlugins = [
|
||||||
|
{
|
||||||
|
id: 'eventPlugin',
|
||||||
|
afterEvent(chart: any, args: afterEventArgs, opts: any) {
|
||||||
|
if (args.event.type == "mouseout") {
|
||||||
|
currentCoordinates.value = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
const chartOptions = {
|
const chartOptions = {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
scales: {
|
scales: {
|
||||||
|
|
@ -167,13 +194,13 @@ const chartOptions = {
|
||||||
displayColors: false,
|
displayColors: false,
|
||||||
callbacks: {
|
callbacks: {
|
||||||
label: function (context: any) {
|
label: function (context: any) {
|
||||||
|
currentCoordinates.value = lineCoordinates.value[context.dataIndex];
|
||||||
let label = context.dataset.label || '';
|
let label = context.dataset.label || '';
|
||||||
|
|
||||||
if (label) {
|
if (label) {
|
||||||
label += ': ';
|
label += ': ';
|
||||||
}
|
}
|
||||||
if (context.parsed.x !== null) {
|
if (context.parsed.x !== null) {
|
||||||
console.log(typeof context)
|
|
||||||
label += new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(context.parsed.y);
|
label += new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(context.parsed.y);
|
||||||
}
|
}
|
||||||
return ["Скорость: " + data.value.datasets[0].data[context.dataIndex],
|
return ["Скорость: " + data.value.datasets[0].data[context.dataIndex],
|
||||||
|
|
@ -225,7 +252,6 @@ const initWorkout = (id: string) => {
|
||||||
longitude.push(response.data.results[i].longitude);
|
longitude.push(response.data.results[i].longitude);
|
||||||
lineCoordinates.value.push([response.data.results[i].longitude, response.data.results[i].latitude]);
|
lineCoordinates.value.push([response.data.results[i].longitude, response.data.results[i].latitude]);
|
||||||
}
|
}
|
||||||
console.log(lineCoordinates);
|
|
||||||
mapCenter.value = [longitude[0], latitude[0]];
|
mapCenter.value = [longitude[0], latitude[0]];
|
||||||
data.value = {
|
data.value = {
|
||||||
labels: times,
|
labels: times,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue