1 25 package org.jrobin.graph; 26 27 import java.awt.Color ; 28 29 import org.jrobin.core.RrdException; 30 import org.jrobin.core.XmlWriter; 31 32 38 class Stack extends PlotDef 39 { 40 48 Stack( String sourceName, Color color ) 49 { 50 super( sourceName, color ); 51 this.plotType = PlotDef.PLOT_STACK; 52 } 53 54 55 66 void draw( ChartGraphics g, int[] xValues, double[] stackValues, int lastPlotType ) throws RrdException 67 { 68 PlotDef stack = null; 69 70 try 71 { 72 if ( lastPlotType == PlotDef.PLOT_LINE ) 73 stack = new Line( source, values, color, true, visible ); 74 else if ( lastPlotType == PlotDef.PLOT_AREA ) 75 stack = new Area( source, values, color, true, visible ); 76 77 stack.draw( g, xValues, stackValues, lastPlotType ); 78 } 79 catch (Exception e) 80 { 81 throw new RrdException( "Could not stack source: " + sourceName ); 82 } 83 84 } 85 86 void exportXmlTemplate( XmlWriter xml, String legend ) { 87 xml.startTag("stack"); 88 xml.writeTag("datasource", sourceName); 89 xml.writeTag("color", color); 90 xml.writeTag("legend", legend); 91 xml.closeTag(); } 93 } 94 | Popular Tags |