Skip to content

Commit

Permalink
Fix min and max for yaxes when resizing
Browse files Browse the repository at this point in the history
Show unit in control element if not null
Change form button to primary
  • Loading branch information
clavay committed Dec 19, 2018
1 parent c2a20ae commit 43e54ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pyscada/hmi/static/pyscada/js/pyscada/pyscada_v0-7-0rc13.js
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ function XYPlot(id, xaxisVarId, xaxisLinLog, plotPoints, yaxisUniqueScale){
//set_x_axes();
pOpt = flotPlot.getOptions();
for (y in pOpt.yaxes){
pOpt.yaxes[y].min = pOpt.yaxes[y].chart_data_min;
pOpt.yaxes[y].max = pOpt.yaxes[y].chart_data_max;
pOpt.yaxes[y].min = null;
pOpt.yaxes[y].max = null;
}
pOpt.xaxes[0].min = pOpt.xaxes[0].x_data_min;
pOpt.xaxes[0].max = pOpt.xaxes[0].x_data_max;
Expand All @@ -1186,8 +1186,8 @@ function XYPlot(id, xaxisVarId, xaxisLinLog, plotPoints, yaxisUniqueScale){
$(chart_container_id + " .btn.btn-default.chart-ZoomYToFit").click(function() {
pOpt = flotPlot.getOptions();
for (y in pOpt.yaxes){
pOpt.yaxes[y].min = pOpt.yaxes[y].chart_data_min;
pOpt.yaxes[y].max = pOpt.yaxes[y].chart_data_max;
pOpt.yaxes[y].min = null;
pOpt.yaxes[y].max = null;
}
flotPlot.setupGrid();
flotPlot.draw();
Expand Down
8 changes: 6 additions & 2 deletions pyscada/hmi/templates/control_element.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
<div class="input-group set_value">
<span class="input-group-addon input-group-addon-label">{{ item.label }}</span>
<input type="text" class="form-control {{ item.web_class_str }}" id="{{ item.web_id }}-{{ uuid }}-value" placeholder="">
<span class="input-group-addon">{{ item.unit }}</span>
{% if item.unit %}<span class="input-group-addon">{{ item.unit }}</span>{% endif %}
<span class="input-group-btn">
<button class="btn btn-default write-task-set set-{{ item.key }}" data-key="{{ item.key }}" data-type="{{ item.item_type}}" id="{{ item.web_id }}-{{ uuid }}" data-min="{{ item.min }}" data-max="{{ item.max }}" data-value-class="{{ item.value_class }}" data-min-type="{{ item.min_type }}" data-max-type="{{ item.max_type }}" type="button">set</button>
</span>
</div>
{% endif %}
{% elif item.type == 6 %}<!-- display value -->
<div class="input-group control_label"><span class="type-label">{{ item.label }}<span class="type-unit"><span class="type-numeric {{ item.web_class_str }}">NaN</span> {{ item.unit }}</span></span></div>
<div class="input-group set_value">
<span class="input-group-addon input-group-addon-label">{{ item.label }}</span>
<span class="input-group-addon input-group-addon-label type-numeric {{ item.web_class_str }}"></span>
{% if item.unit %}<span class="input-group-addon">{{ item.unit }}</span>{% endif %}
</div>
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion pyscada/hmi/templates/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<div class="input-group set_value">
<span class="input-group-btn">
<button class="btn btn-default write-task-form-set set-{{ form.pk }}" type="button" id="{{ form.web_id }}-{{ uuid }}-button">{{ form.button }}</button>
<button class="btn btn-primary write-task-form-set set-{{ form.pk }}" type="button" id="{{ form.web_id }}-{{ uuid }}-button">{{ form.button }}</button>
</span>
</div>
</form>

0 comments on commit 43e54ae

Please sign in to comment.