1 39 40 package org.krysalis.jcharts.properties; 41 42 43 import java.awt.BasicStroke ; 44 import java.awt.Shape ; 45 import java.awt.Stroke ; 46 47 import org.krysalis.jcharts.chartData.interfaces.IAxisPlotDataSet; 48 import org.krysalis.jcharts.test.HTMLGenerator; 49 50 51 final public class LineChartProperties extends AxisChartTypeProperties 52 { 53 public static final Stroke DEFAULT_LINE_STROKE=new BasicStroke ( 1.5f ); 54 55 private Stroke [] lineStrokes; 56 private Shape [] shapes; 57 58 59 67 public LineChartProperties( Stroke [] lineStrokes, Shape [] shapes ) 68 { 69 this.lineStrokes=lineStrokes; 70 this.shapes=shapes; 71 } 72 73 74 public Stroke [] getLineStrokes() 75 { 76 return this.lineStrokes; 77 } 78 79 80 public Shape [] getShapes() 81 { 82 return this.shapes; 83 } 84 85 86 91 public void toHTML( HTMLGenerator htmlGenerator ) 92 { 93 htmlGenerator.propertiesTableStart( "LineChartProperties" ); 94 htmlGenerator.propertiesTableEnd(); 96 } 97 98 99 104 public void validate( IAxisPlotDataSet iAxisPlotDataSet ) throws PropertyException 105 { 106 if( this.lineStrokes == null ) 107 { 108 throw new PropertyException( "You must define Stroke Objects for the LineChart in the LineChartProperties Object." ); 109 } 110 else 111 { 112 if( iAxisPlotDataSet.getNumberOfDataSets() != this.lineStrokes.length ) 113 { 114 throw new PropertyException( "You must define a Stroke Object for each Line in the LineChart." ); 115 } 116 117 if( this.shapes != null ) 118 { 119 if( this.shapes.length != this.lineStrokes.length ) 120 { 121 throw new PropertyException( "The number of Shapes defined in the LineChartProperties Object must equal the number of Lines." ); 122 } 123 } 124 } 125 } 126 127 } 128 | Popular Tags |