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

Added the possibility to add a minumum and maximum x value. #457

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 10 additions & 2 deletions rickshaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -2458,6 +2458,10 @@ Rickshaw.Graph.RangeSlider = Rickshaw.Class.create({

graph.window.xMin = ui.values[0];
graph.window.xMax = ui.values[1];

console.log("graph.window.xMin: "+graph.window.xMin);
console.log("graph.window.xMax: "+graph.window.xMax);
Copy link

@mustmodify mustmodify Aug 24, 2018

Choose a reason for hiding this comment

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

In case they do get around to looking at this, might want to remove the console.log entries.


graph.update();

var domain = graph.dataDomain();
Expand Down Expand Up @@ -3050,8 +3054,12 @@ Rickshaw.Graph.Renderer = Rickshaw.Class.create( {
xMin -= (xMax - xMin) * this.padding.left;
xMax += (xMax - xMin) * this.padding.right;

xMin = this.graph.max === undefined ? xMin : this.graph.xMin;
xMax = this.graph.max === undefined ? xMax : this.graph.xMax;
if(this.graph.xMin !== undefined){
xMin = this.graph.xMin;
}
if(this.graph.xMax !== undefined){
xMax = this.graph.xMax;
}

yMin = this.graph.min === 'auto' ? yMin : this.graph.min || 0;
yMax = this.graph.max === undefined ? yMax : this.graph.max;
Expand Down
4 changes: 2 additions & 2 deletions rickshaw.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/js/Rickshaw.Graph.Annotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Rickshaw.Graph.Annotate = function(args) {

annotation.boxes.forEach( function(box) {


var element = box.element;

if (!element) {
Expand Down
1 change: 1 addition & 0 deletions src/js/Rickshaw.Graph.RangeSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Rickshaw.Graph.RangeSlider = Rickshaw.Class.create({

graph.window.xMin = ui.values[0];
graph.window.xMax = ui.values[1];

graph.update();

var domain = graph.dataDomain();
Expand Down
8 changes: 6 additions & 2 deletions src/js/Rickshaw.Graph.Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ Rickshaw.Graph.Renderer = Rickshaw.Class.create( {
xMin -= (xMax - xMin) * this.padding.left;
xMax += (xMax - xMin) * this.padding.right;

xMin = this.graph.max === undefined ? xMin : this.graph.xMin;
xMax = this.graph.max === undefined ? xMax : this.graph.xMax;
if(this.graph.xMin !== undefined){
xMin = this.graph.xMin;
}
if(this.graph.xMax !== undefined){
xMax = this.graph.xMax;
}

yMin = this.graph.min === 'auto' ? yMin : this.graph.min || 0;
yMax = this.graph.max === undefined ? yMax : this.graph.max;
Expand Down