jfreechart

JFreeChart & Image

别等时光非礼了梦想. 提交于 2019-12-01 06:42:11
Is it possible to cast an image/BufferedImage to JFreeChart? Casting an image to JFree is not possbile. To create an image from JFreechart you can do the following: BufferedImage objBufferedImage=objJFreechart.createBufferedImage(600,800); ByteArrayOutputStream bas = new ByteArrayOutputStream(); try { ImageIO.write(objBufferedImage, "png", bas); } catch (IOException e) { e.printStackTrace(); } byte[] byteArray=bas.toByteArray(); This creates the byte[] . Now you need to create the image from byte[]. The following does this. InputStream in = new ByteArrayInputStream(obj); BufferedImage image =

JFreeChart Bar Graph Labels

拈花ヽ惹草 提交于 2019-12-01 06:31:53
I have made it possible for value labels to appear on top of the bar in JFreeChart. However, it would look better if the labels are inside the bars. How do I make this work? The image below shows what I wanted the graph to look like. I used the following code to make it work: StackedBarRenderer renderer = new StackedBarRenderer(false); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); chart.getCategoryPlot().setRenderer(renderer);` Just specify the desired ItemLabelPosition in your CategoryItemLabelGenerator . BarChartDemo3

How to get diamond shape for points in JFreechart

我们两清 提交于 2019-12-01 06:19:07
问题 I need to get A diamond shapes on my Timeseries in JFreechart, but I am unable to do it. Can someone please guide as to what code should be added to the code below to achieve the Diamond shape points and also how to change colours of the lines? (The program uses rs and stmt and other things which are derived from the DB and are defined somewhere else. The program works properly right now, only problem is that it looks super boring.) TimeSeries s1 = new TimeSeries("Technology", Day.class);

How to display a JFreeChart in a NetBeans project

给你一囗甜甜゛ 提交于 2019-12-01 05:13:44
This is similar to a question I asked yesterday but more specific to the problem. What is the correct method to add a JFreeChart to a NetBeans project which already contains various widgets? My updateChart() hides the entire JFrame. I'd like to add the JFreeChart to the JFrame. public class MyClass extends javax.swing.JFrame implements TableModelListener { public MyClass() { initComponents(); ... updateChart(); } private void updateChart() { XYDataset dataset = createXYdataset(); JFreeChart chart = createChart(dataset); JPanel chartPanel = new ChartPanel(chart); setContentPane(chartPanel); }

JFreeChart with highlighted points

别说谁变了你拦得住时间么 提交于 2019-12-01 04:26:18
I am using JFreeChart to draw a graph. The code is package com.daya; import java.awt.Color; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.RefineryUtilities

JFreeChart & Image

送分小仙女□ 提交于 2019-12-01 04:15:00
问题 Is it possible to cast an image/BufferedImage to JFreeChart? 回答1: Casting an image to JFree is not possbile. To create an image from JFreechart you can do the following: BufferedImage objBufferedImage=objJFreechart.createBufferedImage(600,800); ByteArrayOutputStream bas = new ByteArrayOutputStream(); try { ImageIO.write(objBufferedImage, "png", bas); } catch (IOException e) { e.printStackTrace(); } byte[] byteArray=bas.toByteArray(); This creates the byte[] . Now you need to create the image

JFreeChart Polar chart fill Zero to the point

。_饼干妹妹 提交于 2019-12-01 02:15:19
May be I could not phrase t the question right. Let me Explain I want to draw polar chart that starts the value from the zero and fill it to the desired point. When I plot graph it show something like this But I am looking for something like this Here is the sample Code import java.awt.Color; import java.awt.Dimension; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.PolarChartPanel; import org.jfree.chart.plot.PolarPlot; import org.jfree.chart.renderer.DefaultPolarItemRenderer; import org.jfree.data.xy.XYDataset;

JFreeChart with highlighted points

让人想犯罪 __ 提交于 2019-12-01 01:53:19
问题 I am using JFreeChart to draw a graph. The code is package com.daya; import java.awt.Color; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree

JfreeChart: Scroll XYBarChart Horizontally - (chart translation and navigation)

邮差的信 提交于 2019-12-01 00:33:12
I am trying to scroll my XYBarChart horizontally, I am following one of the JfreeChart's Demo "TranslateDemo1.java" in which the source code you can find here: http://code.google.com/p/cori-chenxx/source/browse/aliper/trunk/aliper-core/src/test/java/com/alibaba/aliper/TranslateDemo1.java?spec=svn148&r=148 The source code works fine for a "TimeSeriesChart". However I tried with "XYBarChart" and WHEN I SLIDE THE BAR the behavior is not the same. Just to be clear I replaced the line #157 with the following source code: JFreeChart chart1= ChartFactory.createXYBarChart( "Title", null, true, "Ylabel

Why do I have to call GraphicsEnvorinment.registerFont() even if I my Font were created from file?

久未见 提交于 2019-11-30 23:13:21
I'm developing a web application which use JFreeChart to render chart. However, when server dose not have any Chinese font installed, JFreeChart dose not display Chinese character even if I have set the font. Then I write a small testing code and find out that add this line of code before drawing the chart can solve the problem. GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font); So my questions are - Why do I have to register font into JVM even if I create my font from File ? Dose that mean JFreeChart do not use the font I set directly ? When I deploy my program into server,