changeset 128:c5dd12a15993

Start adding text labels
author Chris Cannam
date Sat, 20 Apr 2013 19:12:04 +0100
parents 9baaaf37a008
children 759edd0d02ce
files yetilab/plot/plot.yeti
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/yetilab/plot/plot.yeti	Sat Apr 20 17:28:10 2013 +0100
+++ b/yetilab/plot/plot.yeti	Sat Apr 20 19:12:04 2013 +0100
@@ -1,6 +1,7 @@
 module yetilab.plot.plot;
 
 import org.jzy3d.plot3d.builder: Mapper;
+import org.jzy3d.plot3d.text.drawable: DrawableTextBillboard, DrawableTextBitmap;
 import org.jzy3d.maths: Range, Coord3d;
 import org.jzy3d.plot3d.primitives: Shape, HistogramBar, FlatLine2d, Polygon, Quad, Point;
 import org.jzy3d.plot3d.primitives.axes.layout.providers: StaticTickProvider;
@@ -129,7 +130,9 @@
     stacked);
 
 plotStacked keys xkeys unit values =
-   (chart = new Chart(Quality#Nicest);
+   (quality = Quality#Nicest;
+    quality#setAnimated(false);
+    chart = new Chart(quality);
     scene = chart#getScene();
     stacked = stack keys xkeys values;
     var z = 0;
@@ -147,13 +150,17 @@
     for keys do k:
         ranges = stacked[k];
         var x = 0;
+        var ty = 0;
         c = Color#random();
         for xkeys do xk:
             rect = newRect x ranges[xk].y0 ranges[xk].y1 z c;
             scene#add(rect);
             x := x + 1;
         done;
+        text = new DrawableTextBitmap(k, new Coord3d(0, z, ty), c);
+        scene#add(text);
         z := z - 1;
+        ty := ty + 10;
     done;
     chart#getView()#setViewPoint(new Coord3d(pi/2, 0, 0));
     axes = chart#getAxeLayout();