1 39 40 package org.krysalis.jcharts.chartData; 41 42 43 import org.krysalis.jcharts.chartData.interfaces.IAxisChartDataSet; 44 import org.krysalis.jcharts.properties.*; 45 import org.krysalis.jcharts.test.HTMLGenerator; 46 import org.krysalis.jcharts.test.HTMLTestable; 47 import org.krysalis.jcharts.types.ChartType; 48 49 import java.awt.*; 50 51 52 public final class AxisChartDataSet extends DataSet implements IAxisChartDataSet, HTMLTestable 53 { 54 private ChartType chartType; 55 56 57 69 public AxisChartDataSet( double[][] data, 70 String [] legendLabels, 71 Paint[] paints, 72 ChartType chartType, 73 ChartTypeProperties chartTypeProperties ) throws ChartDataException 74 { 75 super( data, legendLabels, paints, chartTypeProperties ); 76 this.chartType=chartType; 77 } 78 79 80 87 public void validate() throws ChartDataException, PropertyException 88 { 89 if( ( super.legendLabels != null ) && ( super.data.length != super.legendLabels.length ) ) 90 { 91 throw new ChartDataException( "There is not an one to one mapping of 'legend labels' to 'data sets'." ); 92 } 93 94 if( super.data.length != super.paints.length ) 95 { 96 throw new ChartDataException( "There is not an one to one mapping of 'Paint' implementations to 'data sets'." ); 97 } 98 99 ( (AxisChartTypeProperties) super.getChartTypeProperties() ).validate( this ); 100 } 101 102 103 111 public final double getValue( int dataset, int index ) throws ArrayIndexOutOfBoundsException 112 { 113 return super.data[ dataset ][ index ]; 114 } 115 116 117 123 public final ChartType getChartType() 124 { 125 return this.chartType; 126 } 127 128 129 134 public final int getNumberOfDataSets() 135 { 136 return this.data.length; 137 } 138 139 140 145 public void toHTML( HTMLGenerator htmlGenerator ) 146 { 147 super.toHTML( htmlGenerator ); 148 149 158 } 159 160 161 } 162 | Popular Tags |