// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
package demo;
import java.awt.Color;
import java.awt.Font;
import java.io.*;
import org.jfree.chart.*;
import org.jfree.chart.axis.*;
import org.jfree.chart.entity.StandardEntityCollection;
import org.jfree.chart.imagemap.ImageMapUtilities;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.general.DatasetUtilities;
import org.jfree.ui.*;
import org.jfree.util.UnitType;
public class ImageMapDemo3
{
public ImageMapDemo3()
{
}
public void saveImageAndHTML()
{
double ad[][] = {
{
56D, -12D, 34D, 76D, 56D, 100D, 67D, 45D
}, {
37D, 45D, 67D, 25D, 34D, 34D, 100D, 53D
}, {
43D, 54D, 34D, 34D, 87D, 64D, 73D, 12D
}
};
CategoryDataset categorydataset = DatasetUtilities.createCategoryDataset("Series ", "Type ", ad);
JFreeChart jfreechart = createChart(categorydataset);
try
{
ChartRenderingInfo chartrenderinginfo = new ChartRenderingInfo(new StandardEntityCollection());
File file = new File("areachart100.png");
ChartUtilities.saveChartAsPNG(file, jfreechart, 600, 400, chartrenderinginfo);
File file1 = new File("areachart100.html");
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(file1));
PrintWriter printwriter = new PrintWriter(bufferedoutputstream);
printwriter.println("");
printwriter.println("");
printwriter.println("
JFreeChart Image Map Demo");
printwriter.println("");
ImageMapUtilities.writeImageMap(printwriter, "chart", chartrenderinginfo);
printwriter.println("
");
printwriter.println("
");
printwriter.println("");
printwriter.close();
}
catch (IOException ioexception)
{
System.out.println(ioexception.toString());
}
}
private JFreeChart createChart(CategoryDataset categorydataset)
{
JFreeChart jfreechart = ChartFactory.createAreaChart("Area Chart", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, true);
jfreechart.setBackgroundPaint(Color.white);
TextTitle texttitle = new TextTitle("An area chart demonstration. We use this subtitle as an example of what happens when you get a really long title or subtitle.");
texttitle.setFont(new Font("SansSerif", 0, 12));
texttitle.setPosition(RectangleEdge.TOP);
texttitle.setPadding(new RectangleInsets(UnitType.RELATIVE, 0.050000000000000003D, 0.050000000000000003D, 0.050000000000000003D, 0.050000000000000003D));
texttitle.setVerticalAlignment(VerticalAlignment.BOTTOM);
jfreechart.addSubtitle(texttitle);
CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();
categoryplot.setForegroundAlpha(0.5F);
categoryplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
categoryplot.setBackgroundPaint(Color.lightGray);
categoryplot.setDomainGridlinesVisible(true);
categoryplot.setDomainGridlinePaint(Color.white);
categoryplot.setRangeGridlinesVisible(true);
categoryplot.setRangeGridlinePaint(Color.white);
CategoryAxis categoryaxis = categoryplot.getDomainAxis();
categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
categoryaxis.setLowerMargin(0.0D);
categoryaxis.setUpperMargin(0.0D);
NumberAxis numberaxis = (NumberAxis)categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
numberaxis.setLabelAngle(0.0D);
return jfreechart;
}
public static void main(String args[])
{
ImageMapDemo3 imagemapdemo3 = new ImageMapDemo3();
imagemapdemo3.saveImageAndHTML();
}
}