List of usage examples for org.jfree.chart.axis Axis setVisible
public void setVisible(boolean flag)
From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java
public static void customizeAxis(Axis axis, ChartParams params, String prefix) { if (params.get(prefix + ChartParams.AXIS_VISIBLE_SUFIX) != null && params.getBoolean(prefix + ChartParams.AXIS_VISIBLE_SUFIX).booleanValue() == false) { axis.setVisible(false); } else {//from w w w.ja va 2s .c om if (params.get(prefix + ChartParams.AXIS_LINE_VISIBLE_SUFFIX) != null) { if (params.getBoolean(prefix + ChartParams.AXIS_LINE_VISIBLE_SUFFIX).booleanValue()) { axis.setAxisLineVisible(true); if (params.get(prefix + ChartParams.AXIS_LINE_COLOR_SUFFIX) != null) { axis.setAxisLinePaint(params.getColor(prefix + ChartParams.AXIS_LINE_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_LINE_STROKE_SUFFIX) != null) { axis.setAxisLineStroke(params.getStroke(prefix + ChartParams.AXIS_LINE_STROKE_SUFFIX)); } } else { axis.setAxisLineVisible(false); } } if (params.get(prefix + ChartParams.AXIS_LABEL_SUFFIX) != null) { axis.setLabel(params.getString(prefix + ChartParams.AXIS_LABEL_SUFFIX)); if (params.get(prefix + ChartParams.AXIS_LABEL_FONT_SUFFIX) != null) { axis.setLabelFont(params.getFont(prefix + ChartParams.AXIS_LABEL_FONT_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_LABEL_COLOR_SUFFIX) != null) { axis.setLabelPaint(params.getColor(prefix + ChartParams.AXIS_LABEL_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_LABEL_INSERTS_SUFFIX) != null) { axis.setLabelInsets(params.getRectangleInsets(prefix + ChartParams.AXIS_LABEL_INSERTS_SUFFIX)); } } if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_VISIBLE_SUFFIX) != null) { if (params.getBoolean(prefix + ChartParams.AXIS_TICK_LABEL_VISIBLE_SUFFIX).booleanValue()) { axis.setTickLabelsVisible(true); if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_FONT_SUFFIX) != null) { axis.setTickLabelFont(params.getFont(prefix + ChartParams.AXIS_TICK_LABEL_FONT_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_COLOR_SUFFIX) != null) { axis.setTickLabelPaint(params.getColor(prefix + ChartParams.AXIS_TICK_LABEL_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_INSERTS_SUFFIX) != null) { axis.setTickLabelInsets( params.getRectangleInsets(prefix + ChartParams.AXIS_TICK_LABEL_INSERTS_SUFFIX)); } } else { axis.setTickLabelsVisible(false); } } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_VISIBLE_SUFFIX) != null) { if (params.getBoolean(prefix + ChartParams.AXIS_TICK_MARK_VISIBLE_SUFFIX).booleanValue()) { axis.setTickMarksVisible(true); if (params.get(prefix + ChartParams.AXIS_TICK_MARK_INSIDE_LENGTH_SUFFIX) != null) { axis.setTickMarkInsideLength(params .getFloat(prefix + ChartParams.AXIS_TICK_MARK_INSIDE_LENGTH_SUFFIX).floatValue()); } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_OUTSIDE_LENGTH_SUFFIX) != null) { axis.setTickMarkOutsideLength(params .getFloat(prefix + ChartParams.AXIS_TICK_MARK_OUTSIDE_LENGTH_SUFFIX).floatValue()); } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX) != null) { axis.setTickMarkPaint(params.getColor(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX)); } if (params.get(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX) != null) { axis.setTickMarkStroke(params.getStroke(prefix + ChartParams.AXIS_TICK_MARK_STROKE_SUFFIX)); } } else { axis.setTickMarksVisible(false); } } } }
From source file:ucar.unidata.idv.control.chart.VerticalProfileChart.java
/** * Update the charts with the appropriate data * * @throws RemoteException Java RMI Exception * @throws VisADException VisAD problem */// ww w. j ava 2 s.c o m private void updateCharts() throws VisADException, RemoteException { if (profiles == null) { return; } clearLineStates(); startLoadingData(); try { initCharts(); if ((profiles != null) && !profiles.isEmpty()) { XYSeries speedSeries = null; XYSeries dirSeries = null; LineState speedLineState = null; LineState dirLineState = null; Unit speedUnit = null; boolean polarWind = true; int lineIdx = 0; for (int paramIdx = 0; paramIdx < profiles.size(); paramIdx++) { VerticalProfileInfo vpInfo = (VerticalProfileInfo) profiles.get(paramIdx); LineState lineState = vpInfo.getLineState(); lineState.setUseVerticalPosition(false); addLineState(lineState); lineState.setName(vpInfo.getDataInstance().getParamName()); lineState.unit = vpInfo.getUnit(); FieldImpl profile = vpInfo.getProfile(); if (profile == null) { continue; } FlatField oneTime; boolean isTimeSequence = GridUtil.isTimeSequence(profile); if (isTimeSequence) { if (time == null) { oneTime = (FlatField) profile.getSample(0); } else { oneTime = (FlatField) profile.evaluate(time); } } else { oneTime = (FlatField) profile; } String canonical = DataAlias.aliasToCanonical(lineState.getName()); float[] alts = oneTime.getDomainSet().getSamples(false)[0]; float[][] values = oneTime.getFloats(true); Unit[] rawUnits = ucar.visad.Util.getDefaultRangeUnits(oneTime); boolean haveWinds = (values.length > 1) && Unit.canConvert(rawUnits[0], CommonUnit.meterPerSecond) && Unit.canConvert(rawUnits[1], CommonUnit.meterPerSecond); for (int j = 0; j < values.length; j++) { // if not winds, don't process more than one param if ((j > 0) && !haveWinds) { continue; } // only handle U & V if ((j > 1) && haveWinds) { break; } if (haveWinds) { canonical = (j == 0) ? "U" : "V"; } XYSeries series = new XYSeries(lineState.getName()); //float[] vals = oneTime.getFloats(true)[0]; float[] vals = values[j]; Unit rawUnit = rawUnits[j]; //ucar.visad.Util.getDefaultRangeUnits(oneTime)[0]; if ((lineState.unit != null) && Unit.canConvert(lineState.unit, rawUnit)) { vals = lineState.unit.toThis(vals, rawUnit); } for (int i = 0; i < alts.length; i++) { series.add(alts[i], vals[i]); } if (series != null) { synchronized (MUTEX) { XYItemRenderer renderer = null; if (Misc.equals(canonical, "SPEED")) { speedUnit = lineState.unit; speedSeries = series; speedLineState = lineState; continue; } if (Misc.equals(canonical, "DIR")) { dirSeries = series; dirLineState = lineState; continue; } if (Misc.equals(canonical, "U") || Misc.equals(canonical, "UREL")) { speedUnit = lineState.unit; speedSeries = series; polarWind = false; speedLineState = lineState; continue; } if (Misc.equals(canonical, "V") || Misc.equals(canonical, "VREL")) { dirSeries = series; dirLineState = lineState; polarWind = false; continue; } addSeries(series, lineState, lineIdx, renderer, true); } lineIdx++; } //addSeries(series, lineState, paramIdx, null, true); } } if ((speedSeries != null) && (dirSeries != null)) { XYItemRenderer renderer = new WindbarbRenderer(speedLineState, speedSeries, dirSeries, speedUnit, polarWind); Axis axis = addSeries(speedSeries, speedLineState, lineIdx++, renderer, true); if (speedLineState.getVerticalPosition() != LineState.VPOS_NONE) { axis.setVisible(false); } speedSeries = null; dirSeries = null; } if (speedSeries != null) { addSeries(speedSeries, speedLineState, lineIdx++, null, true); } if (dirSeries != null) { addSeries(dirSeries, dirLineState, lineIdx, null, true); } } updateContents(); } finally { doneLoadingData(); } }
From source file:org.operamasks.faces.render.graph.ChartRenderer.java
protected void setAxisStyles(Axis axis, UIAxis comp) { axis.setVisible(comp.isVisible()); axis.setAxisLineVisible(comp.isDrawLine()); axis.setTickLabelsVisible(comp.isDrawTickLabels()); axis.setTickMarksVisible(comp.isDrawTickMarks()); String label = comp.getLabel(); Font labelFont = comp.getLabelFont(); Paint labelColor = comp.getLabelColor(); Paint lineColor = comp.getLineColor(); Font tickLabelFont = comp.getTickLabelFont(); Paint tickLabelColor = comp.getTickLabelColor(); Paint tickMarkColor = comp.getTickMarkColor(); if (label != null) axis.setLabel(label);// w w w . j av a 2 s .c o m if (labelFont != null) axis.setLabelFont(labelFont); if (labelColor != null) axis.setLabelPaint(labelColor); if (lineColor != null) axis.setAxisLinePaint(lineColor); if (tickLabelFont != null) axis.setTickLabelFont(tickLabelFont); if (tickLabelColor != null) axis.setTickLabelPaint(tickLabelColor); if (tickMarkColor != null) axis.setTickMarkPaint(tickMarkColor); axis.setTickMarkInsideLength(comp.getTickMarkInsideLength()); axis.setTickMarkOutsideLength(comp.getTickMarkOutsideLength()); if (axis instanceof CategoryAxis) { setCategoryAxisStyles((CategoryAxis) axis, comp); } else if (axis instanceof DateAxis) { setDateAxisStyles((DateAxis) axis, comp); } else if (axis instanceof NumberAxis) { setNumberAxisStyles((NumberAxis) axis, comp); } }
From source file:ucar.unidata.idv.control.chart.TimeSeriesChart.java
/** * set chart from point data// w w w . j a va 2 s .co m * * @param obs obs * @param plotVars the vars to plot * * @throws RemoteException On badness * @throws VisADException On badness */ public void setPointObs(List<PointOb> obs, List plotVars) throws VisADException, RemoteException { try { synchronized (MUTEX) { clearLineStates(); settingData = true; int paramIdx = 0; initCharts(); if ((obs != null) && (obs.size() > 0)) { List<PointParam> goodVars = new ArrayList<PointParam>(); for (int varIdx = 0; varIdx < plotVars.size(); varIdx++) { PointParam plotVar = (PointParam) plotVars.get(varIdx); LineState lineState = plotVar.getLineState(); addLineState(lineState); String var = lineState.getName(); PointOb ob = obs.get(0); Tuple tuple = (Tuple) ob.getData(); TupleType tupleType = (TupleType) tuple.getType(); MathType[] types = tupleType.getComponents(); boolean isValid = false; for (int typeIdx = 0; typeIdx < types.length; typeIdx++) { String name = ucar.visad.Util.cleanTypeName(types[typeIdx].toString()); String canonical = DataAlias.aliasToCanonical(name); if (Misc.equals(name, var) || Misc.equals(canonical, var)) { lineState.index = typeIdx; Data dataElement = tuple.getComponent(lineState.index); if ((dataElement instanceof Real)) { Real obsReal = (Real) dataElement; Unit displayUnit = control.getDisplayConventions().getDisplayUnit(name, obsReal.getUnit()); lineState.unit = ((displayUnit != null) ? displayUnit : obsReal.getUnit()); } if (lineState.getVisible()) { goodVars.add(plotVar); } isValid = true; break; } } lineState.setValid(isValid); } MyTimeSeries speedSeries = null; MyTimeSeries dirSeries = null; LineState speedLineState = null; LineState dirLineState = null; Unit speedUnit = null; boolean polarWind = true; for (int varIdx = 0; varIdx < goodVars.size(); varIdx++) { PointParam plotVar = (PointParam) goodVars.get(varIdx); LineState lineState = plotVar.getLineState(); if (!lineState.getVisible()) { continue; } MyTimeSeries series = null; List<String> textList = null; String canonical = DataAlias.aliasToCanonical(lineState.getName()); //System.err.println ("var:" + lineState.getName() + " canon:" + canonical); Unit unit = null; double min = 0, max = 0; for (int obIdx = 0; obIdx < obs.size(); obIdx++) { PointOb ob = (PointOb) obs.get(obIdx); Tuple tuple = (Tuple) ob.getData(); TupleType tupleType = (TupleType) tuple.getType(); MathType[] types = tupleType.getComponents(); Data dataElement = tuple.getComponent(lineState.index); Date dttm = Util.makeDate(ob.getDateTime()); if (series == null) { series = new MyTimeSeries(lineState.getName(), FixedMillisecond.class); } if (!(dataElement instanceof Real)) { if (textList == null) { textList = new ArrayList<String>(); } try { series.add(new FixedMillisecond(dttm), 0); textList.add(dataElement.toString()); } catch (Exception exc) { //noop here. Its sortof bad form but this way we keep the text list in synch with the series } continue; } Real obsReal = (Real) dataElement; if (unit == null) { if (lineState.unit != null) { unit = lineState.unit; } else { unit = obsReal.getUnit(); } } double value = ((lineState.unit != null) ? obsReal.getValue(lineState.unit) : obsReal.getValue()); //NaN wind directions must be special cased b/c they cannot //be thrown away lest they get out of sync with speed causing //rendering problems for wind barbs. if ((value == value) || Misc.equals(canonical, "DIR")) { if ((obIdx == 0) || (value > max)) { max = value; } if ((obIdx == 0) || (value < min)) { min = value; } series.addOrUpdate(new FixedMillisecond(dttm), value); } } addRange(min, max, "Data range from: " + lineState.getName()); if (series != null) { synchronized (MUTEX) { XYItemRenderer renderer = null; if (Misc.equals(canonical, "SPEED")) { speedUnit = unit; speedSeries = series; speedLineState = lineState; continue; } if (Misc.equals(canonical, "DIR")) { dirSeries = series; dirLineState = lineState; continue; } if (Misc.equals(canonical, "U")) { speedUnit = unit; speedSeries = series; polarWind = false; speedLineState = lineState; continue; } if (Misc.equals(canonical, "V")) { dirSeries = series; dirLineState = lineState; polarWind = false; continue; } if (Misc.equals(canonical, "CC")) { double scale = 0; String n = lineState.getName(); if (n.equals("CC1") || n.equals("CC2") || n.equals("CC3") || n.equals("CC4")) { scale = 2.0; } renderer = new CloudCoverageRenderer(lineState, scale); } if (textList != null) { renderer = new TextRenderer(textList, lineState); } Axis axis = addSeries(series, lineState, paramIdx, renderer, true); if (Misc.equals(canonical, "CC") || (textList != null)) { axis.setVisible(false); } } paramIdx++; } } if ((speedSeries != null) && (dirSeries != null)) { WindbarbRenderer renderer = new WindbarbRenderer(speedLineState, speedSeries, dirSeries, speedUnit, polarWind); renderer.isSouth = ((obs != null) && (obs.size() > 0)) ? obs.get(0).getEarthLocation().getLatitude().getValue() < 0 : false; Axis axis = addSeries(speedSeries, speedLineState, paramIdx++, renderer, true); if (speedLineState.getVerticalPosition() != LineState.VPOS_NONE) { axis.setVisible(false); } speedSeries = null; dirSeries = null; } if (speedSeries != null) { addSeries(speedSeries, speedLineState, paramIdx++, null, true); } if (dirSeries != null) { addSeries(dirSeries, dirLineState, paramIdx, null, true); } } } updateContents(); } finally { doneLoadingData(); } }
From source file:ucar.unidata.idv.control.chart.TimeSeriesChart.java
/** * Set samples//from www . ja v a 2 s .c o m * * @throws RemoteException On badness * @throws VisADException On badness */ public void setProbeSamplesInner() throws VisADException, RemoteException { clearLineStates(); updatePending = false; List<ProbeRowInfo> rowInfos = ((currentProbeData == null) ? null : new ArrayList<ProbeRowInfo>(currentProbeData)); try { initCharts(); if ((rowInfos != null) && (rowInfos.size() > 0)) { MyTimeSeries speedSeries = null; MyTimeSeries dirSeries = null; LineState speedLineState = null; LineState dirLineState = null; Unit speedUnit = null; double speedMin = 0, speedMax = 0; double dirMin = 0, dirMax = 0; boolean polarWind = true; int speedIdx = 0; int dirIdx = 0; for (int paramIdx = 0; paramIdx < rowInfos.size(); paramIdx++) { ProbeRowInfo info = rowInfos.get(paramIdx); LineState lineState = info.getLineState(); addLineState(lineState); FieldImpl field = info.getPointSample(); if (field == null) { continue; } boolean isTimeSequence = GridUtil.isTimeSequence(field); if (!isTimeSequence) { continue; } lineState.unit = info.getUnit(); if (info.isPoint()) { if (!lineState.hasName()) { lineState.setNameMacro(MACRO_PARAMETER); } String pointParam = info.getPointParameterName(); if (lineState.getNameMacro() != null) { String macro = lineState.getNameMacro(); macro = macro.replace(MACRO_PARAMETER, pointParam); lineState.setName(macro); } else { lineState.setName(pointParam); } } else { if (!lineState.hasName()) { lineState.setNameMacro(MACRO_PARAMETER); } String paramName = info.getDataInstance().getParamName(); if (lineState.getNameMacro() != null) { String macro = lineState.getNameMacro(); macro = macro.replace(MACRO_PARAMETER, paramName); lineState.setName(macro); } else { lineState.setNameIfNeeded(paramName); } } String name = lineState.getName(); String canonical = DataAlias.aliasToCanonical(name); //System.err.println ("name:" + name + " canon:" + canonical); if (info.getLevel() != null) { name = name + "@" + Util.formatReal(info.getLevel()) + info.getLevel().getUnit(); } Set timeSet = field.getDomainSet(); Unit[] timeUnits = timeSet.getSetUnits(); double[][] times = timeSet.getDoubles(); double[][] values = field.getValues(false); if (values == null) { continue; } Unit[] rawUnits = ucar.visad.Util.getDefaultRangeUnits(field); boolean haveWinds = (values.length > 1) && checkWindUnits(rawUnits); for (int j = 0; j < values.length; j++) { // if not winds, don't process more than one param if ((j > 0) && !haveWinds) { continue; } // only handle U & V if ((j > 1) && haveWinds) { break; } if (haveWinds && (values.length > 1)) { canonical = (j == 0) ? "U" : "V"; } List<MyTimeSeries> timeSeriesList = new ArrayList<MyTimeSeries>(); MyTimeSeries series = new MyTimeSeries(name, FixedMillisecond.class); //Set timeSet = field.getDomainSet(); //Unit[] timeUnits = timeSet.getSetUnits(); //double[][] times = timeSet.getDoubles(); //double[][] values = field.getValues(false); //if (values == null) { // continue; //} double[] valueArray = values[j]; Unit rawUnit = rawUnits[j]; //ucar.visad.Util.getDefaultRangeUnits(field)[i]; if ((lineState.unit != null) && (rawUnit != null)) { valueArray = lineState.unit.toThis(valueArray, rawUnit); } int numTimes = times[0].length; double min = 0, max = 0; for (int i = 0; i < numTimes; i++) { Date date = Util.makeDate(new DateTime(times[0][i], timeUnits[0])); if (valueArray[i] != valueArray[i]) { //If is winds then ignore the ignore missing if (Misc.equals(canonical, "U") || Misc.equals(canonical, "UREL") || Misc.equals(canonical, "V") || Misc.equals(canonical, "VREL") || Misc.equals(canonical, "DIR") || Misc.equals(canonical, "SPEED")) { } else { //MISSING // continue; if (series != null) { timeSeriesList.add(series); series = null; } continue; } } if (series == null) { series = new MyTimeSeries(name, FixedMillisecond.class); } series.add(new FixedMillisecond(date), valueArray[i]); if ((i == 0) || (valueArray[i] > max)) { max = valueArray[i]; } if ((i == 0) || (valueArray[i] < min)) { min = valueArray[i]; } } synchronized (MUTEX) { if (Misc.equals(canonical, "U") || Misc.equals(canonical, "UREL")) { speedIdx = paramIdx; speedMin = min; speedMax = max; speedUnit = lineState.unit; speedSeries = series; polarWind = false; speedLineState = lineState; continue; } if (Misc.equals(canonical, "V") || Misc.equals(canonical, "VREL")) { dirIdx = paramIdx; dirSeries = series; dirLineState = lineState; dirMin = min; dirMax = max; polarWind = false; continue; } if (Misc.equals(canonical, "SPEED")) { speedIdx = paramIdx; speedMin = min; speedMax = max; speedUnit = lineState.unit; speedSeries = series; polarWind = true; speedLineState = lineState; continue; } if (Misc.equals(canonical, "DIR")) { dirIdx = paramIdx; dirSeries = series; dirLineState = lineState; dirMin = min; dirMax = max; polarWind = true; continue; } } if (series != null) { timeSeriesList.add(series); } boolean first = true; if (lineState.getRange() == null) { lineState.setRange(new ucar.unidata.util.Range(min, max)); } for (MyTimeSeries tmp : timeSeriesList) { addSeries(tmp, lineState, paramIdx, null, true, first); first = false; } addRange(min, max, "Data range from: " + lineState.getName()); } } if ((speedSeries != null) && (dirSeries != null)) { speedSeries.finish(); dirSeries.finish(); XYItemRenderer renderer = new WindbarbRenderer(speedLineState, speedSeries, dirSeries, speedUnit, polarWind); Axis axis = addSeries(speedSeries, speedLineState, speedIdx, renderer, true); if (speedLineState.getVerticalPosition() != LineState.VPOS_NONE) { axis.setVisible(false); } speedSeries = null; dirSeries = null; } if (speedSeries != null) { addSeries(speedSeries, speedLineState, speedIdx, null, true); addRange(speedMin, speedMax, "Data range from: " + speedLineState.getName()); } if (dirSeries != null) { addSeries(dirSeries, dirLineState, dirIdx, null, true); addRange(dirMin, dirMax, "Data range from: " + dirLineState.getName()); } } updateContents(); } finally { doneLoadingData(); } }
From source file:ucar.unidata.idv.flythrough.Flythrough.java
/** * Creates a chart.// w w w . j a v a2s . c o m * * @param dataset the data for the chart. * * @return a chart. */ public static JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart("", // chart title "", // x axis label "", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(new Color(255, 255, 255, 0)); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); Axis domainAxis = plot.getDomainAxis(); domainAxis.setVisible(false); return chart; }
From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHandler.java
private void customizeAxisEx(ChartDefinition cd, ChartAxis ai, Axis axis) { axis.setLabelPaint(getAxisTitleColor(ai)); axis.setTickLabelPaint(getAxisLabelColor(ai)); axis.setLabelFont(getAxisTitleFont(ai)); axis.setTickLabelFont(getAxisLabelFont(ai)); axis.setVisible(ai.isVisible()); axis.setTickLabelsVisible(ai.isLabelsVisible()); }
From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java
/** * Sets all the axis formatting options. This includes the colors and fonts to use on * the axis as well as the color to use when drawing the axis line. * * @param axis the axis to format//from w w w. ja v a2s .c o m * @param labelFont the font to use for the axis label * @param labelColor the color of the axis label * @param tickLabelFont the font to use for each tick mark value label * @param tickLabelColor the color of each tick mark value label * @param tickLabelMask formatting mask for the label. If the axis is a NumberAxis then * the mask should be <code>java.text.DecimalFormat</code> mask, and * if it is a DateAxis then the mask should be a * <code>java.text.SimpleDateFormat</code> mask. * @param verticalTickLabels flag to draw tick labels at 90 degrees * @param lineColor color to use when drawing the axis line and any tick marks * @param isRangeAxis used to distinguish between range and domain axis type * @param timeUnit time unit used to create a DateAxis */ protected void configureAxis(Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, int timePeriod, Comparable axisMinValue, Comparable axisMaxValue) throws JRException { Boolean axisVisible = axisSettings.getVisible(); if (axisVisible == null || axisVisible.booleanValue()) { setAxisLine(axis, lineColor, axisSettings); // Double defaultFixedDimension = getAxisSettings(isRangeAxis); // if(defaultFixedDimension != null) // { // axis.setFixedDimension(defaultFixedDimension.doubleValue()); // } setAxisLabel(axis, labelFont, labelColor, axisSettings); setAxisTickLabels(axis, tickLabelFont, tickLabelColor, tickLabelMask, axisSettings); setAxisTickMarks(axis, lineColor, axisSettings); setAxisBounds(axis, axisSettings, timePeriod, axisMinValue, axisMaxValue); if (verticalTickLabels != null && axis instanceof ValueAxis) { ((ValueAxis) axis).setVerticalTickLabels(verticalTickLabels.booleanValue()); } } else { axis.setVisible(false); } }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
/** * Sets all the axis formatting options. This includes the colors and fonts to use on * the axis as well as the color to use when drawing the axis line. * * @param axis the axis to format/*from w ww.j a v a 2 s. c o m*/ * @param labelFont the font to use for the axis label * @param labelColor the color of the axis label * @param tickLabelFont the font to use for each tick mark value label * @param tickLabelColor the color of each tick mark value label * @param tickLabelMask formatting mask for the label. If the axis is a NumberAxis then * the mask should be <code>java.text.DecimalFormat</code> mask, and * if it is a DateAxis then the mask should be a * <code>java.text.SimpleDateFormat</code> mask. * @param verticalTickLabels flag to draw tick labels at 90 degrees * @param lineColor color to use when drawing the axis line and any tick marks */ protected void configureAxis(Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, AxisSettings axisSettings, DateTickUnitType timePeriod, Comparable<?> axisMinValue, Comparable<?> axisMaxValue) throws JRException { Boolean axisVisible = axisSettings.getVisible(); if (axisVisible == null || axisVisible) { setAxisLine(axis, lineColor, axisSettings); // Double defaultFixedDimension = getAxisSettings(isRangeAxis); // if (defaultFixedDimension != null) // { // axis.setFixedDimension(defaultFixedDimension); // } setAxisLabel(axis, labelFont, labelColor, axisSettings); setAxisTickLabels(axis, tickLabelFont, tickLabelColor, tickLabelMask, axisSettings); setAxisTickMarks(axis, lineColor, axisSettings); setAxisBounds(axis, axisSettings, timePeriod, axisMinValue, axisMaxValue); if (verticalTickLabels != null && axis instanceof ValueAxis) { ((ValueAxis) axis).setVerticalTickLabels(verticalTickLabels); } } else { axis.setVisible(false); } }
From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java
/** * Sets all the axis formatting options. This includes the colors and fonts to use on * the axis as well as the color to use when drawing the axis line. * * @param axis the axis to format/*from www . ja v a 2 s . com*/ * @param labelFont the font to use for the axis label * @param labelColor the color of the axis label * @param tickLabelFont the font to use for each tick mark value label * @param tickLabelColor the color of each tick mark value label * @param tickLabelMask formatting mask for the label. If the axis is a NumberAxis then * the mask should be <code>java.text.DecimalFormat</code> mask, and * if it is a DateAxis then the mask should be a * <code>java.text.SimpleDateFormat</code> mask. * @param verticalTickLabels flag to draw tick labels at 90 degrees * @param lineColor color to use when drawing the axis line and any tick marks * @param isRangeAxis used to distinguish between range and domain axis type * @param timeUnit time unit used to create a DateAxis */ protected void configureAxis(Axis axis, JRFont labelFont, Color labelColor, JRFont tickLabelFont, Color tickLabelColor, String tickLabelMask, Boolean verticalTickLabels, Paint lineColor, boolean isRangeAxis, Comparable axisMinValue, Comparable axisMaxValue) throws JRException { Boolean axisVisible = (Boolean) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_VISIBLE); if (axisVisible != null && axisVisible.booleanValue()) { setAxisLine(axis, lineColor); Double defaultFixedDimension = (Double) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_FIXED_DIMENSION); if (defaultFixedDimension != null) { axis.setFixedDimension(defaultFixedDimension.doubleValue()); } Integer baseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BASEFONT_SIZE); setAxisLabel(axis, labelFont, labelColor, baseFontSize); setAxisTickLabels(axis, tickLabelFont, tickLabelColor, tickLabelMask, baseFontSize); setAxisTickMarks(axis, lineColor); String timePeriodUnit = isRangeAxis ? (String) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.RANGE_AXIS_TIME_PERIOD_UNIT) : (String) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.DOMAIN_AXIS_TIME_PERIOD_UNIT); setAxisBounds(axis, isRangeAxis, timePeriodUnit, axisMinValue, axisMaxValue); if (verticalTickLabels != null && axis instanceof ValueAxis) { ((ValueAxis) axis).setVerticalTickLabels(verticalTickLabels.booleanValue()); } } else { axis.setVisible(false); } }