View | Details | Raw Unified | Return to bug 49334
Collapse All | Expand All

(-)src/java/org/apache/poi/hssf/record/RecordFactory.java (-2 / +3 lines)
Lines 210-217 Link Here
210
		TopMarginRecord.class,
210
		TopMarginRecord.class,
211
		UncalcedRecord.class,
211
		UncalcedRecord.class,
212
		UseSelFSRecord.class,
212
		UseSelFSRecord.class,
213
        UserSViewBegin.class,
213
		UserSViewBegin.class,
214
        UserSViewEnd.class,
214
		UserSViewEnd.class,
215
		ValueRangeRecord.class,
215
		VCenterRecord.class,
216
		VCenterRecord.class,
216
		VerticalPageBreakRecord.class,
217
		VerticalPageBreakRecord.class,
217
		WindowOneRecord.class,
218
		WindowOneRecord.class,
(-)src/java/org/apache/poi/hssf/record/UnknownRecord.java (-1 / +1 lines)
Lines 241-247 Link Here
241
			case 0x101B:
241
			case 0x101B:
242
			case 0x101D:
242
			case 0x101D:
243
			case 0x101E:
243
			case 0x101E:
244
			case 0x101F:
244
			//case 0x101F:
245
			case 0x1020:
245
			case 0x1020:
246
			case 0x1021:
246
			case 0x1021:
247
			case 0x1022:
247
			case 0x1022:
(-)src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java (-2 / +95 lines)
Lines 38-43 Link Here
38
import org.apache.poi.hssf.record.formula.Area3DPtg;
38
import org.apache.poi.hssf.record.formula.Area3DPtg;
39
import org.apache.poi.hssf.record.formula.Ptg;
39
import org.apache.poi.hssf.record.formula.Ptg;
40
40
41
import org.apache.poi.hssf.record.chart.LinkedDataRecord;
41
/**
42
/**
42
 * Has methods for construction of a chart object.
43
 * Has methods for construction of a chart object.
43
 *
44
 *
Lines 49-55 Link Here
49
	private LegendRecord legendRecord;
50
	private LegendRecord legendRecord;
50
	private ChartTitleFormatRecord chartTitleFormat;
51
	private ChartTitleFormatRecord chartTitleFormat;
51
	private SeriesTextRecord chartTitleText;
52
	private SeriesTextRecord chartTitleText;
52
53
	private List valueRanges = new ArrayList(); 
54
	
53
	private List series = new ArrayList();
55
	private List series = new ArrayList();
54
56
55
	private HSSFChart(ChartRecord chartRecord) {
57
	private HSSFChart(ChartRecord chartRecord) {
Lines 139-145 Link Here
139
	public static HSSFChart[] getSheetCharts(HSSFSheet sheet) {
141
	public static HSSFChart[] getSheetCharts(HSSFSheet sheet) {
140
		List charts = new ArrayList();
142
		List charts = new ArrayList();
141
		HSSFChart lastChart = null;
143
		HSSFChart lastChart = null;
142
144
		HSSFSeries lastSeries = null;
143
		// Find records of interest
145
		// Find records of interest
144
		List records = sheet.getSheet().getRecords();
146
		List records = sheet.getSheet().getRecords();
145
		for(Iterator it = records.iterator(); it.hasNext();) {
147
		for(Iterator it = records.iterator(); it.hasNext();) {
Lines 155-160 Link Here
155
			if(r instanceof SeriesRecord) {
157
			if(r instanceof SeriesRecord) {
156
				HSSFSeries series = lastChart.new HSSFSeries( (SeriesRecord)r );
158
				HSSFSeries series = lastChart.new HSSFSeries( (SeriesRecord)r );
157
				lastChart.series.add(series);
159
				lastChart.series.add(series);
160
				lastSeries = series;
158
			}
161
			}
159
			if(r instanceof ChartTitleFormatRecord) {
162
			if(r instanceof ChartTitleFormatRecord) {
160
				lastChart.chartTitleFormat =
163
				lastChart.chartTitleFormat =
Lines 173-178 Link Here
173
					lastChart.chartTitleText = str;
176
					lastChart.chartTitleText = str;
174
				}
177
				}
175
			}
178
			}
179
			if(r instanceof LinkedDataRecord) {
180
				LinkedDataRecord data = (LinkedDataRecord)r;
181
				lastSeries.insertData( data );
182
			}
183
			if(r instanceof ValueRangeRecord){
184
				lastChart.valueRanges.add((ValueRangeRecord)r);
185
			}
176
		}
186
		}
177
187
178
		return (HSSFChart[])
188
		return (HSSFChart[])
Lines 228-233 Link Here
228
			throw new IllegalStateException("No chart title found to change");
238
			throw new IllegalStateException("No chart title found to change");
229
		}
239
		}
230
	}
240
	}
241
	
242
	/**
243
	 * Set value range (basic Axis Options) 
244
	 * @param axisIndex 0 - primary axis, 1 - secondary axis
245
	 * @param minimum minimum value; Double.NaN - automatic; null - no change
246
	 * @param maximum maximum value; Double.NaN - automatic; null - no change
247
	 * @param majorUnit major unit value; Double.NaN - automatic; null - no change
248
	 * @param minorUnit minor unit value; Double.NaN - automatic; null - no change
249
	 */
250
	public void setValueRange( int axisIndex, Double minimum, Double maximum, Double majorUnit, Double minorUnit){
251
		ValueRangeRecord valueRange = (ValueRangeRecord)valueRanges.get( axisIndex );
252
		if( valueRange == null ) return;
253
		if( minimum != null ){
254
			valueRange.setAutomaticMinimum(minimum.isNaN());
255
			valueRange.setMinimumAxisValue(minimum);
256
		}
257
		if( maximum != null ){
258
			valueRange.setAutomaticMaximum(maximum.isNaN());
259
			valueRange.setMaximumAxisValue(maximum);
260
		}
261
		if( majorUnit != null ){
262
			valueRange.setAutomaticMajor(majorUnit.isNaN());
263
			valueRange.setMajorIncrement(majorUnit);
264
		}
265
		if( minorUnit != null ){
266
			valueRange.setAutomaticMinor(minorUnit.isNaN());
267
			valueRange.setMinorIncrement(minorUnit);
268
		}
269
	}
231
270
232
	private SeriesIndexRecord createSeriesIndexRecord( int index )
271
	private SeriesIndexRecord createSeriesIndexRecord( int index )
233
	{
272
	{
Lines 867-877 Link Here
867
	public class HSSFSeries {
906
	public class HSSFSeries {
868
		private SeriesRecord series;
907
		private SeriesRecord series;
869
		private SeriesTextRecord seriesTitleText;
908
		private SeriesTextRecord seriesTitleText;
909
		private LinkedDataRecord dataName;
910
		private LinkedDataRecord dataValues;
911
		private LinkedDataRecord dataCategoryLabels;
912
		private LinkedDataRecord dataSecondaryCategoryLabels;
913
		private int dataReaded = 0;
870
914
871
		/* package */ HSSFSeries(SeriesRecord series) {
915
		/* package */ HSSFSeries(SeriesRecord series) {
872
			this.series = series;
916
			this.series = series;
873
		}
917
		}
874
918
919
		public void insertData(LinkedDataRecord data){
920
			switch(dataReaded){
921
				case 0: dataName = data;
922
				break;
923
				case 1: dataValues = data;
924
				break;
925
				case 2: dataCategoryLabels = data;
926
				break;
927
				case 3: dataSecondaryCategoryLabels = data;
928
				break;
929
			}
930
			dataReaded++;
931
		}
932
		
875
		public short getNumValues() {
933
		public short getNumValues() {
876
			return series.getNumValues();
934
			return series.getNumValues();
877
		}
935
		}
Lines 905-909 Link Here
905
				throw new IllegalStateException("No series title found to change");
963
				throw new IllegalStateException("No series title found to change");
906
			}
964
			}
907
		}
965
		}
966
967
		/**
968
		 * @return record with data names
969
		 */
970
		public LinkedDataRecord getDataName(){
971
			return dataName;
972
		}
973
		
974
		/**
975
		 * @return record with data values
976
		 */
977
		public LinkedDataRecord getDataValues(){
978
			return dataValues;
979
		}
980
		
981
		/**
982
		 * @return record with data category labels
983
		 */
984
		public LinkedDataRecord getDataCategoryLabels(){
985
			return dataCategoryLabels;
986
		}
987
		
988
		/**
989
		 * @return record with data secondary category labels
990
		 */
991
		public LinkedDataRecord getDataSecondaryCategoryLabels() {
992
			return dataSecondaryCategoryLabels;
993
		}
994
		
995
		/**
996
		 * @return record with series
997
		 */
998
		public SeriesRecord getSeries() {
999
			return series;
1000
		}
908
	}
1001
	}
909
}
1002
}

Return to bug 49334