jfreechart

Problems with creating multiple series in XYPlot with JFreeChart

纵然是瞬间 提交于 2019-12-10 21:31:33
问题 The following example code creates a graph with only one data series. The other two data series will not be created. The main()-methods contains the data series. import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot

How to set line thickness for multiple series in JFreeChart?

早过忘川 提交于 2019-12-10 20:23:56
问题 I create a lot of charts. In each of them I need to call renderer.setSeriesStroke( i, new BasicStroke( 2.0f ) ); for each series. ( renderer is chart.getXYPlot().getRenderer() ). I wonder if there is any way to set the thickness globally. 回答1: Call the renderer's setBaseStroke() method, like they say here, and change the autoPopulateSeriesStroke flag, like they say here. renderer.setBaseStroke(new BasicStroke(2.0f)); renderer.setAutoPopulateSeriesStroke(false); 来源: https://stackoverflow.com

Is there a way to change the shape size in a JasperReports chart?

强颜欢笑 提交于 2019-12-10 18:54:27
问题 I'm building a Time series based chart that graphs Time -> double value. The chart contains at least 230 points. If I use the "show lines" option the graph doesn't display any lines. If I disselect the "show shapes" the shames disappear, but there are no dots to where the data is. How would I change the shapes in the chart to a circular point? 回答1: I'd override the renderer's getItemShape() method or invoke setSeriesShape() as required. There's an example here. ShapeUtilities is handy, too.

jfreechart histogram with dates

半城伤御伤魂 提交于 2019-12-10 17:48:04
问题 I want to display some dates in the X axis of a histogram chart, but i don't understand how i can do it with this code i can create a simple histogram with couples of x-y values, but they can olny be numbers, not date: DefaultTableXYDataset dataset = new DefaultTableXYDataset(); XYSeries serie = new XYSeries("Andamento consumi", true, false); serie.add(30, 8.3); serie.add(31, 7.1); serie.add(1, 8.7); serie.add(2, 6.0); serie.add(3, 11.9); dataset.addSeries(serie); JFreeChart chart =

Add an Image next to a X-axis label on a JFreeChart's barchart

為{幸葍}努か 提交于 2019-12-10 17:43:57
问题 I have requirement for the barchart which I have created using JFreeChart libraries. I am illustrating this using an example. Lets say: I have plotted "John", "Mark", "Louis" and "Keith" on the X-axis (Students) and their respective marks on the Y-axis. I am using three different bars for each of the students to show their respective English, Science, and Maths marks. Lets say, Science weigh the most, hence a student getting highest in Science would get a "Gold-Medal". Highest in "Maths"

Stacked Area Chart, fixed y axis label width

白昼怎懂夜的黑 提交于 2019-12-10 17:17:00
问题 I am creating a JFreeChart stacked area chart. I want my y axis label's width to be fixed, and I don't want to shift the chart as the width increases. See the image explaining the problem. I am facing similar problem as posted on the JFreeChart forum. As per the forum it is fixed, but it is not yet released. Does any body knows its fix. We can't wait for next release, does any body knows a hack which we can apply? Hoping for some solution. 回答1: A possible solution is to override the

How do I align a graphic in iTextPDF?

自古美人都是妖i 提交于 2019-12-10 15:16:58
问题 I am developing a Java App. I created a pie chart using jFreeChart and added it to a PDF file created with the iText library, but I cannot find a way to align and center the graphic inside the PDF. This is the code I'm using to add the chart: PdfContentByte contentByte = writer.getDirectContent(); PdfTemplate template = contentByte.createTemplate(600, 600); Graphics2D graphics2d = template.createGraphics(600, 600, new DefaultFontMapper()); Rectangle2D rectangle2d = new Rectangle2D.Double(0, 0

JFreeChart: is it possible to combine a stacked bars and line chart combined?

我们两清 提交于 2019-12-10 13:54:39
问题 As in this mockup: I know it is possible to have charts display next to each other using org.jfree.chart.plot.CombinedDomainXYPlot , but is it possible to have them overlaid, possibly using different Y axes (one for the stacked bars to the left of the chart, and one for the line chart shown to the right of the chart)? 回答1: Yes, the chart entitled DualAxisDemo1, shown among the Multiple Axis Charts , is an example. In addition to a second data set and renderer, you need a second axis, as

JFreeChart Displays integer values as float in Y-Axis

ⅰ亾dé卋堺 提交于 2019-12-10 13:38:25
问题 I'm using JFreeChart to create a Time Series Chart but while I'm passing Integer values as Y-Axis it shows them as float!! what is the problem? I'm Creating chart like this: this.TodaySeriesGoldPrice = new TimeSeries("Price",Minute.class); if(TDD!=null){ for(Map<String, Object> D: TDD){ Calendar C=Calendar.getInstance(); C.setTime(new Date((Long)D.get("timestamp"))); this.TodaySeriesGoldPrice.add(new Minute(C.get(Calendar.MINUTE),C.get(Calendar.HOUR),C.get(Calendar.DAY_OF_MONTH),C.get

Eclipse RCP with JFreeChart

大城市里の小女人 提交于 2019-12-10 13:14:21
问题 I'm trying yo use JFreeChart in RCP application with a simple view. I added JfreeChart jar file as a referenced library to project. The view could not be created because of the error : Could not create the view: Plug-in "ViewJFreeChart" was unable to instantiate class "viewJFreeChart.View". java.lang.NoClassDefFoundError: org/jfree/data/general/PieDataset at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang