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 {
getDatastreamUrl,
getObservationsUrl,
axiosGetRequest,
getDatastreamMetadata,
getMetadataFromSingleDatastream,
formatDatastreamMetadataForChart,
formatSTAResponseForHeatMap,
drawHeatMapHC,
formatSTAResponseForLineChart,
formatSTAResponseForLineChartOrScatterPlot,
drawLineChartHC,
getCombinedObservationsFromAllNextLinks,
getMetadataPlusObservationsForChart,
getMetadataPlusObservationsFromSingleDatastream,
} from "./appChart.js";
const buildingsAvailableSensorsArr = [
......@@ -289,16 +289,18 @@ const selectChartTypeFromDropDown = async function () {
const URL_OBSERVATIONS = getObservationsUrl(BASE_URL, selectedDatastream);
// Create promises
const promiseDatastreamMetadata = getDatastreamMetadata(URL_DATASTREAM);
const promiseDatastreamMetadata =
getMetadataFromSingleDatastream(URL_DATASTREAM);
const promiseCombinedObservations = getCombinedObservationsFromAllNextLinks(
axiosGetRequest(URL_OBSERVATIONS, QUERY_PARAMS_COMBINED)
);
// Pass promises to our async function
const metadataPlusObservations = await getMetadataPlusObservationsForChart([
promiseCombinedObservations,
promiseDatastreamMetadata,
]);
const metadataPlusObservations =
await getMetadataPlusObservationsFromSingleDatastream([
promiseCombinedObservations,
promiseDatastreamMetadata,
]);
// Extract the metadata and the observations from resulting array
const combinedObs = metadataPlusObservations[0];
......@@ -306,7 +308,7 @@ const selectChartTypeFromDropDown = async function () {
if (selectedChartType === "Line") {
drawLineChartHC(
formatSTAResponseForLineChart(combinedObs),
formatSTAResponseForLineChartOrScatterPlot(combinedObs),
formatDatastreamMetadataForChart(datastreamMetadata)
);
} 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