jfreechart

I have a bar chart which I want to update and I tried the revalidate and repaint methods but with no success

吃可爱长大的小学妹 提交于 2019-12-03 18:16:10
问题 class GraphGenerator1 extends JPanel { ChartPanel chartPanel, sbc; void generator(int t, int Value1, int Value2) { if (t == 1) { DefaultCategoryDataset gData = new DefaultCategoryDataset(); gData.setValue(Value1, "What you saved", ""); gData.setValue(Value2, "What you paid", ""); JFreeChart chart = ChartFactory.createBarChart("", "", "", gData, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.WHITE); BarRenderer br = (BarRenderer) chart.getCategoryPlot()

jfreechart & itext for adding many number of barcharts

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: hello can any one help me in adding many number of bar charts to a single pdf. i have a code taken from d website to create a bar chart and save it in pdf. but couldn't save multiple bar charts to a single pdf. import com.itextpdf.awt.DefaultFontMapper; import com.itextpdf.text.Document; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfTemplate; import com.itextpdf.text.pdf.PdfWriter; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.io.FileOutputStream; import org.jfree.chart.ChartFactory;

JFreeChart BarChart -> NO gradient

匿名 (未验证) 提交于 2019-12-03 08:50:26
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: my bar chart is always drawn with a gradient color by default. I just want a simple color without any styled effects . Can anyone help ? Code: final JFreeChart chart = ChartFactory.createBarChart( "", // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend false, // tooltips? false // URLs? ); final CategoryPlot plot = chart.getCategoryPlot(); // SOMETHING HAS TO BE DONE HERE showChart(chart); // Simply shows the chart in a new window Thanks 回答1

JFreeChart - Problem in creating moving chart

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using JFreeChart in my java application. Problem I want to plot a XYAreaChart whose domain axis (x-axis) should scroll horizontally automatically when we start plotting the data. I saw the same thing in TimeSeriesCharts but I don't want any timeSeriesChart. I just want the scrolling x-axis. 回答1: You'll need to create your own SlidingXYDataset that implements XYDataset in a manner similar to how SlidingCategoryDataset implements CategoryDataset . Addendum: As noted in a comment , a typical implementation can be found here . 文章来源:

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

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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

Jfreechart vertical line is blurry

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using JFreechart to generate some plots, and I found the lines in my plot is blurry, but the demo shows that all the lines are thin and without any blurry, I was wondering if there any to generate good quality plot on a panel. 回答1: With more information, I can't explain the rendering and resampling artifact illustrated in your question. Starting from MinMaxCategoryPlotDemo1.java in the demo , I added this line to get the PNG image shown. ChartUtilities.saveChartAsPNG(new File("temp.png"), jfreechart, 1024, 768); In particular, I chose a

JFreeChart Bar Chart Production

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to create a bar chart that generates a dataset from within a for loop. String scores = scoreText.getText(); String[] data = scores.split(","); DefaultCategoryDataset barChartDataset = null; for (int l = 0; l < data.length; l++) { barChartDataset = new DefaultCategoryDataset(); // barChartDataset.setValue(new Double(data[l]), "Scores", stu); barChartDataset.addValue(new Double(data[l]), "Scores", stu); System.out.println(data[l]); } JFreeChart barChart = ChartFactory.createBarChart3D("Summary", "Name", "Scores", barChartDataset,

JFreeChart with highlighted points

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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

JFreeChart - customizing RingChart

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to make two ring charts that look like the following: But the RingPlot doesn't seem very customizable. The best I could come up with is this: Any chance of doing what I want with JFreeChart? 回答1: JFreeChart can do most things, this should get you started (I'll probably incorporate the center text feature into the upcoming 1.0.18 release so that the subclassing isn't necessary): package org.jfree.chart.demo; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics2D

JFreechart SeriesException

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to plot a bar chart using timeseries by introducing the beginning and the end date , but i got a problem with the end date it indicate : Exception in thread "main" org.jfree.data.general.SeriesException : You are attempting to add an observation for the time period 4-mai-2011 but the series already contains an observation for that time period. Duplicates are not permitted. Try using the addOrUpdate() method. final TimeSeries series2 = new TimeSeries("ip max", Day.class); String datebegin = "04/29/2011 02:00:01"; String dateend =