Add plot labels and title

This commit is contained in:
Nicolò P 2023-04-20 09:50:00 +02:00
parent f0f277d0db
commit 46c8257a25
2 changed files with 9 additions and 6 deletions

View File

@ -126,8 +126,6 @@ DataSpace.renderReport = async function (report, archesJson, images)
this.getRelatedAnalysisId(archesJson) this.getRelatedAnalysisId(archesJson)
); );
console.log(this.getRelatedAnalysisId(archesJson));
container.innerHTML += await this.renderAnalysisReport( container.innerHTML += await this.renderAnalysisReport(
report.resource, report.resource,
report.displayname report.displayname
@ -155,7 +153,7 @@ DataSpace.renderAnalysisReport = async function (resource, type)
const shape = this.createShape(resource, 'Analysis'); const shape = this.createShape(resource, 'Analysis');
let html = ` let html = `
<div class="column col-12"> <div class="column col-12">
<h3 class="p-2 text-center">${type.replace(/(\w+\s\w+).*$/,"$1")}</h3> <h3 class="p-2">${type.replace(/(\w+\s\w+).*$/,"$1")}</h3>
`; `;
let table = '<table class="mt-2 table table-hover table-sample">'; let table = '<table class="mt-2 table table-hover table-sample">';
@ -207,7 +205,6 @@ DataSpace.renderAnalysisReport = async function (resource, type)
const spectra = resource['Analysis Spectra'][0]; const spectra = resource['Analysis Spectra'][0];
const rawData = await this.fetchFileUrl(spectra['Spectrum Raw Data']); const rawData = await this.fetchFileUrl(spectra['Spectrum Raw Data']);
const interpreted = await this.fetchFileUrl(spectra['Spectrum Interpreted Data']); const interpreted = await this.fetchFileUrl(spectra['Spectrum Interpreted Data']);
console.warn(rawData, interpreted);
return html; return html;
} }

View File

@ -34,7 +34,6 @@ const techniques = {
'XRF' : processXRF, 'XRF' : processXRF,
}; };
/** /**
* @todo process rawData and check spectrum type?
* @param {string} rawData * @param {string} rawData
* @param {string} technique XRD, XRF * @param {string} technique XRD, XRF
* @param {string} containerId * @param {string} containerId
@ -47,11 +46,18 @@ export function plot(rawData, technique, containerId)
const spectrumType = techniques[technique]; const spectrumType = techniques[technique];
const processed = spectrumType.process(rawData); const processed = spectrumType.process(rawData);
Plotly.newPlot(container, Plotly.newPlot(
container,
[{ [{
x: processed[0], x: processed[0],
y: processed[1], y: processed[1],
}], }],
{
hovermode:'closest',
title: 'Hover with mouse on data points to see annotations',
xaxis: { zeroline : false, title : spectrumType.x_title },
yaxis: { zeroline : false, title : spectrumType.y_title }
},
{ {
margin: {t: 0} margin: {t: 0}
} }