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

Synchronized auto-scaling with multiple charts #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions smoothie.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function TimeSeries(options) {
options.resetBounds = options.resetBounds || true; // Enable or disable the resetBounds timer
this.options = options;
this.data = [];
this.referenceSeries = options.referenceSeries || this;

this.maxValue = Number.NaN; // The maximum value ever seen in this time series.
this.minValue = Number.NaN; // The minimum value ever seen in this time series.
Expand All @@ -56,6 +57,11 @@ function TimeSeries(options) {

// Reset the min and max for this timeseries so the graph rescales itself
TimeSeries.prototype.resetBounds = function() {
if (this.referenceSeries !== this) {
this.maxValue = this.referenceSeries.maxValue;
this.minValue = this.referenceSeries.minValue;
return

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a semicolon

}
this.maxValue = Number.NaN;
this.minValue = Number.NaN;
for (var i = 0; i < this.data.length; i++) {
Expand Down