List of usage examples for org.jfree.chart.axis DateAxis setAxisLineVisible
public void setAxisLineVisible(boolean visible)
From source file:eu.kprod.gui.chart.MwChartFactory.java
public static MwChartPanel createChart(MwConfiguration conf, final XYDataset xyDataset) { final JFreeChart chart; chart = ChartFactory.createTimeSeriesChart(null, null, null, xyDataset, false, true, true); chart.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); chart.setBorderVisible(false);//from w w w. j av a 2 s. c o m final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); plot.setDomainGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setRangeGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final DateAxis axis = (DateAxis) plot.getDomainAxis(); // axis.setDateFormatOverride(new SimpleDateFormat("mm''ss''''SSS")); axis.setAxisLineVisible(false); axis.setTickLabelsVisible(false); axis.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // force integer display final ValueAxis va = plot.getRangeAxis(); va.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); va.setLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setAxisLinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // va.setRange(-280,280); // va.setFixedAutoRange(560); // va.setLowerBound(-280); // va.setUpperBound(280); // va.setAutoRange(false); va.setRangeWithMargins(-280, 280); final MwChartPanel chartPanel = new MwChartPanel(chart, conf); chartPanel.setMouseWheelEnabled(false); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); return chartPanel; }
From source file:org.multiwii.swingui.gui.chart.MwChartFactory.java
public static MwChartPanel createChart(MwConfiguration conf, final XYDataset xyDataset) { final JFreeChart chart; chart = ChartFactory.createTimeSeriesChart(null, null, null, xyDataset, false, true, true); chart.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); chart.setBorderVisible(false);//from ww w . j a va2s .c o m final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(conf.color.getColor(MwColor.BACKGROUND_COLOR)); plot.setDomainGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setRangeGridlinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainGridlinesVisible(false); plot.setDomainCrosshairPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final DateAxis axis = (DateAxis) plot.getDomainAxis(); // axis.setDateFormatOverride(new SimpleDateFormat("mm''ss''''SSS")); axis.setAxisLineVisible(false); axis.setTickLabelsVisible(false); axis.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // force integer display final ValueAxis va = plot.getRangeAxis(); va.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); va.setLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setAxisLinePaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); va.setTickLabelPaint(conf.color.getColor(MwColor.FORGROUND_COLOR)); // va.setRange(-280,280); // va.setFixedAutoRange(560); // va.setLowerBound(-280); // va.setUpperBound(280); // va.setAutoRange(false); va.setRangeWithMargins(-280, 280); final MwChartPanel chartPanel = new MwChartPanel(chart, conf); chartPanel.setMouseWheelEnabled(false); chartPanel.setDomainZoomable(false); chartPanel.setRangeZoomable(false); return chartPanel; }
From source file:scrum.server.common.BurndownChart.java
private static JFreeChart createSprintBurndownChart(List<BurndownSnapshot> snapshots, Date firstDay, Date lastDay, Date originallyLastDay, WeekdaySelector freeDays, int dateMarkTickUnit, float widthPerDay) { DefaultXYDataset data = createSprintBurndownChartDataset(snapshots, firstDay, lastDay, originallyLastDay, freeDays);/* www . j a v a2 s .c o m*/ double tick = 1.0; double max = BurndownChart.getMaximum(data); while (max / tick > 25) { tick *= 2; if (max / tick <= 25) break; tick *= 2.5; if (max / tick <= 25) break; tick *= 2; } double valueLabelTickUnit = tick; double upperBoundary = Math.min(max * 1.1f, max + 3); if (!Sys.isHeadless()) LOG.warn("GraphicsEnvironment is not headless"); JFreeChart chart = ChartFactory.createXYLineChart("", "", "", data, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot plot = chart.getXYPlot(); // plot.setInsets(new RectangleInsets(0, 0, 0, 0)); plot.setAxisOffset(RectangleInsets.ZERO_INSETS); // plot.setOutlineVisible(false); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); plot.setDomainGridlinePaint(Color.lightGray); // plot.setRangeCrosshairPaint(Color.lightGray); // plot.setRangeMinorGridlinePaint(Color.lightGray); // plot.setDomainCrosshairPaint(Color.blue); // plot.setDomainMinorGridlinePaint(Color.green); // plot.setDomainTickBandPaint(Color.green); XYItemRenderer renderer = plot.getRenderer(); renderer.setBaseStroke(new BasicStroke(2f)); renderer.setSeriesPaint(0, COLOR_PAST_LINE); renderer.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); renderer.setSeriesPaint(1, COLOR_PROJECTION_LINE); renderer.setSeriesStroke(1, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 3f }, 0)); renderer.setSeriesPaint(2, COLOR_OPTIMUM_LINE); renderer.setSeriesStroke(2, new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL)); DateAxis domainAxis1 = new DateAxis(); String dateFormat = "d."; widthPerDay -= 5; if (widthPerDay > 40) { dateFormat = "EE " + dateFormat; } if (widthPerDay > 10) { float spaces = widthPerDay / 2.7f; dateFormat = Str.multiply(" ", (int) spaces) + dateFormat; } domainAxis1.setDateFormatOverride(new SimpleDateFormat(dateFormat, Locale.US)); domainAxis1.setTickUnit(new DateTickUnit(DateTickUnit.DAY, dateMarkTickUnit)); domainAxis1.setAxisLineVisible(false); Range range = new Range(firstDay.toMillis(), lastDay.nextDay().toMillis()); domainAxis1.setRange(range); DateAxis domainAxis2 = new DateAxis(); domainAxis2.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 1)); domainAxis2.setTickMarksVisible(false); domainAxis2.setTickLabelsVisible(false); domainAxis2.setRange(range); plot.setDomainAxis(0, domainAxis2); plot.setDomainAxis(1, domainAxis1); plot.setDomainAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); NumberAxis rangeAxis = new NumberAxis(); rangeAxis.setNumberFormatOverride(NumberFormat.getIntegerInstance()); rangeAxis.setTickUnit(new NumberTickUnit(valueLabelTickUnit)); rangeAxis.setLowerBound(0); rangeAxis.setUpperBound(upperBoundary); plot.setRangeAxis(rangeAxis); return chart; }
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 www. jav a 2 s . c om 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 w w .j a v a 2 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:wattsup.jsdk.ui.ChartPanelSupport.java
/** * Clean the values of the chart./*from w w w .ja v a 2 s .c o 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:org.jivesoftware.openfire.reporting.graph.GraphEngine.java
/** * Generates a simple Time Axis./*from ww w.j av a 2 s . c o m*/ * * @return the generated Time Axis. */ private DateAxis generateTimeAxis() { DateAxis xAxis = new DateAxis(""); xAxis.setLowerMargin(0.05); xAxis.setUpperMargin(0.02); xAxis.setLabel(null); xAxis.setTickLabelsVisible(true); xAxis.setTickMarksVisible(true); xAxis.setAxisLineVisible(true); xAxis.setNegativeArrowVisible(false); xAxis.setPositiveArrowVisible(false); xAxis.setVisible(true); xAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); Locale locale = JiveGlobals.getLocale(); // If the tick units have not yet been setup or the locale has changed if (tickUnits == null || !locale.equals(oldLocale)) { tickUnits = createTickUnits(locale, JiveGlobals.getTimeZone()); oldLocale = locale; } xAxis.setStandardTickUnits(tickUnits); return xAxis; }