List of usage examples for org.jfree.chart.axis Axis setTickLabelsVisible
public void setTickLabelsVisible(boolean flag)
From source file:org.openfaces.component.chart.impl.helpers.AxisUtil.java
public static void setupAxisPresentation(String label, Axis axis, FakeAxisStyle axisStyle) { StyleObjectModel model = axisStyle.getStyleObjectModel(); StyleBorderModel border = model.getBorder(); if (border != null) { if (border.getColor() != null) { axis.setAxisLinePaint(border.getColor()); }/*from w ww . java 2 s . c o m*/ if (!border.isNone()) { axis.setAxisLineVisible(true); axis.setAxisLineStroke(PropertiesConverter.toStroke(border)); axis.setTickMarkPaint(border.getColor()); axis.setTickMarksVisible(true); if (!axis.isTickMarksVisible()) axis.setTickMarksVisible(false); } if (border.getStyle().equalsIgnoreCase("none")) { axis.setAxisLineVisible(false); axis.setTickMarksVisible(false); if (axis.isTickMarksVisible()) axis.setTickMarksVisible(true); } } axis.setTickLabelsVisible(axisStyle.isTickLabelsVisible()); if (axisStyle.isLabelVisible() && label != null) { axis.setLabel(label); axis.setLabelPaint(model.getColor()); axis.setLabelFont(CSSUtil.getFont(model)); } if (axisStyle.isTickLabelsVisible()) { axis.setTickLabelsVisible(true); axis.setTickLabelPaint(model.getColor()); axis.setTickLabelFont(CSSUtil.getFont(model)); } else { axis.setTickLabelsVisible(false); } Double tickInterval = axisStyle.getTickInterval(); if (tickInterval != null && tickInterval != 0 && axis instanceof NumberAxis) { NumberAxis numberAxis = (NumberAxis) axis; if (tickInterval > 0) { NumberTickUnit tickUnit = new NumberTickUnit(tickInterval); numberAxis.setTickUnit(tickUnit); } else if (tickInterval == -1) { TickUnitSource tickUnits = NumberAxis.createIntegerTickUnits(); numberAxis.setStandardTickUnits(tickUnits); } else { throw new FacesException("tickInterval must be a positive number for a fixed tick interval, " + "or -1 for automatic integer tick selection: " + tickInterval); } numberAxis.setMinorTickMarksVisible(true); numberAxis.setMinorTickCount(2); numberAxis.setMinorTickMarkOutsideLength(3); numberAxis.setMinorTickMarkInsideLength(3); numberAxis.setTickMarkInsideLength(5); numberAxis.setTickMarkOutsideLength(5); } axis.setTickMarkInsideLength(axisStyle.getTickInsideLength()); axis.setTickMarkOutsideLength(axisStyle.getTickOutsideLength()); if (axisStyle.getMinorTicksVisible()) { axis.setMinorTickMarksVisible(true); if (axis instanceof ValueAxis) ((ValueAxis) axis).setMinorTickCount(axisStyle.getMinorTickCount() + 1); axis.setMinorTickMarkInsideLength(axisStyle.getMinorTickInsideLength()); axis.setMinorTickMarkOutsideLength(axisStyle.getMinorTickOutsideLength()); } else { axis.setMinorTickMarksVisible(false); } }
From source file:net.sourceforge.processdash.ev.ui.chart.EVXYChartPanel.java
protected void adjustAxis(Axis a, boolean chromeless, String label) { boolean showAxisTickLabels = !chromeless && chartContainsData; a.setTickLabelsVisible(showAxisTickLabels); a.setTickMarksVisible(showAxisTickLabels); a.setLabel(chromeless ? null : label); }
From source file:com.rcp.wbw.demo.editor.SWTAxisEditor.java
/** * Sets the properties of the specified axis to match * the properties defined on this panel. * // w ww .j a v a2s . c o m * @param axis * the axis. */ public void setAxisProperties(Axis axis) { axis.setLabel(getLabel()); axis.setLabelFont(getLabelFont()); axis.setLabelPaint(getLabelPaint()); axis.setTickMarksVisible(this.showTickMarksCheckBox.getSelection()); axis.setTickLabelsVisible(this.showTickLabelsCheckBox.getSelection()); axis.setTickLabelFont(getTickLabelFont()); axis.setTickLabelPaint(getTickLabelPaint()); }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultAxisEditor.java
/** * Sets the properties of the specified axis to match the properties defined * on this panel.//from ww w. java 2 s . com * * @param axis * the axis. */ public void setAxisProperties(Axis axis) { axis.setLabel(getLabel()); axis.setLabelFont(getLabelFont()); axis.setLabelPaint(getLabelPaint()); axis.setTickMarksVisible(isTickMarksVisible()); axis.setTickLabelsVisible(isTickLabelsVisible()); axis.setTickLabelFont(getTickLabelFont()); axis.setTickLabelPaint(getTickLabelPaint()); axis.setTickLabelInsets(getTickLabelInsets()); axis.setLabelInsets(getLabelInsets()); }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Processes a string that indicates the axes that should be visible on * the plot./*from w w w. j a v a 2s . c om*/ * * @param plot the plot. * @param axisStr the axis specification. * @param axes a list that will be populated with any axes added to the * plot. */ private static void processAxisStrV(CategoryPlot plot, String axisStr, List axes) { int xAxisCount = 0; int yAxisCount = 0; for (int i = 0; i < axisStr.length(); i++) { char c = axisStr.charAt(i); if (c == 'x') { if (xAxisCount == 0) { CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setTickLabelsVisible(true); axes.add(xAxis); xAxisCount++; } else { GCategoryAxis axis = new GCategoryAxis(); axis.setAxisLineVisible(false); plot.setDomainAxis(xAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); xAxisCount++; } } else if (c == 'y') { if (yAxisCount == 0) { Axis yAxis = plot.getRangeAxis(); yAxis.setTickLabelsVisible(true); yAxis.setTickMarksVisible(true); axes.add(yAxis); yAxisCount++; } else { GValueAxis axis = new GValueAxis(); axis.setAxisLineVisible(false); plot.setRangeAxis(yAxisCount, axis); plot.setRangeAxisLocation(yAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); yAxisCount++; } } else if (c == 'r') { GValueAxis axis = new GValueAxis(); plot.setRangeAxis(yAxisCount, axis); plot.setRangeAxisLocation(yAxisCount, AxisLocation.BOTTOM_OR_RIGHT); axes.add(axis); yAxisCount++; } else if (c == 't') { GCategoryAxis axis = new GCategoryAxis(); axis.setAxisLineVisible(false); plot.setDomainAxis(xAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.TOP_OR_LEFT); axes.add(axis); xAxisCount++; } else if (c == ',') { // nothing to do } else { throw new RuntimeException("Bad character " + c); } } }
From source file:daylightchart.options.chart.AxisOptions.java
/** * Sets the properties of the specified axis to match the properties * defined on this panel./*from ww w .j a va 2 s .c o m*/ * * @param axis * the axis. */ void setAxisProperties(final Axis axis) { axis.setLabel(label); if (labelFont != null) { axis.setLabelFont(labelFont); } if (labelPaint != null) { axis.setLabelPaint(labelPaint); } if (labelInsets != null) { axis.setLabelInsets(labelInsets); } // axis.setTickMarksVisible(tickMarksVisible); axis.setTickLabelsVisible(tickLabelsVisible); if (tickLabelFont != null) { axis.setTickLabelFont(tickLabelFont); } if (tickLabelPaint != null) { axis.setTickLabelPaint(tickLabelPaint); } if (tickLabelInsets != null) { axis.setTickLabelInsets(tickLabelInsets); } }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Processes a string that indicates the axes that should be visible on * the plot./*from www . j av a 2 s . c om*/ * * @param plot the plot. * @param axisStr the axis specification. * @param axes a list that will be populated with any axes added to the * plot. */ private static void processAxisStr(XYPlot plot, String axisStr, List axes) { int xAxisCount = 0; int yAxisCount = 0; for (int i = 0; i < axisStr.length(); i++) { char c = axisStr.charAt(i); if (c == 'x') { if (xAxisCount == 0) { Axis xAxis = plot.getDomainAxis(); xAxis.setTickMarksVisible(true); xAxis.setTickLabelsVisible(true); axes.add(xAxis); xAxisCount++; } else { GValueAxis axis = new GValueAxis(); axis.setAxisLineVisible(false); plot.setDomainAxis(xAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); xAxisCount++; } } else if (c == 'y') { if (yAxisCount == 0) { Axis yAxis = plot.getRangeAxis(); yAxis.setTickMarksVisible(true); yAxis.setTickLabelsVisible(true); axes.add(yAxis); yAxisCount++; } else { GValueAxis axis = new GValueAxis(); axis.setAxisLineVisible(false); plot.setRangeAxis(yAxisCount, axis); plot.setRangeAxisLocation(yAxisCount, AxisLocation.BOTTOM_OR_LEFT); axes.add(axis); yAxisCount++; } } else if (c == 'r') { GValueAxis axis = new GValueAxis(); plot.setRangeAxis(yAxisCount, axis); plot.setRangeAxisLocation(yAxisCount, AxisLocation.BOTTOM_OR_RIGHT); axes.add(axis); yAxisCount++; } else if (c == 't') { GValueAxis axis = new GValueAxis(); plot.setDomainAxis(xAxisCount, axis); plot.setDomainAxisLocation(xAxisCount, AxisLocation.TOP_OR_LEFT); axes.add(axis); xAxisCount++; } else if (c == ',') { // nothing to do } else { throw new RuntimeException("Bad character " + c); } } }
From source file:net.sourceforge.processdash.ui.web.CGIChartBase.java
/** Generate CGI chart output. */ @Override//from w ww .j av a 2 s. c o m protected void writeContents() throws IOException { buildData(); // get the data for display chromeless = (parameters.get("chromeless") != null); JFreeChart chart = createChart(); int width = getIntSetting("width"); int height = getIntSetting("height"); Color initGradColor = getColorSetting("initGradColor"); Color finalGradColor = getColorSetting("finalGradColor"); chart.setBackgroundPaint(new GradientPaint(0, 0, initGradColor, width, height, finalGradColor)); if (parameters.get("hideOutline") != null) chart.getPlot().setOutlinePaint(INVISIBLE); String title = getSetting("title"); if (chromeless || title == null || title.length() == 0) chart.setTitle((TextTitle) null); else { chart.setTitle(Translator.translate(title)); String titleFontSize = getSetting("titleFontSize"); if (titleFontSize != null) try { float fontSize = Float.parseFloat(titleFontSize); TextTitle t = chart.getTitle(); t.setFont(t.getFont().deriveFont(fontSize)); } catch (Exception tfe) { } } if (chromeless || parameters.get("hideLegend") != null) chart.removeLegend(); else { LegendTitle l = chart.getLegend(); String legendFontSize = getSetting("legendFontSize"); if (l != null && legendFontSize != null) try { float fontSize = Float.parseFloat(legendFontSize); l.setItemFont(l.getItemFont().deriveFont(fontSize)); } catch (Exception lfe) { } } chart.getPlot().setNoDataMessage(resources.getString("No_Data_Message")); Axis xAxis = getHorizontalAxis(chart); if (xAxis != null) { if (parameters.get("hideTickLabels") != null || parameters.get("hideXTickLabels") != null) { xAxis.setTickLabelsVisible(false); } else if (parameters.get("tickLabelFontSize") != null || parameters.get("xTickLabelFontSize") != null) { String tfs = getParameter("xTickLabelFontSize"); if (tfs == null) tfs = getParameter("tickLabelFontSize"); float fontSize = Float.parseFloat(tfs); xAxis.setTickLabelFont(xAxis.getTickLabelFont().deriveFont(fontSize)); } } Axis yAxis = getVerticalAxis(chart); if (yAxis != null) { if (parameters.get("hideTickLabels") != null || parameters.get("hideYTickLabels") != null) { yAxis.setTickLabelsVisible(false); } else if (parameters.get("tickLabelFontSize") != null || parameters.get("yTickLabelFontSize") != null) { String tfs = getParameter("yTickLabelFontSize"); if (tfs == null) tfs = getParameter("tickLabelFontSize"); float fontSize = Float.parseFloat(tfs); yAxis.setTickLabelFont(yAxis.getTickLabelFont().deriveFont(fontSize)); } } String axisFontSize = getSetting("axisLabelFontSize"); if (axisFontSize != null) try { float fontSize = Float.parseFloat(axisFontSize); if (xAxis != null) xAxis.setLabelFont(xAxis.getLabelFont().deriveFont(fontSize)); if (yAxis != null) yAxis.setLabelFont(yAxis.getLabelFont().deriveFont(fontSize)); } catch (Exception afs) { } ChartRenderingInfo info = (isHtmlMode() ? new ChartRenderingInfo() : null); BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = img.createGraphics(); if ("auto".equals(getSetting("titleFontSize"))) maybeAdjustTitleFontSize(chart, g2, width); chart.draw(g2, new Rectangle2D.Double(0, 0, width, height), info); g2.dispose(); String outputFormat = getSetting("outputFormat"); OutputStream imgOut; if (isHtmlMode()) { imgOut = PngCache.getOutputStream(); } else { imgOut = outStream; } ImageIO.write(img, outputFormat, imgOut); imgOut.flush(); imgOut.close(); if (isHtmlMode()) writeImageHtml(width, height, imgOut.hashCode(), info); }
From source file:com.bdaum.zoom.report.internal.wizards.ReportComponent.java
private static void applyAxisProperties(Axis axis, String prefix, Map<String, Object> properties) { axis.setLabel((String) properties.get(prefix + AXISLABEL)); Font font = (Font) properties.get(prefix + AXISLABELFONT); if (font != null) axis.setLabelFont(font);//from ww w .ja va 2 s. co m Paint paint = (Paint) properties.get(prefix + AXISLABELPAINT); if (paint != null) axis.setLabelPaint(paint); Boolean visible = (Boolean) properties.get(prefix + TICKMARKSVISIBLE); if (visible != null) axis.setTickMarksVisible(visible); visible = (Boolean) properties.get(prefix + TICKLABELSVISIBLE); if (visible != null) axis.setTickLabelsVisible(visible); font = (Font) properties.get(prefix + TICKLABELFONT); if (font != null) axis.setTickLabelFont(font); paint = (Paint) properties.get(prefix + TICKLABELPAINT); if (paint != null) axis.setTickLabelPaint(paint); }
From source file:org.operamasks.faces.render.graph.ChartRenderer.java
protected void setAxisStyles(Axis axis, UIAxis comp) { axis.setVisible(comp.isVisible());//from ww w. j a va 2 s . c o m 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); 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); } }