[Plot] Complete specs for plot

Complete specs for transitioned plot view, WTD-533.
This commit is contained in:
Victor Woeltjen
2014-12-02 11:08:21 -08:00
parent 2f475fc17a
commit 870172ec6f
5 changed files with 253 additions and 7 deletions

View File

@ -36,7 +36,7 @@ define(
buffer;
if (!gl) {
return false;
throw new Error("WebGL unavailable.");
}
// Initialize shaders

View File

@ -14,15 +14,23 @@ define(
*
* @constructor
*/
function MCTChart($interval) {
function MCTChart($interval, $log) {
function linkChart(scope, element) {
var canvas = element.find("canvas")[0],
chart;
// Try to initialize GLChart, which allows drawing using WebGL.
// This may fail, particularly where browsers do not support
// WebGL, so catch that here.
try {
chart = new GLChart(canvas);
} catch (e) {
$log.warn("Cannot initialize mct-chart; " + e.message);
return;
}
function doDraw() {
var draw = scope.draw;
function doDraw(draw) {
canvas.width = canvas.offsetWidth;
canvas.height = canvas.offsetHeight;
chart.clear();
@ -57,7 +65,7 @@ define(
function drawIfResized() {
if (canvas.width !== canvas.offsetWidth ||
canvas.height !== canvas.offsetHeight) {
doDraw();
doDraw(scope.draw);
}
}