Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Steps" type to graph for feeds that record discrete values #144

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
$lang['Lines'] = _('Lines');
$lang['Bars'] = _('Bars');
$lang['Points'] = _('Points');
$lang['Steps'] = _('Steps');
$lang['Histogram'] = _('Histogram');
$lang['Move up'] = _('Move up');
$lang['Move down'] = _('Move down');
Expand Down
4 changes: 4 additions & 0 deletions graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ function onClickLegendLink(event) {
case 'lines': current_data[index].lines.show = !current_data[index].lines.show; break;
case 'bars': current_data[index].bars.show = !current_data[index].bars.show; break;
case 'points': current_data[index].points.show = !current_data[index].points.show; break;
case 'steps': current_data[index].steps.show = !current_data[index].steps.show; break;
}
plot_statistics.setData(current_data);
// re-draw
Expand Down Expand Up @@ -952,6 +953,7 @@ function graph_draw()
if (feedlist[z].plottype=="lines") { plot.lines = { show: true, fill: (feedlist[z].fill ? (stacked ? 1.0 : 0.5) : 0.0), fill: feedlist[z].fill } };
if (feedlist[z].plottype=="bars") { plot.bars = { align: "center", fill: (feedlist[z].fill ? (stacked ? 1.0 : 0.5) : 0.0), show: true, barWidth: view.interval * 1000 * 0.75 } };
if (feedlist[z].plottype == 'points') plot.points = {show: true, radius: 3};
if (feedlist[z].plottype=="steps") { plot.lines = { steps: true, show: true, fill: (feedlist[z].fill ? (stacked ? 1.0 : 0.5) : 0.0), fill: feedlist[z].fill } };
plot.isRight = feedlist[z].yaxis === 2;
plot.id = feedlist[z].id;
plot.index = z;
Expand Down Expand Up @@ -996,6 +998,8 @@ function graph_draw()
out += "<option value='bars' "+selected+">"+_lang['Bars']+"</option>";
if (feedlist[z].plottype == "points") selected = "selected"; else selected = "";
out += "<option value='points' "+selected+">"+_lang['Points']+"</option>";
if (feedlist[z].plottype == "steps") selected = "selected"; else selected = "";
out += "<option value='steps' "+selected+">"+_lang['Steps']+"</option>";
out += "</select></td>";
out += "<td><input class='linecolor' feedid="+feedlist[z].id+" style='width:50px' type='color' value='#"+default_linecolor+"'></td>";
out += "<td><input class='fill' type='checkbox' feedid="+feedlist[z].id+"></td>";
Expand Down
1 change: 1 addition & 0 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
$lang['Lines'] = _('Lines');
$lang['Bars'] = _('Bars');
$lang['Points'] = _('Points');
$lang['Steps'] = _('Steps');
$lang['Histogram'] = _('Histogram');
$lang['Move up'] = _('Move up');
$lang['Move down'] = _('Move down');
Expand Down