Added NaN repr field in export popup
This commit is contained in:
@ -104,6 +104,8 @@ class ExportPopup extends HTMLElement{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nanRepresentation = this.getElementsByClassName("nan-input")[0].value;
|
||||||
|
|
||||||
let binningCheckbox = this.getElementsByClassName("binning-checkbox")[0];
|
let binningCheckbox = this.getElementsByClassName("binning-checkbox")[0];
|
||||||
let binningValue = null;
|
let binningValue = null;
|
||||||
if(binningCheckbox.checked){
|
if(binningCheckbox.checked){
|
||||||
@ -123,7 +125,7 @@ class ExportPopup extends HTMLElement{
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.hide();
|
this.hide();
|
||||||
this.exportCallback(selectedVariables, startDateTimeMs, endDateTimeMs, binningValue);
|
this.exportCallback(selectedVariables, startDateTimeMs, endDateTimeMs, nanRepresentation, binningValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +174,11 @@ class ExportPopup extends HTMLElement{
|
|||||||
<input type=number class="export-end-minute" min="00" max="59">
|
<input type=number class="export-end-minute" min="00" max="59">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>NaN value : </span>
|
||||||
|
<input type=text class="nan-input" value="" spellcheck=false>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="binning-container">
|
<div class="binning-container">
|
||||||
<input type=checkbox class="binning-checkbox">
|
<input type=checkbox class="binning-checkbox">
|
||||||
<span class="binning-label">Binning (s) : </span>
|
<span class="binning-label">Binning (s) : </span>
|
||||||
|
@ -284,12 +284,12 @@ function loadExportPopup(){
|
|||||||
graphsContainer.appendChild(exportPopup);
|
graphsContainer.appendChild(exportPopup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportCallback(selectedVariables, startDateTimeMs, endDateTimeMs, binning=null){
|
function exportCallback(selectedVariables, startDateTimeMs, endDateTimeMs, nan, binning=null){
|
||||||
|
|
||||||
let binningParam = "None";
|
let binningParam = "None";
|
||||||
if (binning !== null)
|
if (binning !== null)
|
||||||
binningParam = binning
|
binningParam = binning
|
||||||
let exportURL = "http://" + hostPort + "/export?time=" + startDateTimeMs/1000 + "," + endDateTimeMs/1000 + "&variables=" + selectedVariables + "&interval=" + binningParam + "&id=" + clientID
|
let exportURL = "http://" + hostPort + "/export?time=" + startDateTimeMs/1000 + "," + endDateTimeMs/1000 + "&variables=" + selectedVariables + "&nan=" + nan + "&interval=" + binningParam + "&id=" + clientID
|
||||||
let a = document.createElement('a');
|
let a = document.createElement('a');
|
||||||
a.href = exportURL
|
a.href = exportURL
|
||||||
a.click()
|
a.click()
|
||||||
|
@ -163,7 +163,7 @@ class InfluxGraph:
|
|||||||
self.livemode = self.LIVE
|
self.livemode = self.LIVE
|
||||||
return dict(type='accept-graph', live=True)
|
return dict(type='accept-graph', live=True)
|
||||||
|
|
||||||
def w_export(self, variables, time, interval):
|
def w_export(self, variables, time, nan, interval):
|
||||||
"""
|
"""
|
||||||
Returns the bytes of a dataframe with the curves given by variables in the time range "time"
|
Returns the bytes of a dataframe with the curves given by variables in the time range "time"
|
||||||
Called when the route /export is reached.
|
Called when the route /export is reached.
|
||||||
@ -171,6 +171,7 @@ class InfluxGraph:
|
|||||||
Parameters :
|
Parameters :
|
||||||
variables (str) : a comma separataed value string of variable names (influx names) to retrieve
|
variables (str) : a comma separataed value string of variable names (influx names) to retrieve
|
||||||
time (str) : a commma separated value string (range) of seconds.
|
time (str) : a commma separated value string (range) of seconds.
|
||||||
|
nan (str) : the representation for NaN values in the TSV
|
||||||
interval (str) : the interval (resolution) of the values to get (string in seconds)
|
interval (str) : the interval (resolution) of the values to get (string in seconds)
|
||||||
|
|
||||||
Returns :
|
Returns :
|
||||||
@ -187,7 +188,7 @@ class InfluxGraph:
|
|||||||
df = self.influx_data_getter.get_curves_data_frame(queried_variables, [start, end], interval)
|
df = self.influx_data_getter.get_curves_data_frame(queried_variables, [start, end], interval)
|
||||||
|
|
||||||
mem = io.BytesIO()
|
mem = io.BytesIO()
|
||||||
df.to_csv(mem, sep="\t", index=False, float_format="%.15g")
|
df.to_csv(mem, sep="\t", index=False, float_format="%.15g", na_rep=nan)
|
||||||
mem.seek(0)
|
mem.seek(0)
|
||||||
return mem
|
return mem
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user