diff --git a/plotter/models.py b/plotter/models.py index 9a4f2f3..e445ed8 100644 --- a/plotter/models.py +++ b/plotter/models.py @@ -12,6 +12,7 @@ class ExpDetail(Document): date = DateTimeField() last_time = FloatField() interval = IntField() + tag = StringField(max_length=40) def plots(self): return PlotMeta.objects(exp_detail=self) @@ -30,3 +31,10 @@ class PlotData(Document): 'indexes': ["plot", "+time"] } +class Exp(models.Model): + + name = models.CharField(max_length=60) + code = models.IntegerField() + + def __str__(self): + return self.name diff --git a/plotter/static/css/style.css b/plotter/static/css/style.css index f082ce5..1efe31b 100644 --- a/plotter/static/css/style.css +++ b/plotter/static/css/style.css @@ -54,6 +54,15 @@ main { margin: 0; } +#sidebar a { + color: gray; + padding: 0.1rem; +} + +#sidebar h5 { + color:#333; +} + .text-blue { color: #003A8E; } @@ -72,6 +81,8 @@ main { .legend { list-style: none; + padding-left: 1rem; + padding-top: 1rem; } .legend span { @@ -106,16 +117,8 @@ main { font-size: 0.8rem; } -.bc-icons { - color: #898989; -} - -.bc-icons .breadcrumb-item+.breadcrumb-item::before { - content: none; -} - -.bc-icons .breadcrumb-item.active { - color: #00addc; +.tools-date { + font-size: 0.8rem; } /* cards */ diff --git a/plotter/static/js/jroplots.js b/plotter/static/js/jroplots.js index 275a07b..f1099b3 100644 --- a/plotter/static/js/jroplots.js +++ b/plotter/static/js/jroplots.js @@ -87,7 +87,6 @@ class PcolorBuffer { }; var iDiv = document.createElement('div'); iDiv.id = 'plot-' + i; - //iDiv.className += iDiv.className ? ' col-lg-6 col-md-6 col-sm-12' : 'col-lg-6 col-md-12 col-sm-12'; this.zbuffer.push([]); this.n = this.n + 1; this.div.appendChild(iDiv); @@ -104,10 +103,13 @@ class PcolorBuffer { if (this.metadata.zmin) { trace.zmin = this.metadata.zmin } if (this.metadata.zmax) { trace.zmax = this.metadata.zmax } + var tm = new Date(this.last * 1000); + tm.setTime( tm.getTime() + tm.getTimezoneOffset()*60*1000 ); + if ('titles' in this.metadata){ - layout.title = this.metadata.titles[i] + ' - ' + this.last.toLocaleString(); + layout.title = this.metadata.titles[i] + ' - ' + tm.toLocaleString(); }else{ - layout.title = 'Ch ' + i + ' - ' + this.last.toLocaleString(); + layout.title = 'Ch ' + i + ' - ' + tm.toLocaleString(); } var conf = { @@ -128,6 +130,16 @@ class PcolorBuffer { } $('#id_ymin').val(Math.min(...this.metadata.yrange)); $('#id_ymax').val(Math.max(...this.metadata.yrange)); + if (this.metadata.zmin) { + $('#id_zmin').val(this.metadata.zmin); + } else { + $('#id_zmin').val(Math.min(...values.data[0][0])); + } + if (this.metadata.zmax) { + $('#id_zmax').val(this.metadata.zmax); + } else { + $('#id_zmax').val(Math.max(...values.data[0][0])); + } } getSize() { @@ -315,13 +327,10 @@ class Pcolor { }; var iDiv = document.createElement('div'); iDiv.id = 'plot-' + i; - iDiv.className += iDiv.className ? ' col-md-5' : 'col-md-5'; + iDiv.className += iDiv.className ? ' col-md-6' : 'col-md-6'; this.n = this.n + 1; this.div.appendChild(iDiv); this.divs.push(iDiv.id); - var iDiv = document.createElement('div'); - iDiv.className = 'col-md-1'; - this.div.appendChild(iDiv); var trace1 = { z: data['data'][i], y: data.metadata.yrange, @@ -370,6 +379,17 @@ class Pcolor { $('#id_ymax').val(Math.max(...this.metadata.yrange)); $('#id_xmin').val(Math.min(...this.metadata.xrange)); $('#id_xmax').val(Math.max(...this.metadata.xrange)); + + if (this.metadata.zmin) { + $('#id_zmin').val(this.metadata.zmin); + } else { + $('#id_zmin').val(Math.min(...data.data[0][0])); + } + if (this.metadata.zmax) { + $('#id_zmax').val(this.metadata.zmax); + } else { + $('#id_zmax').val(Math.max(...data.data[0][0])); + } } plot(obj) { @@ -488,14 +508,8 @@ class ScatterBuffer { } var label; - //if (data.metadata.localtime == true){ label = "[LT]"; - //} - //else{ - // label = "[UTC]"; - //} - var layout = { height: 300, title: t.slice(-1).toLocaleString(), @@ -536,8 +550,17 @@ class ScatterBuffer { showTips: true }; Plotly.newPlot('plot', traces, layout, conf); - $('#id_ymin').val(Math.min(...this.metadata.yrange)); - $('#id_ymax').val(Math.max(...this.metadata.yrange)); + + if (this.metadata.ymin) { + $('#id_ymin').val(this.metadata.ymin); + } else { + $('#id_ymin').val(layout.yaxis.range[0]); + } + if (this.metadata.ymax) { + $('#id_ymax').val(this.metadata.ymax); + } else { + $('#id_ymax').val(layout.yaxis.range[1]); + } } getSize() { diff --git a/plotter/templates/base.html b/plotter/templates/base.html index c85cf37..3502696 100644 --- a/plotter/templates/base.html +++ b/plotter/templates/base.html @@ -26,13 +26,16 @@ {% include "header_igp.html" %}