jfreechart

Time series chart horizontal gridlines through min/max peaks

有些话、适合烂在心里 提交于 2019-12-02 11:08:17
I am using JFreeChart to plot a timeseries chart. The chart is working fine, but the gridline alignment is becoming a problem. My requirement is to show the horizontal gridlines through the peak values (i.e for the max and min value). Could you please let me know if there is any property for this, as I am getting grids randomly. Have you considered using a Marker to highlight the min and max values? As trashgod sugested you use the Dataset to get the minimum and maximum values and then add a Marker to the Plot Range range = dataset.getRangeBounds(true); plot.addRangeMarker(new ValueMarker

How to resize this chart in jfreechart, netbeans?

巧了我就是萌 提交于 2019-12-02 10:57:36
问题 I can't seem to manipulate the chart itself. I can't change the size and chartPanel = createChartPanel(); keeps rewriting into chartPanel = javax.swing.panel(); I tried to create a method modificarGrafico , but nothing: Example : http://www.flickr.com/photos/63259070@N06/6371596517/ public JPanel createChartPanel(){ DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Toyota", new Integer(10)); pieDataset.setValue("Nissan", new Integer(25)); pieDataset.setValue("Hummer

jfreechart - StackedBarChart customization

大兔子大兔子 提交于 2019-12-02 10:55:20
I have below mentioned 4 xml files in which i have state & key & BuildDate. I need to represent the "state" information of "key" in a graph based on BuildDate. The x-axis should have past 6 days (w.r.t current date. suppose today is 7th Sept then the entry should be from 1st to 6th Sept). If there is an entry for the corresponding date in BuildDate feild then the state should be displayed as red or green (Failed - red, Success - green). Otherwise black should be displayed. I am mainly struggling in adding the value & displaying according to date. How can i do this via jfreechart?

Displaying a jfreechart in a jsp page

故事扮演 提交于 2019-12-02 10:54:34
I want to display a jfreechart chart in a jsp page. I have written code as follows - ... <% ChartCreator chart = new ChartCreator(); chart.createCategoryChart(); %> <img src = "chart.jpg"/> where the createCategoryChart() method creates the required jpg. It is stored in the eclipse folder(i have not put any path in my filename). I am not able to view the chart in the jsp page, but the file is created. What am I doing wrong? I would suggest to use Servlet to create Chart. JSP is mainly used for presentation (View). Create a servlet which creates the chart and send back it as response. import

How to put benchmark line on barchart?

陌路散爱 提交于 2019-12-02 10:52:56
问题 We are using the jfreechart with Jasper reports and we are struggling to put the benchmark line on the bar chart. How can this be achieved using jasper reports? 回答1: To customize your bar chart in jasper report create a customizer class (ChartCustomizer) extending the JRChartCustomizer. public void customize(JFreeChart chart, ChartComponent chartComponent) { //get the ploy CategoryPlot plot = (CategoryPlot) chart.getPlot(); //Now add your markers ValueMarker vm = new ValueMarker(200); //200

Jfreechart: Display weeks on x axis for value of days

独自空忆成欢 提交于 2019-12-02 10:32:05
问题 I am using JFreeChart to display a value for each day of a month. Now I want to have my x-axis display the weeks in a month instead of the days. At the moment the values for my graph are double on the y-axis and int on the x axis. Timestamp ts = a.getTimestamp(); Double val = a.getVal(); series1.add(ts.getDate(), val); I am using plot.getDomainAxis().setRange(0, 31); to set the range for the days to one month and xax.setTickUnit(new NumberTickUnit(7)); for the x-axis to display the ticks at

How do I show rainfall index along with temperature on my JFreeChart TimeSeries chart?

馋奶兔 提交于 2019-12-02 10:20:46
Currently, my TimeSeries graph shows the temperature of a location every 2 seconds. Now, if I want to show the rainfall index along with the temperature every 2 seconds, how can I achieve it? Here is my code: import testWeatherService.TestWeatherTimeLapseService; public class graph extends JFrame implements ActionListener { private static TimeSeries series; static final int COUNT = 200; /** The Constant WINDOW. */ public static final int WINDOW = 25; TestWeatherTimeLapseService getLocData = new TestWeatherTimeLapseService(); public graph(final String title) { super(title); this.series = new

JFreeChart does not show the graph at every iteration on thread?

做~自己de王妃 提交于 2019-12-02 10:01:53
I am getting counter values in one class using a thread and writing JFreeChart in another thread. While executing, it works alternatively, but only shows the graph at the end. It also displays the y axis label value as a Float but the actual retrieval value is int. How can I solve these issues? XYDataset Dataset; TimeSeries Series = new TimeSeries("Random Data"); Second sec = new Second(); ChartPanel CPanel; Value = Integer.parseInt(MySQLClass.Map_MySql.get(""+MainWindow.SelectedNode+"")); String CounterName = MainWindow.SelectedNode.toString(); Series.add(sec, Value); Dataset = new

Scrollable JFree domain axis and custom marker label

对着背影说爱祢 提交于 2019-12-02 09:51:19
问题 I have this code to draw graph, this works fine. I need two things here on domain axis (x) I want to be able to scroll. On markers I see a thick bold line. I want to be able to see some readable text for this marker. For now I see this output and upon zooming I see this Also on domain axis I have millis values. can I map it to human readable dates ? public class Grapher extends ApplicationFrame { public Grapher(final String title, List<PriceModel> priceModels) { super(title); final XYSeries

JFreeChart - Java Heap Space issue

只愿长相守 提交于 2019-12-02 09:49:23
I am using JFreeChart for the first time and I am using a TimeSeriesCollection() to create a TimeSeriesChart. My reslutset from the DB query is app. aroung 1000 records. I am using org.jfree.date.time.Minute.Minute(int min.....) object to add it to a TimeSeries object. I have a JFrame on which I add the ChartPanel directly. The user will provide new input parameters and reload the chart data with new dataset. So I clean up before every reload by calling the following in a method dataset.removeAllSeries(); chart.removeLegend(); chart.getRenderingHints().clear(); cp.getChartRenderingInfo()