Redraw the legend if the canvas is the wrong size.

This makes it so when a plotter gets hidden and then shown, the canvas
legend ends up the right size.

Change-Id: Iaf91fb9c7382c39f1a129dcb36a89ac9154c69b6
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/network/www/plotter.ts b/aos/network/www/plotter.ts
index 89b360c..17bffa3 100644
--- a/aos/network/www/plotter.ts
+++ b/aos/network/www/plotter.ts
@@ -342,8 +342,11 @@
         // Make sure both have text in the right spot.  Don't be too picky since
         // nothing should really be changing here, and it's handy to let the
         // user edit the HTML for testing.
-        if (this.legend.children[child].lastChild.textContent.length == 0 &&
-            line.label().length != 0) {
+        let textdiv = this.legend.children[child].lastChild;
+        let canvas = this.legend.children[child].firstChild;
+        if ((textdiv.textContent.length == 0 && line.label().length != 0) ||
+            (textdiv as HTMLDivElement).offsetHeight !=
+                (canvas as HTMLCanvasElement).height) {
           needsUpdate = true;
           break;
         }