I'm using JFreeChart, I want to scale this graph according to scale given beside, How can i scale this graph? Is there any Solution to this problem?
While Googling, I found writeScaledChartAsPNG, can i use this, how?
I need to scale the rangeAxis
It looks like writeScaledChartAsPNG() simply resamples the existing chart. Instead, use a zoom-related method of ChartPanel, such as zoomInRange(), and save the chart using writeChartAsPNG(). You might also experiment with zoomRange() on your rangeAxis.
Related
Basically I am attempting to use JFreeChart right now to graph some values. The only problem is that the values are incredibly minuscule, e.g 7.069781E-13. I believe these values are too small for JFreeChart to display. How can I display these small values visually in Java in a line chart format?
It looks like this currently:
And I want to make it look similar to this:
I found a work around.
I simply multiplied all the values by a factor of 100 so the graph now looks similar to the one in the example. I will include a disclaimer in the legend saying the chart has been multiplied by a factor to clearly see the line chart.
Also consider these alternative:
Invoke setRange(), seen here, to expand the y axis in the area of interest.
Add suitable controls, seen here, to control y zoom.
Advise users how to use the mouse for zoom control, as shown here.
I'm using JFreeChart 1.0.14 in Swing application.
I have chart with multiple Y-Axis and I want to change source Axis for chart grid lines. Now them always base on one axis, even if I hide it.
I know there are few similar questions but they are old and I wonder if solution exists now.
If it doesn't what is the best workaround in this task?
For example:
http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=27885&sid=c4c609f3809d29a46e3e2bbccfac361e
There is still no way to do it natively unfortunately.
I was suggested to override XYPlot's drawRangeGridLines method, but I decided to go another way: to make it works you only need to change axis order because grid lines always depend on 0th axis (and its dataset). Make sure your axis has 0th index in plot axis collection.
NumberAxis axis = new NumberAxis(name);
plot.setRangeAxis(0, axis);
I think it's easiest way at this moment.
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'd like to be able to set a colour of every point (addressed by x&y, where x is a DateTime (of joda-time, actually) and y is a double) on a chart to represent a z=f(x,y) value. Is it possible with JFreeChart?
If I understood your needs correctly I think you want to use an XYPlot with an XYBlockRenderer.
Quoting the docs:
A renderer that represents data from an XYZDataset by drawing a color block at each (x, y) point, where the color is a function of the z-value from the dataset
Check the sample image in the docs for XYBlockRenderer: http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/xy/XYBlockRenderer.html
I recommend http://www.jzy3d.org
Here are some example charts: http://www.jzy3d.org/gallery.php
And example code to plot a surface: https://github.com/jzy3d/jzy3d-api/tree/master/jzy3d-tutorials
As far as I remember that's not possible by default. You can set only one color for every plotted series. However, I think it's possible to extend AbstractRenderer and achieve what you need.
Of course there is possibility that I'm mistaking. Dont remember for sure. :P
I am using jfreechart for plotting graphs. The problem is that if have more entries on the X-axis, then the X-axis parameters are not visible. How should I solve that?
Change the scale of the graph until you can see the parameters.