Hooray... sonews/0.5.0 final
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Remove all lines to abort the collapse operation.
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package org.sonews.web;
21 import info.monitorenter.gui.chart.Chart2D;
22 import info.monitorenter.gui.chart.IAxis.AxisTitle;
23 import java.awt.Color;
24 import java.awt.image.BufferedImage;
25 import java.io.ByteArrayOutputStream;
26 import java.io.IOException;
27 import javax.imageio.ImageIO;
30 * A chart rendered to a memory bitmap.
31 * @author Christian Lins
34 class MemoryBitmapChart extends Chart2D
37 public MemoryBitmapChart()
39 setGridColor(Color.LIGHT_GRAY);
40 getAxisX().setPaintGrid(true);
41 getAxisY().setPaintGrid(true);
42 getAxisX().setAxisTitle(new AxisTitle("time of day"));
43 getAxisY().setAxisTitle(new AxisTitle("processed news"));
46 public String getContentType()
51 public byte[] getRawData(final int width, final int height)
54 setSize(width, height);
55 BufferedImage img = snapShot(width, height);
56 ByteArrayOutputStream out = new ByteArrayOutputStream();
57 ImageIO.write(img, "png", out);
58 return out.toByteArray();