Skip to content

Commit

Permalink
Add Step Line Series Type to Graph (Synchronous) Widget
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Dec 24, 2023
1 parent adb8eae commit 07729af
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 8.15.14 (Unreleased)

### Features

- Add Step Line Series Type to Graph (Synchronous) Widget


## 8.15.13 (2023.12.24)

### Bugfixes
Expand Down
37 changes: 36 additions & 1 deletion mycodo/widgets/widget_graph_synchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ def generate_page_variables(widget_unique_id, widget_options):
<div class="input-group-text">
<select id="series_type-{{widget_variables['colors_graph'][n]['measure_id']}}" name="series_type-{{widget_variables['colors_graph'][n]['measure_id']}}">
<option value="line" {% if widget_variables['colors_graph'][n]['series_type'] == "line" %} selected{% endif %}>Line</option>
<option value="step-left" {% if widget_variables['colors_graph'][n]['series_type'] == "step-left" %} selected{% endif %}>Line (Step, Left)</option>
<option value="step-center" {% if widget_variables['colors_graph'][n]['series_type'] == "step-center" %} selected{% endif %}>Line (Step, Center)</option>
<option value="step-right" {% if widget_variables['colors_graph'][n]['series_type'] == "step-right" %} selected{% endif %}>Line (Step, Right)</option>
<option value="column" {% if widget_variables['colors_graph'][n]['series_type'] == "column" %} selected{% endif %}>Column</option>
</select>
</div>
Expand Down Expand Up @@ -1114,7 +1117,15 @@ def generate_page_variables(widget_unique_id, widget_options):
{%- endif -%}
)",
{% if ns.series_type in ['line', 'column'] -%}
type: '{{ns.series_type}}',
{%- elif ns.series_type == 'step-left' -%}
step: 'left',
{%- elif ns.series_type == 'step-center' -%}
step: 'center',
{%- elif ns.series_type == 'step-right' -%}
step: 'right',
{%- endif %}
dataGrouping: {
enabled: {% if ns.disable_data_grouping %}false{% else %}true{% endif %},
groupPixelWidth: 5
Expand Down Expand Up @@ -1181,7 +1192,15 @@ def generate_page_variables(widget_unique_id, widget_options):
{%- endif -%}
)",
{% if ns.series_type in ['line', 'column'] -%}
type: '{{ns.series_type}}',
{%- elif ns.series_type == 'step-left' -%}
step: 'left',
{%- elif ns.series_type == 'step-center' -%}
step: 'center',
{%- elif ns.series_type == 'step-right' -%}
step: 'right',
{%- endif %}
dataGrouping: {
enabled: {% if ns.disable_data_grouping %}false{% else %}true{% endif %},
groupPixelWidth: 2
Expand Down Expand Up @@ -1246,7 +1265,15 @@ def generate_page_variables(widget_unique_id, widget_options):
{%- endif -%}
)",
{% if ns.series_type in ['line', 'column'] -%}
type: '{{ns.series_type}}',
{%- elif ns.series_type == 'step-left' -%}
step: 'left',
{%- elif ns.series_type == 'step-center' -%}
step: 'center',
{%- elif ns.series_type == 'step-right' -%}
step: 'right',
{%- endif %}
dataGrouping: {
enabled: {% if ns.disable_data_grouping %}false{% else %}true{% endif %},
groupPixelWidth: 2
Expand Down Expand Up @@ -1311,7 +1338,15 @@ def generate_page_variables(widget_unique_id, widget_options):
{%- endif -%}
)",
{% if ns.series_type in ['line', 'column'] -%}
type: '{{ns.series_type}}',
{%- elif ns.series_type == 'step-left' -%}
step: 'left',
{%- elif ns.series_type == 'step-center' -%}
step: 'center',
{%- elif ns.series_type == 'step-right' -%}
step: 'right',
{%- endif %}
dataGrouping: {
enabled: {% if ns.disable_data_grouping %}false{% else %}true{% endif %},
groupPixelWidth: 2
Expand Down Expand Up @@ -1443,7 +1478,7 @@ def series_type_graph(form, error):
for key in form.keys():
if 'series_type' in key:
for value in form.getlist(key):
if value not in ["column", "line"]:
if value not in ["column", "line", "step-left", "step-center", "step-right"]:
error.append("Invalid series type")
series_types[key[12:]] = value
return series_types, error
Expand Down

0 comments on commit 07729af

Please sign in to comment.