I would like to be able to drag the plot area to be able to move the x-axis across.
Is this possible?
It certainly is. Check out this Java Web Start demo. The XYPlot (for example) supports the Pannable interface.
Related
I want to get the bounds (i.e. Bounds) of the XYChart plot area, which I define as the area contained within the axes of the plot (i.e. the axes form two legs of a rectangle). The ultimate purpose is to constrain a rubber band rectangle on the plot area. I started with this example and added in the constraint.
Based on the comments from James_D and kleopatra, I created a MVCE. I think the MVCE works remarkably well and compiles without warnings. More importantly, kleopatra's comment led to finding the bug when using the chart-plot-background method. The MVCE implements both methods. The chart-plot-background works for both ValueAxis and CategoryAxis. The axis method currently only works for ValueAxis.
Is using the bounds of .chart-plot-background a reliable method for determining the plot area or is using the value bounds of each axis more reliable? The axis approach definitely has more steps and more code.
Other options
I looked at the JavaFX source and plotArea looked promising but it isn't accessible.
The plotContent member is accessible via lookup(".plot-content") but groups all the data points, some of which may be outside the range set in the axes. Thus, the bounds of plotContent can be larger than the plot area bounds.
I need to create a scatter plot in Java, which shows a label in a point position. For example, I have a plot with a point in position (10,20), I need to show a string in that position of the plot instead of a colored point. Is this possible using some library? I have been trying with JChart2D, JFreeChart without success, I just get normal scatter plots.
Thanks for your time.
I am using JFreeChart in my java application.
Problem
I want to plot a XYAreaChart whose domain axis (x-axis) should scroll horizontally automatically when we start plotting the data.
I saw the same thing in TimeSeriesCharts but I don't want any timeSeriesChart. I just want the scrolling x-axis.
You'll need to create your own SlidingXYDataset that implements XYDataset in a manner similar to how SlidingCategoryDataset implements CategoryDataset.
Addendum: As noted in a comment, a typical implementation can be found here.
I'm using a combined plot composed of 2 graph which share the same X axis (by sharing, I mean, the timeframe is the same for the two graph). The upper graph is a regular timeseries while the lower chart is a barchart. I would like to display a crosshair on the combined chart as a whole... Right now I can display crosshair only on each graph separately even thought I have specify on the combined plot that I wanted to display the crosshair. To be more explicit, I can't synchronise both crosshair... Any idea on how to achieve that ?
thanks
It would appear to work if you use a shared domain axis, as discussed here and as shown in CrosshairDemo2? In addition, an sscce might help clarify your usage.
I have drawn a XY chart using jfree. Now i want to add zoom functionality to it. This must be done using a slider at the bottom of the chart. How can i add zoom functionality, the likes of which is present in Windows Photo Viewer?
Also, i would like to show the current Y-value of the graph as a tooltip when the user hovers his mouse over the plotted line. I am not getting much ideas.
Please help.
Thanks in advance
XYPlot et al. implement the Zoomable interface, which allows ChartPanel to control zooming. I'd think you could use these methods in your slider's ChangeListener.
I would like to show the current Y-value of the graph as a tooltip…
You can enable tool tips, as shown in this example.