List of usage examples for org.jfree.chart.axis ValueAxis setTickMarksVisible
public void setTickMarksVisible(boolean flag)
From source file:storybook.ui.chart.jfreechart.ChartUtil.java
public static void hideRangeAxis(CategoryPlot paramCategoryPlot) { ValueAxis localValueAxis = paramCategoryPlot.getRangeAxis(); localValueAxis.setTickMarksVisible(false); localValueAxis.setTickLabelsVisible(false); }
From source file:net.sf.jsfcomp.chartcreator.utils.ChartAxisUtils.java
public static void createXYSeriesAxis(JFreeChart chart, ChartAxisData chartAxisData, int axisIndex) { ValueAxis axis = null; if (chartAxisData.getType() != null) { if (chartAxisData.getType().equals("number")) axis = createNumberAxis(chart, chartAxisData); else if (chartAxisData.getType().equals("date")) axis = createDateAxis(chart, chartAxisData); if (chartAxisData.getTickLabelFontSize() > 0) { Font tickFont = CategoryAxis.DEFAULT_TICK_LABEL_FONT .deriveFont(chartAxisData.getTickLabelFontSize()); axis.setTickLabelFont(tickFont); }//from w w w. j a v a 2 s . com axis.setTickLabelsVisible(chartAxisData.isTickLabels()); axis.setTickMarksVisible(chartAxisData.isTickMarks()); axis.setVerticalTickLabels(chartAxisData.isVerticalTickLabels()); } XYPlot plot = chart.getXYPlot(); if (chartAxisData.isDomain()) { plot.setDomainAxis(plot.getDomainAxisCount() - 1, axis); } else { plot.setRangeAxis(axisIndex, axis); XYDataset dataset = (XYDataset) chartAxisData.getDatasource(); plot.setRenderer(axisIndex, new StandardXYItemRenderer()); plot.setDataset(axisIndex, dataset); plot.mapDatasetToRangeAxis(axisIndex, axisIndex); } setXYSeriesAxisColors(chartAxisData, plot.getRenderer(axisIndex)); }
From source file:org.shredzone.bullshitcharts.chart.BarChartGenerator.java
@Override public Plot generate() { LineDatasetCreator dataset = new LineDatasetCreator(); dataset.setTendency(getTendency());// ww w . j a v a2 s.c om dataset.setNumberOfValues(getResolution()); dataset.setAmplitude(getAmplitude()); CategoryAxis catAxis = new CategoryAxis(getValue("x", "Time")); // TODO: i18n catAxis.setLowerMargin(0.0d); catAxis.setUpperMargin(0.0d); catAxis.setTickMarksVisible(false); catAxis.setTickLabelsVisible(false); ValueAxis valAxis = new NumberAxis(getValue("y", "Value")); valAxis.setRange(new Range(0.0d, 1.05d)); valAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); valAxis.setTickMarksVisible(false); valAxis.setTickLabelsVisible(false); BarRenderer3D renderer = new BarRenderer3D(); CategoryPlot plot = new CategoryPlot(dataset.generate(), catAxis, valAxis, renderer); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); return plot; }
From source file:org.shredzone.bullshitcharts.chart.LineChartGenerator.java
@Override public Plot generate() { LineDatasetCreator dataset = new LineDatasetCreator(); dataset.setTendency(getTendency());//from www. ja v a 2 s . co m dataset.setNumberOfValues(getResolution()); dataset.setAmplitude(getAmplitude()); CategoryAxis catAxis = new CategoryAxis(getValue("x", "Time")); // TODO: i18n catAxis.setLowerMargin(0.0d); catAxis.setUpperMargin(0.0d); catAxis.setTickMarksVisible(false); catAxis.setTickLabelsVisible(false); ValueAxis valAxis = new NumberAxis(getValue("y", "Value")); valAxis.setRange(new Range(0.0d, 1.05d)); valAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); valAxis.setTickMarksVisible(false); valAxis.setTickLabelsVisible(false); LineAndShapeRenderer renderer = new LineRenderer3D(); renderer.setBaseShapesVisible(false); // renderer.setStroke(new BasicStroke(2.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER)); CategoryPlot plot = new CategoryPlot(dataset.generate(), catAxis, valAxis, renderer); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); return plot; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JFreeChart createXYAreaSparkline(XYDataset dataset) { JFreeChart jfreechart = ChartFactory.createXYAreaChart(null, null, null, dataset, PlotOrientation.VERTICAL, false, false, false);//from w w w. j av a2 s .c o m XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainPannable(true); xyplot.setBackgroundPaint(null); xyplot.setOutlinePaint(null); xyplot.setForegroundAlpha(0.8F); xyplot.setDomainGridlinesVisible(false); xyplot.setDomainCrosshairVisible(false); xyplot.setRangeGridlinesVisible(false); xyplot.setRangeCrosshairVisible(false); DateAxis dateaxis = new DateAxis(""); dateaxis.setTickLabelsVisible(false); dateaxis.setTickMarksVisible(false); dateaxis.setAxisLineVisible(false); dateaxis.setNegativeArrowVisible(false); dateaxis.setPositiveArrowVisible(false); dateaxis.setVisible(false); xyplot.setDomainAxis(dateaxis); ValueAxis rangeAxis = xyplot.getRangeAxis(); rangeAxis.setTickLabelsVisible(false); rangeAxis.setTickMarksVisible(false); rangeAxis.setAxisLineVisible(false); rangeAxis.setNegativeArrowVisible(false); rangeAxis.setPositiveArrowVisible(false); rangeAxis.setVisible(false); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(1, UIConstants.INTEL_DARK_GRAY); xyitemrenderer.setSeriesPaint(0, NodeTypeViz.SWITCH.getColor()); return jfreechart; }
From source file:greenapi.ui.charts.ChartPanelSupport.java
/** * Clean the value of the chart./*from w ww . j a va 2 s.co m*/ * * @see #createChart() */ public void cleanChart() { this.chart.removeLegend(); this.chartPanel.setBorder(null); cleanLabels(); DateAxis localDateAxis = (DateAxis) ((XYPlot) this.chart.getPlot()).getDomainAxis(); localDateAxis.setTickLabelsVisible(false); localDateAxis.setTickMarksVisible(false); localDateAxis.setAxisLineVisible(false); ValueAxis localValueAxis = ((XYPlot) this.chart.getPlot()).getRangeAxis(); localValueAxis.setTickLabelsVisible(false); localValueAxis.setTickMarksVisible(false); localValueAxis.setAxisLineVisible(false); XYPlot localXYPlot = (XYPlot) this.chart.getPlot(); localXYPlot.setDomainGridlineStroke(this.defaultLineStroke); localXYPlot.setDomainGridlinesVisible(true); localXYPlot.setRangeGridlineStroke(this.defaultLineStroke); localXYPlot.setRangeGridlinesVisible(true); localXYPlot.setAxisOffset(new RectangleInsets(0.0D, 0.0D, 0.0D, 0.0D)); localXYPlot.setInsets(new RectangleInsets(0.0D, 0.0D, 0.0D, 0.0D), true); }
From source file:wattsup.jsdk.ui.ChartPanelSupport.java
/** * Clean the values of the chart.//from w ww . j a v a2 s . c om * * @see #createChart() */ public void cleanChart() { this.chart_.removeLegend(); this.chartPanel_.setBorder(null); cleanLabels(); DateAxis localDateAxis = (DateAxis) ((XYPlot) this.chart_.getPlot()).getDomainAxis(); localDateAxis.setTickLabelsVisible(false); localDateAxis.setTickMarksVisible(false); localDateAxis.setAxisLineVisible(false); ValueAxis localValueAxis = ((XYPlot) this.chart_.getPlot()).getRangeAxis(); localValueAxis.setTickLabelsVisible(false); localValueAxis.setTickMarksVisible(false); localValueAxis.setAxisLineVisible(false); XYPlot localXYPlot = (XYPlot) this.chart_.getPlot(); localXYPlot.setDomainGridlineStroke(this.defaultLineStroke_); localXYPlot.setDomainGridlinesVisible(true); localXYPlot.setRangeGridlineStroke(this.defaultLineStroke_); localXYPlot.setRangeGridlinesVisible(true); localXYPlot.setAxisOffset(new RectangleInsets(0.0D, 0.0D, 0.0D, 0.0D)); localXYPlot.setInsets(new RectangleInsets(0.0D, 0.0D, 0.0D, 0.0D), true); }
From source file:org.jivesoftware.openfire.reporting.graph.GraphEngine.java
/** * Generates a Sparkline Bar Graph.//from w ww . j a v a 2 s . com * * @param def the key of the statistic object. * @return the generated chart. */ public JFreeChart generateSparklineBarGraph(String key, String color, Statistic[] def, long startTime, long endTime, int dataPoints) { Color backgroundColor = getBackgroundColor(); IntervalXYDataset dataset = (IntervalXYDataset) populateData(key, def, startTime, endTime, dataPoints); JFreeChart chart = ChartFactory.createXYBarChart(null, // chart title null, // domain axis label true, null, // range axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend false, // tooltips? false // URLs? ); chart.setBackgroundPaint(backgroundColor); chart.setBorderVisible(false); chart.setBorderPaint(null); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.setBackgroundPaint(backgroundColor); plot.setRangeGridlinesVisible(false); GraphDefinition graphDef = GraphDefinition.getDefinition(color); Color plotColor = graphDef.getInlineColor(0); plot.getRenderer().setSeriesPaint(0, plotColor); plot.getRenderer().setBaseItemLabelsVisible(false); plot.getRenderer().setBaseOutlinePaint(backgroundColor); plot.setOutlineStroke(null); plot.setDomainGridlinePaint(null); ValueAxis xAxis = chart.getXYPlot().getDomainAxis(); xAxis.setLabel(null); xAxis.setTickLabelsVisible(true); xAxis.setTickMarksVisible(true); xAxis.setAxisLineVisible(false); xAxis.setNegativeArrowVisible(false); xAxis.setPositiveArrowVisible(false); xAxis.setVisible(false); ValueAxis yAxis = chart.getXYPlot().getRangeAxis(); yAxis.setTickLabelsVisible(false); yAxis.setTickMarksVisible(false); yAxis.setAxisLineVisible(false); yAxis.setNegativeArrowVisible(false); yAxis.setPositiveArrowVisible(false); yAxis.setVisible(false); return chart; }