Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show two vertical profiles next to each other #708

Merged
merged 8 commits into from
Feb 29, 2024
22 changes: 19 additions & 3 deletions src/components/charts/ElevationChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,17 @@ onMounted(() => {
],
margin: {
top: 110,
left: 50,
right: 50,
left: 70,
right: 30,
bottom: 50,
},
}

const chartWidth = 800
const chartHeight = 1200

setChartConfigValues(axisOptions)

if (chartContainer.value) {
axis = new CartesianAxes(
chartContainer.value,
Expand All @@ -140,11 +143,24 @@ onMounted(() => {
axis.accept(zoom)
axis.accept(mouseOver)
resize()
if (props.config !== undefined) refreshChart()
if (props.config !== undefined) {
refreshChart()
setTags()
}
window.addEventListener('resize', resize)
}
})

const setChartConfigValues = (axisOptions: CartesianAxesOptions) => {
props.config.yAxis?.forEach((axis, i) => {
axisOptions.y[i].type = axis.type
})

props.config.xAxis?.forEach((axis, i) => {
axisOptions.x[i].type = axis.type
})
}

const addToChart = (chartSeries: ChartSeries) => {
const id = chartSeries.id
const seriesData = props.series[chartSeries.dataResources[0]]
Expand Down
2 changes: 1 addition & 1 deletion src/components/spatialdisplay/SpatialDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ onMounted(() => {
})

const hideMap = computed(() => {
return mobile.value && props.locationId
return mobile.value && (props.locationId || props.latitude || props.longitude)
})

function onLocationChange(locationId: string | null): void {
Expand Down
12 changes: 11 additions & 1 deletion src/components/timeseries/TimeSeriesComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
</v-window-item>
<v-window-item
:value="DisplayType.ElevationChart"
class="time-series-component__container scroll"
class="elevation-chart-component__container scroll"
>
<KeepAlive>
<ElevationChart
v-for="(subplot, i) in elevationChartSubplots"
:config="subplot"
:series="elevationChartSeries"
:key="`${subplot.title}-${i}`"
:style="`min-width: ${xs ? 100 : 50}%`"
>
</ElevationChart>
</KeepAlive>
Expand All @@ -64,6 +65,7 @@ import type { UseTimeSeriesOptions } from '../../services/useTimeSeries/index.ts
import { configManager } from '../../services/application-config'
import { useSystemTimeStore } from '@/stores/systemTime'
import type { TimeSeriesEvent } from '@deltares/fews-pi-requests'
import { useDisplay } from 'vuetify'

interface Props {
config?: DisplayConfig
Expand Down Expand Up @@ -98,6 +100,7 @@ const props = withDefaults(defineProps<Props>(), {

const store = useSystemTimeStore()
const lastUpdated = ref<Date>(new Date())
const { xs } = useDisplay()

const options = computed<UseTimeSeriesOptions>(() => {
return {
Expand Down Expand Up @@ -174,6 +177,13 @@ watch(
flex-direction: column;
}

.elevation-chart-component__container {
display: flex;
flex: 1 1 100%;
flex-direction: row;
overflow-x: auto;
}

.scroll {
overflow-y: auto;
}
Expand Down
9 changes: 8 additions & 1 deletion src/lib/charts/timeSeriesDisplayToChartConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,15 @@ function xAxisFromPlotItemXAxis(
const axes = []
const includeZero =
xAxis.axisMinValue === 0 && xAxis.axisMaxValue === undefined

// TODO: xAxis.axisType should instead be set in xAxis: TimeSeriesDisplaySubplotItemAxis
const isDegrees =
xAxis.axisLabel?.includes('degrees') &&
xAxis.axisMinValue === 0 &&
xAxis.axisMaxValue === 360

const axis: AxisOptions = {
type: AxisType.value,
type: isDegrees ? AxisType.degrees : AxisType.value,
label: xAxis.axisLabel,
includeZero,
}
Expand Down
Loading