Shape cross = ShapeUtilities.createDiagonalCross(3, 1); XYPlot xyPlot = (XYPlot) jfreechart.getPlot(); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); XYItemRenderer renderer = xyPlot.getRenderer();
PlotOrientation.VERTICAL, true, true, false); XYPlot xyPlot = (XYPlot) jfreechart.getPlot(); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); XYItemRenderer renderer = xyPlot.getRenderer();
private void showCrosshairsOnAxes(XYPlot plot) { plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); }
private void showCrosshairsOnAxes(XYPlot xyPlot) { xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); }
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { jNextChart.getXYPlot().setDomainCrosshairVisible(false); }
@Override public void run() { if (cache.isEmpty()) { return; } jNextChart.getXYPlot().setDomainCrosshairVisible(true); double xValue = jNextChart.getXYPlot().getDomainCrosshairValue(); double yValue = jNextChart.getXYPlot().getRangeCrosshairValue(); RectangleEdge xEdge = jNextChart.getXYPlot().getDomainAxisEdge(); RectangleEdge yEdge = jNextChart.getXYPlot().getRangeAxisEdge(); Rectangle2D dataArea = jChartPanel.getScreenDataArea(); // jChartPanel.getChartRenderingInfo().getPlotInfo().getSubplotInfo(0).getDataArea(); int x = (int) jNextChart.getXYPlot().getDomainAxis().valueToJava2D(xValue, dataArea, xEdge); int y = (int) jNextChart.getXYPlot().getRangeAxis().valueToJava2D(yValue, dataArea, yEdge); Date date = new Date((long)xValue); jIskValue.setText(iskFormat.format(yValue)); jDateValue.setText(dateFormat.format(date)); TrackerNote trackerNote = Settings.get().getTrackerNotes().get(new TrackerDate(date)); if (trackerNote != null) { jAddNote.setVisible(false); jEditNote.setVisible(true); jNote.setVisible(true); jNote.setText(trackerNote.getNote()); } else { jAddNote.setVisible(true); jEditNote.setVisible(false); jNote.setVisible(false); } jPopupMenu.show((Component)cme.getTrigger().getSource(), x, y); } });
PlotOrientation.VERTICAL, true, true, false); XYPlot xyPlot = (XYPlot) jfreechart.getPlot(); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); XYItemRenderer renderer = xyPlot.getRenderer();
/** * Creates a chart. * * @param dataset * a dataset. * @return A chart. */ private JFreeChart createChart(SimpleHistogramDataset dataset) { String label = "Value"; if (targetAttributeName != null) { label = targetAttributeName.getFullname(); if (label == null || label.trim().length() == 0) label = targetAttributeName.getId(); } chart = ChartFactory.createHistogram(null, label, "Histogram", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.getRenderer().setSeriesPaint(0, new Color(0x7f9f51)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); return chart; }
public static JFreeChart createSummarizerTrend( ArrayList<XYDataset> dataset, String uri) { final JFreeChart chart = ChartFactory.createTimeSeriesChart(uri, "Time", "Response Time", dataset.get(0), true, true, false); chart.setBackgroundPaint(Color.WHITE); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); /* * final NumberAxis axis2 = new NumberAxis("Errors"); axis2.isAutoRange(); * axis2.setLowerBound(0); plot.setRangeAxis(1, axis2); plot.setDataset(1, * dataset.get(1)); plot.mapDatasetToRangeAxis(1, 1); * * final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); * renderer2.setSeriesPaint(0, Color.black); plot.setRenderer(1, renderer2); */ final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss")); final XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, ColorPalette.RED); return chart; }
private JFreeChart createAmountChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart( "", // title resourceMap.getString("graphDate.text"), // x-axis label resourceMap.getString("graphCBills.text"), // y-axis label dataset); chart.setBackgroundPaint(Color.WHITE); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.WHITE); plot.setRangeGridlinePaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setDefaultShapesVisible(true); renderer.setDefaultShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); chart.removeLegend(); return chart; }
plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
/** * Creates a chart. * * @param dataset * a dataset. * * @return A chart. */ private JFreeChart createChart(SimpleHistogramDataset dataset) { chart = ChartFactory.createHistogram(null, engl("Value"), engl("Histogram"), dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.getRenderer().setSeriesPaint(0, new Color(0x7f9f51)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); return chart; }
plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true);
plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true);
plot.setRenderer(renderer); plot.setOrientation(orientation); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true);
plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true);
plot.setRenderer(renderer); plot.setOrientation(orientation); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot.setRenderer(renderer); plot.setOrientation(orientation); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
public JFreeChart createStackedAreaChart(String title, TableXYDataset dataset) { DateAxis domainAxis = new DateAxis("Date"); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); NumberAxis rangeAxis = new NumberAxis("Minutes"); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperMargin(0.10); StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2(); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator()); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER)); renderer.setSeriesPaint(0, Color.lightGray); XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); plot.setRenderer(0, renderer); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); LegendTitle legend = new LegendTitle(plot); legend.setBackgroundPaint(Color.white); legend.setFrame(new BlockBorder()); legend.setPosition(RectangleEdge.BOTTOM); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.removeLegend(); chart.setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); chart.addSubtitle(legend); return chart; }