0

I am new to jfreecharts. I have 3 functions and their sum plotted in one chart. This works fine (like http://www.java2s.com/Code/Java/Chart/JFreeChartXYLogAxesDemo.htm except that my x axis is linear).

Now I would like to vary one parameter of these function over a small range. I would like to see something like http://www.originlab.com/www/resources/graph_gallery/images_galleries/Choe_as_3D_Waterfall_500px.gif or this bar graph http://www.statsref.com/HTML/bars3d_demo.png where each xy plane would have the 4 functions plotted on it.

I could perhaps use some kind of bar chart to combine the 4 functions like http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.2/CLR4.0/html/Images/Chart_Working_2D_Stacked_Column_Chart_Data_01.png, so a stacked series of these might work.

Failing that, how would one get jfreechart to display an matrix chart? Is there some stuff built in to jfreechart or does one have to make a bunch of chart panels and add them to a panel?

Thanks

Ray Tayek
  • 9,841
  • 8
  • 50
  • 90

2 Answers2

0

I can't tell you how to do it in JFreeChart, but in XChart it's very simple to create a chart matrix like you described.

Take a look at Example 4: Create a Chart Matrix.

The code would look something like this:

int numCharts = 4;

List<Chart> charts = new ArrayList<Chart>();

for (int i = 0; i < numCharts; i++) {
  charts.add(QuickChart.getChart("" + i, "X", "Y", null, null, getRandomWalk(1000)));
}
new SwingWrapper(charts).displayChartMatrix();

, where getRandomWalk(1000) would need to be replaced by your own y-axis data set.

herrtim
  • 2,697
  • 1
  • 26
  • 36
  • thanks, i may try this if i can't find an easy way to solve this using jfreechart – Ray Tayek Feb 01 '13 at 20:27
  • i did try this and it's very easy to do. but i can't get the plots in the different windows to have the same range on the y axis: http://stackoverflow.com/questions/14767577/how-to-make-limits-on-the-y-axis-be-the-same-using-xchart – Ray Tayek Feb 09 '13 at 05:09
0

I had the same problem and discovered this code snippet: CombinedDomainXYPlot

It uses a "CombinedDomainXYPlot" to achieve it.

mmirwaldt
  • 843
  • 7
  • 17