JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis domain = (DateAxis) plot.getDomainAxis();
public JFreeChart getChart(){ return chartPanel.getChart(); }
public MouseMarker(ChartPanel panel) { this.panel = panel; this.chart = panel.getChart(); this.plot = (XYPlot) chart.getPlot(); }
ChartPanel chartPanel; JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); XYDataset data = plot.getDataset();
ChartPanel chartPanel1 = createDemoPanel("Chart1"); ChartPanel chartPanel2 = createDemoPanel("Chart2"); XYPlot plot1 = chartPanel1.getChart().getXYPlot(); XYPlot plot2 = chartPanel2.getChart().getXYPlot(); plot2.setDomainAxis(plot1.getDomainAxis()); chartPanel1.setLayout(new GridLayout()); chartPanel2.setLayout(new GridLayout()); JSplitPane splitPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT, chartPanel1, chartPanel2); add(splitPane, BorderLayout.CENTER);
public static JPanel wrapChart(ChartPanel chartPanel) { JPanel panel = new JPanel(new BorderLayout()); panel.add(chartPanel, BorderLayout.CENTER); panel.add(createLegend(chartPanel.getChart().getPlot()), BorderLayout.SOUTH); return panel; } private static JPanel createLegend(Plot plot) { JPanel panel = new JPanel(); // Using FlowLayout here Iterator iterator = plot.getLegendItems().iterator(); while (iterator.hasNext()) { LegendItem item = (LegendItem) iterator.next(); JLabel label = new JLabel(item.getLabel()); label.setIcon(new ColorIcon(8, item.getFillPaint())); panel.add(label); } return panel; }
public void removeAnnotation() { if (selectedArea != null) { chartPanel.getChart().getXYPlot().removeAnnotation(selectedArea); selectedArea = null; } }
public void removeAnnotation() { if (selectedArea != null) { chartPanel.getChart().getXYPlot().removeAnnotation(selectedArea); selectedArea = null; } }
private XYSeriesCollection getCategory() { return (XYSeriesCollection) panel.getChart().getXYPlot().getDataset(); }
private void toggleColor() { BufferedImage image = plot.getImage(); if (image != null) { if (!plotColorsInverted) { image = new BufferedImage(untoggledColorModel, image.getRaster(), image.isAlphaPremultiplied(), null); } else { image = new BufferedImage(toggledColorModel, image.getRaster(), image.isAlphaPremultiplied(), null); } plot.setImage(image); densityPlotDisplay.getChart().setNotify(true); plotColorsInverted = !plotColorsInverted; } }
private void toggleColor() { BufferedImage image = plot.getImage(); if (image != null) { if (!plotColorsInverted) { image = new BufferedImage(untoggledColorModel, image.getRaster(), image.isAlphaPremultiplied(), null); } else { image = new BufferedImage(toggledColorModel, image.getRaster(), image.isAlphaPremultiplied(), null); } plot.setImage(image); densityPlotDisplay.getChart().setNotify(true); plotColorsInverted = !plotColorsInverted; } }
MouseListenerValue( final ChartPanel panel, final double startValue ) { this.panel = panel; this.valueMarker = makeMarker( startValue ); ((XYPlot)panel.getChart().getPlot()).addDomainMarker( valueMarker ); }
public static int getChartXLocation( final Point point, final ChartPanel panel ) { final Point2D p = panel.translateScreenToJava2D( point ); final Rectangle2D plotArea = panel.getScreenDataArea(); final XYPlot plot = (XYPlot) panel.getChart().getPlot(); final double chartX = plot.getDomainAxis().java2DToValue( p.getX(), plotArea, plot.getDomainAxisEdge() ); //final double chartY = plot.getRangeAxis().java2DToValue( p.getY(), plotArea, plot.getRangeAxisEdge() ); return (int)Math.round( chartX ); }
public static int getChartXLocation( final Point point, final ChartPanel panel ) { final Point2D p = panel.translateScreenToJava2D( point ); final Rectangle2D plotArea = panel.getScreenDataArea(); final XYPlot plot = (XYPlot) panel.getChart().getPlot(); final double chartX = plot.getDomainAxis().java2DToValue( p.getX(), plotArea, plot.getDomainAxisEdge() ); //final double chartY = plot.getRangeAxis().java2DToValue( p.getY(), plotArea, plot.getRangeAxisEdge() ); return (int)Math.round( chartX ); }
public static void addVerticalMarkerToXYPlot(ChartPanel chartPanel, double xValue) { ValueMarker marker = new ValueMarker(xValue); marker.setPaint(Color.BLACK); XYPlot plot = (XYPlot) chartPanel.getChart().getPlot(); plot.addDomainMarker(marker); }
public static void addVerticalMarkerToXYPlot(ChartPanel chartPanel, double xValue) { ValueMarker marker = new ValueMarker(xValue); marker.setPaint(Color.BLACK); XYPlot plot = (XYPlot) chartPanel.getChart().getPlot(); plot.addDomainMarker(marker); }
@Override public void doRefresh() { if (bundle.hasChanges()) { bundle.setHasChanges(false); final ChartPanel newChartPanel = makeChartPanel(bundle); final JFreeChart chart = newChartPanel.getChart(); chartPanel.setChart(chart); } } }
private void addAnnotation() { selectedArea = new SelectedArea(createShape(), fillPaint); chartPanel.getChart().getXYPlot().addAnnotation(selectedArea); }
private void addAnnotation() { selectedArea = new SelectedArea(createShape(), fillPaint); chartPanel.getChart().getXYPlot().addAnnotation(selectedArea); }
MouseListenerTimelapse( final TimePoints timepoints, final ChartPanel panel, final int referenceTimePoint, final boolean enableReferenceTimePoint ) { this.timepoints = timepoints; this.panel = panel; this.referenceTimePoint = referenceTimePoint; this.enableReferenceTimePoint = enableReferenceTimePoint; if ( enableReferenceTimePoint || referenceTimePoint != -1 ) // at least show it if it is not -1 { if ( timepoints != null ) setReferenceTimepoint( timepoints, referenceTimePoint ); valueMarker = makeMarker( referenceTimePoint ); if ( referenceTimePoint >= 0 ) { ((XYPlot)panel.getChart().getPlot()).addDomainMarker( valueMarker ); markerShown = true; } } }