forked from shutterstock/rickshaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toggle callback wasn’t always called Fix wrong propagation of graph configure in slider preview
- Loading branch information
Jérémie Foucault
authored and
Jérémie Foucault
committed
Mar 23, 2014
1 parent
1e3f51b
commit ef5e02b
Showing
6 changed files
with
89 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
var data, graph, i, max, min, point, random, scales, series, _i, _j, _k, _l, _len, _len1, _len2, _ref; | ||
|
||
data = [[], []]; | ||
|
||
random = new Rickshaw.Fixtures.RandomData(12 * 60 * 60); | ||
|
||
for (i = _i = 0; _i < 100; i = ++_i) { | ||
random.addData(data); | ||
} | ||
|
||
window.scales = []; | ||
|
||
_ref = data[1]; | ||
for (_j = 0, _len = _ref.length; _j < _len; _j++) { | ||
point = _ref[_j]; | ||
point.y *= point.y; | ||
} | ||
|
||
for (_k = 0, _len1 = data.length; _k < _len1; _k++) { | ||
series = data[_k]; | ||
min = Number.MAX_VALUE; | ||
max = Number.MIN_VALUE; | ||
for (_l = 0, _len2 = series.length; _l < _len2; _l++) { | ||
point = series[_l]; | ||
min = Math.min(min, point.y); | ||
max = Math.max(max, point.y); | ||
} | ||
if (_k === 0) { | ||
scales.push(d3.scale.linear().domain([min, max]).nice()); | ||
} else { | ||
scales.push(d3.scale.pow().domain([min, max]).nice()); | ||
} | ||
} | ||
|
||
graph = new Rickshaw.Graph({ | ||
element: document.getElementById("chart"), | ||
renderer: 'line', | ||
series: [ | ||
{ | ||
color: 'steelblue', | ||
data: data[0], | ||
name: 'Series A', | ||
scale: scales[0] | ||
}, { | ||
color: 'lightblue', | ||
data: data[1], | ||
name: 'Series B', | ||
scale: scales[1] | ||
} | ||
] | ||
}); | ||
|
||
new Rickshaw.Graph.Axis.Y.Scaled({ | ||
element: document.getElementById('axis0'), | ||
graph: graph, | ||
orientation: 'left', | ||
scale: scales[0], | ||
tickFormat: Rickshaw.Fixtures.Number.formatKMBT | ||
}); | ||
|
||
new Rickshaw.Graph.Axis.Y.Scaled({ | ||
element: document.getElementById('axis1'), | ||
graph: graph, | ||
grid: false, | ||
orientation: 'right', | ||
scale: scales[1], | ||
tickFormat: Rickshaw.Fixtures.Number.formatKMBT | ||
}); | ||
|
||
new Rickshaw.Graph.Axis.Time({ | ||
graph: graph | ||
}); | ||
|
||
new Rickshaw.Graph.HoverDetail({ | ||
graph: graph | ||
}); | ||
|
||
graph.render(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters