Commit d5b98048 authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

Merge branch 'wip_scatter-plot-2' into 'master'

Update scatter plot chart

Improve logic for drawing scatter plot chart

See merge request !2
parents f6f1d4ad 08df8dd6
This diff is collapsed.
...@@ -7,14 +7,14 @@ import { ...@@ -7,14 +7,14 @@ import {
getDatastreamUrl, getDatastreamUrl,
getObservationsUrl, getObservationsUrl,
axiosGetRequest, axiosGetRequest,
getDatastreamMetadata, getMetadataFromSingleDatastream,
formatDatastreamMetadataForChart, formatDatastreamMetadataForChart,
formatSTAResponseForHeatMap, formatSTAResponseForHeatMap,
drawHeatMapHC, drawHeatMapHC,
formatSTAResponseForLineChart, formatSTAResponseForLineChartOrScatterPlot,
drawLineChartHC, drawLineChartHC,
getCombinedObservationsFromAllNextLinks, getCombinedObservationsFromAllNextLinks,
getMetadataPlusObservationsForChart, getMetadataPlusObservationsFromSingleDatastream,
} from "./appChart.js"; } from "./appChart.js";
const buildingsAvailableSensorsArr = [ const buildingsAvailableSensorsArr = [
...@@ -289,13 +289,15 @@ const selectChartTypeFromDropDown = async function () { ...@@ -289,13 +289,15 @@ const selectChartTypeFromDropDown = async function () {
const URL_OBSERVATIONS = getObservationsUrl(BASE_URL, selectedDatastream); const URL_OBSERVATIONS = getObservationsUrl(BASE_URL, selectedDatastream);
// Create promises // Create promises
const promiseDatastreamMetadata = getDatastreamMetadata(URL_DATASTREAM); const promiseDatastreamMetadata =
getMetadataFromSingleDatastream(URL_DATASTREAM);
const promiseCombinedObservations = getCombinedObservationsFromAllNextLinks( const promiseCombinedObservations = getCombinedObservationsFromAllNextLinks(
axiosGetRequest(URL_OBSERVATIONS, QUERY_PARAMS_COMBINED) axiosGetRequest(URL_OBSERVATIONS, QUERY_PARAMS_COMBINED)
); );
// Pass promises to our async function // Pass promises to our async function
const metadataPlusObservations = await getMetadataPlusObservationsForChart([ const metadataPlusObservations =
await getMetadataPlusObservationsFromSingleDatastream([
promiseCombinedObservations, promiseCombinedObservations,
promiseDatastreamMetadata, promiseDatastreamMetadata,
]); ]);
...@@ -306,7 +308,7 @@ const selectChartTypeFromDropDown = async function () { ...@@ -306,7 +308,7 @@ const selectChartTypeFromDropDown = async function () {
if (selectedChartType === "Line") { if (selectedChartType === "Line") {
drawLineChartHC( drawLineChartHC(
formatSTAResponseForLineChart(combinedObs), formatSTAResponseForLineChartOrScatterPlot(combinedObs),
formatDatastreamMetadataForChart(datastreamMetadata) formatDatastreamMetadataForChart(datastreamMetadata)
); );
} else if (selectedChartType === "Heatmap") { } else if (selectedChartType === "Heatmap") {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment