jfreechart

Customize subtitle position - JFreeChart

别来无恙 提交于 2019-11-29 12:49:53
I want to know if it is possible to put a JFreeChart subtitle in the bottom of the chart, under the chart, and not under the Title. What I want to do is illustrated on these images: http://i.stack.imgur.com/AmPJ8.jpg and http://i.stack.imgur.com/VBfvL.jpg . I just tried almost everything and cannot do this. I am using subtitle insted of legend, because legend is presented with a red square, indicating the color of the series shown on the graphics. Thanks in advance! Joey In this example , the following TextTitle appears to work. chart.addSubtitle(new TextTitle(new Date().toString(), new Font(

How to make plot a curve using JFreeChart?

纵然是瞬间 提交于 2019-11-29 12:19:09
I have managed to plot a linear graph. The following is the code: private JPanel createGraph() { JPanel panel = new JPanel(); XYSeries series = new XYSeries("MyGraph"); series.add(0, 1); series.add(1, 2); series.add(2, 5); series.add(7, 8); series.add(9, 10); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createXYLineChart( "XY Chart", "x-axis", "y-axis", dataset, PlotOrientation.VERTICAL, true, true, false ); ChartPanel chartPanel = new ChartPanel(chart); panel.add(chartPanel); return panel; } However, it is not a smooth curve

jfreechart crashes when using Yahoo Finance Quotes

和自甴很熟 提交于 2019-11-29 12:09:44
QUESTION RESOLVED: solution is changing to JFreeChart v1.0.15 I have a very peculiar problem. What I have set up is a file that sends a url request to the Yahoo Finance website and then uses the results to draw a JFreeChart in a JFrame. What I just can't get my head around is the following: For certain url requests, the JFrame crashes It starts, but only shows a white screen. Whereas for other requests, my program works fine. Example For example: This request: "http://ichart.yahoo.com/table.csv?s=GOOG&a=0&b=1&c=2011&d=6&e=24&f=2013&g=d&ignore=.csv"; works fine. But this request: "http://ichart

JFreeChart doesn't appear when I click on button

自古美人都是妖i 提交于 2019-11-29 12:08:14
I see no output for this code in panel, but in console points (X,Y) come out. I searched more and more and nothing. This is UI class: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.dspTasks.UI; import dsp.ReadFile; import java.awt.BorderLayout; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JPanel; import org.jfree.*; import org.jfree.chart

JFreeChart with dual x-axis

喜你入骨 提交于 2019-11-29 11:19:53
I'd like to ask if it is possible to have a time series chart with dual x-axis (or y-axis but because it is a time series dataset I focus on dual x-axis). I have two data files in which the measurements were made during a minute or a whole day. As a result I can't have one x-axis. So, one solution is to transmorm one data file to the format of the other or to have two different x-axis. The second solution is it possible to be done? I found JFreeChartDualAxisDemo but it isn't what I want. Thanks in advance for any help!!! EDIT: I have the following code and I'm trying to create a Time Series

Dynamically generate JFreeChart in servlet

筅森魡賤 提交于 2019-11-29 10:51:05
I'm trying to generate graphs dynamically using JFreeChart as a result of some checkboxes the user selects, but I can't figure out how best to get the generated datasets into chart form (I have code that makes charts from these, but need to produce pngs) and into the JSP view. Currently, I can only think of sending the Datasets to the JSP, but can't think of what to do from there... How do I make it so that: user submits form to servlet, servlet generates datasets, charts produced from datasets, pngs from charts and finally pngs dispatched to jsp? Or something along those lines. public void

Saving a PNG file on a server in a Java bean, using JSTL

橙三吉。 提交于 2019-11-29 08:59:15
I am writing an update page in JSTL where the user inputs some numbers. I then call a java bean - passing the numbers as parameters - which, using JFreeChart, creates a PNG image. All of this works fine when I save the file directly on my hard drive using ImageIO.write(myBufferedImage, "png", new File("C:/testChart.png")); I can also save the image to my tomcat directory and view it when I am running the website on my localhost. However, once this code is up on a server that is not my local host, saving to the tomcat directory won't work. How do I write this file directly to the server..say to

Adding date/time to JFreeChart graph

孤街醉人 提交于 2019-11-29 08:11:10
I currently have a method which queries a database for values, and plots them to a graph. The only problem is, the time variable is a long, and results in my graph looking like this: I want to convert it to a date format and then add it to the graph. How can I do this? Here is my graph code: private Long time; private Long intensity; public XYSeries series = new XYSeries("Sensor"); private XYDataset xyDataset; public JFreeChart chart; xyDataset = new XYSeriesCollection(series); chart = ChartFactory.createXYLineChart("Sensor Data", "Time", "Intensity", xyDataset, PlotOrientation.VERTICAL, true,

Jfreechart - Refresh a chart according to changing data

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 03:59:14
I would like to know how to refresh a chart if we want to change "in live" some piece of data. I mean for instance, I have a chart with a TaskSeries which appears on 3 years and I would like to change 3 years by 5 years. I want the chart to change immediately. Is there some kind of update chart or something like that ? I know that you could say "get your TaskSeries, do your changes and it will be refreshed automatically" but my TaskSeries are generated and I cannot easily change these ones. That's why I would like to find a way to recalculate and to rebuild the whole chart. trashgod The add()

JFreeChart Scatter Plot Lines

荒凉一梦 提交于 2019-11-29 01:53:02
I'm trying to create a graph with JFreeChart, however it doesn't get the lines right. Instead of connecting the points in the order I put them, it connects the points from in order of their x-values. I'm using ChartFactory.createScatterPlot to create the plot and a XYLineAndShapeRenderer to set the lines visible. /edit: sscce: package test; 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.chart.renderer.xy.XYLineAndShapeRenderer; import org