Skip to content

Commit 9fecd43

Browse files
author
Gary Keeble
committed
Merge branch 'Custom-Graph-Setup'
2 parents 220d887 + 4fe86f9 commit 9fecd43

File tree

3 files changed

+439
-2
lines changed

3 files changed

+439
-2
lines changed

css/main.css

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,65 @@ html.has-log .log-graph-config {
157157
.config-graph-field select {
158158
margin-right:4px;
159159
}
160+
161+
.config-graph-field input[name=smoothing] {
162+
margin-right:4px;
163+
max-width: 75px;
164+
}
165+
.config-graph-field input[name=power] {
166+
margin-right:4px;
167+
max-width: 65px;
168+
}
169+
.config-graph-field input[name=scale] {
170+
margin-right:4px;
171+
max-width: 65px;
172+
}
173+
160174
.config-graph h4 button {
161175
margin-left:0.5em;
162176
}
163177

178+
.config-graph table tr{
179+
margin:0.5em 0;
180+
width: 100%;
181+
line-height: 10px;
182+
}
183+
184+
.config-graph th[name=field] {
185+
margin-right:4px;
186+
width: 265px;
187+
}
188+
189+
.config-graph th[name=smoothing] {
190+
margin-right:4px;
191+
width: 75px;
192+
text-align: center;
193+
}
194+
195+
.config-graph th[name=expo] {
196+
margin-right:4px;
197+
width: 65px;
198+
text-align: center;
199+
}
200+
201+
.config-graph th[name=zoom] {
202+
margin-right:4px;
203+
width: 65px;
204+
text-align: center;
205+
}
206+
207+
208+
.setup-parameters {
209+
margin:0.5em 0;
210+
}
211+
212+
.setup-parameters dd {
213+
margin-top:0.5em;
214+
}
215+
216+
.setup-parameter {
217+
margin:0.5em 0;
218+
}
164219

165220
#graphCanvas {
166221
position:absolute;

js/graph_config_dialog.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ function GraphConfigurationDialog(dialog, onSave) {
2929
elem = $(
3030
'<li class="config-graph-field">'
3131
+ '<select class="form-control"><option value="">(choose a field)</option></select>'
32+
+ '<input name="smoothing" class="form-control" type="text"></input>'
33+
+ '<input name="power" class="form-control" type="text"></input>'
34+
+ '<input name="scale" class="form-control" type="text"></input>'
3235
+ '<button type="button" class="btn btn-default btn-sm">Remove</button>'
3336
+ '</li>'
3437
),
@@ -40,6 +43,17 @@ function GraphConfigurationDialog(dialog, onSave) {
4043
select.append(renderFieldOption(offeredFieldNames[i], selectedFieldName));
4144
}
4245

46+
// the smoothing is in uS rather than %, scale the value somewhere between 0 and 10000uS
47+
$('input[name=smoothing]',elem).val((field.smoothing!=null)?(field.smoothing/100)+'%':'30%');
48+
if(field.curve!=null) {
49+
$('input[name=power]',elem).val((field.curve.power!=null)?(field.curve.power*100)+'%':'100%');
50+
$('input[name=scale]',elem).val((field.curve.outputRange!=null)?(field.curve.outputRange*100)+'%':'100%');
51+
} else
52+
{
53+
$('input[name=power]',elem).val('100%');
54+
$('input[name=scale]',elem).val('100%');
55+
}
56+
4357
return elem;
4458
}
4559

@@ -57,6 +71,18 @@ function GraphConfigurationDialog(dialog, onSave) {
5771
+ '<input class="form-control" type="text" placeholder="Axis label">'
5872
+ '</div>'
5973
+ '</div>'
74+
+ '<div class="form-group form-group-sm">'
75+
+ '<div class="col-sm-10">'
76+
+ '<table>'
77+
+ '<tr>'
78+
+ '<th name="field"></th>'
79+
+ '<th name="smoothing">Smooth</th>'
80+
+ '<th name="expo">Expo</th>'
81+
+ '<th name="zoom">Zoom</th>'
82+
+ '</tr>'
83+
+ '</table>'
84+
+ '</div>'
85+
+ '</div>'
6086
+ '<div class="form-group form-group-sm">'
6187
+ '<label class="col-sm-2 control-label">Fields</label>'
6288
+ '<div class="col-sm-10">'
@@ -162,8 +188,13 @@ function GraphConfigurationDialog(dialog, onSave) {
162188

163189
$(".config-graph-field", this).each(function() {
164190
field = {
165-
name: $("select", this).val()
166-
};
191+
name: $("select", this).val(),
192+
smoothing: parseInt($("input[name=smoothing]", this).val())*100, // Value 0-100% = 0-10000uS (higher values are more smooth, 30% is typical)
193+
curve: {
194+
power: parseInt($("input[name=power]", this).val())/100.0, // Value 0-100% = 0-1.0 (lower values exagerate center values - expo)
195+
outputRange: parseInt($("input[name=scale]", this).val())/100.0 // Value 0-100% = 0-1.0 (higher values > 100% zoom in graph vertically)
196+
}
197+
}
167198

168199
if (field.name.length > 0) {
169200
graph.fields.push(field);

0 commit comments

Comments
 (0)