jfreechart

Display column keys of stacked bar chart vertically in jFreeCharts

雨燕双飞 提交于 2019-12-02 06:58:27
问题 I am developing a javaEE application using jfreecharts. I successfully displayed my data using a stackedBarChart but the column keys (Y-axis labels) are not fully displayed because they are too large. how can I display them vertically? thanks for your suggestions 回答1: You can use setCategoryLabelPositions() like they show here. CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90))

Jfreechart: Display weeks on x axis for value of days

血红的双手。 提交于 2019-12-02 06:41:11
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 the right position. Instead of displaying the days (0, 7, 14, 21, 28) i want them to be weeks (0, 1, 2,

Displaying JFreeChart in a web page using Struts2

大城市里の小女人 提交于 2019-12-02 06:35:13
I am using Struts2. I need to display JFreeChart in a web page. Can any body help me on that? Edit: it is getting displayed in binary format. public String execute() throws Exception { System.out.println("Refresh bar Chart"); response.setContentType("image/png"); OutputStream outstream = response.getOutputStream(); try { JFreeChart chart = getChartViewer(); ChartUtilities.writeChartAsPNG(outstream, chart, 500, 300); System.out.println("Created bar Chart"); return SUCCESS; } finally { outstream.close(); response.flushBuffer(); } } You can convert your charts to images and include them in your

Display column keys of stacked bar chart vertically in jFreeCharts

陌路散爱 提交于 2019-12-02 06:34:43
I am developing a javaEE application using jfreecharts. I successfully displayed my data using a stackedBarChart but the column keys (Y-axis labels) are not fully displayed because they are too large. how can I display them vertically? thanks for your suggestions Catalina Island You can use setCategoryLabelPositions() like they show here . CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90)); 来源: https://stackoverflow.com/questions/16317373/display-column-keys-of-stacked-bar-chart

Change the starting value of value axis in Bar chart with Jfreechart

醉酒当歌 提交于 2019-12-02 06:23:12
I have the following values to be shown in a BAR chart in my Java web application. 9.46373791E8 9.45942547E8 9.45559945E8 9.45187023E8 9.44856693E8 9.44417826E8 9.44007878E8 As u can see the values are really close and have minor differences. When i generate a bar chart using Jfreechart, all the bars appear almost the same height and there is no way of telling the difference visually. So i want to change the (0,0) to (0,9)so that x axis is at number 9 on y axis. I still want to show the real values that the bars represent somewhere on top of the bar. please suggest ideas. i tried the below but

How to draw a spiderchart above a existing JfreeChart

心已入冬 提交于 2019-12-02 06:00:28
问题 I have one a jfree chart which I can generate everytime I run the code. Now i want to override few more spider graphs on the same chart. please help me how to do that Above this i need to add one more spider chart using jfree. Here is my code for doing this chart. package com.rectrix.exide.pdfbox; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Paint; import java.awt.PaintContext; import java

Plotting BarGraph according to month days dynamically using java

ε祈祈猫儿з 提交于 2019-12-02 05:55:33
问题 i've created a BarChart using jfreechart in java. The bar is plotted according to the days in a month. for example this month March contains 31 days, so there will be 31 bars . The problem is that when i click the next button the month changes to April which contains 30 days, ie 30 bars. How can we change the BarChart according to the days in a month on button click. Can anyone please tell me how to do that. 回答1: You need to update your dataset with each change. I've added an updateDataset()

Where is DateTickUnit documentation?

孤人 提交于 2019-12-02 05:50:32
I need to change the default DateTickUnit settings for different zoom levels for a TimeseriesChart, but can´t find the place i need to read in the documentation? I would greatly appreciate a pointer. Here is the Java API for TimeSeriesChartDemo1: http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/demo/TimeSeriesChartDemo1.html The zoom levels documentation will be found in one of the inherited methods. I would recommend finding the exact component that requires the zoom to be changed on. Then checking the API for that java.awt component DateAxis has two static factories for creating

Color does not sync with legend

时光总嘲笑我的痴心妄想 提交于 2019-12-02 05:48:40
问题 I have a 3D dataset XYZDataset that I want to plot as a 2D plot, by keeping (x,y) coordinates and by representing the z axis using a spectrum of colors. Based on this example, here is my ploting class along with the spectrum color class. package com.ingilab.algo.comparator.tools.plot; import java.awt.Color; import java.awt.Paint; import java.awt.Shape; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis

Customizing Dates on the Gantt Chart for Jasper Reports

雨燕双飞 提交于 2019-12-02 05:47:09
问题 In the gantt chart on my reports I have 1 year's worth of data. I'm only interested in seeing the month printed at the top of the gantt chart. [Jan-Dec]. However, the graph currently displays the Month and the year. How would I customize the chart to just output the month? 回答1: I'm not sure about JasperReports, but createGanttChart() uses a DateAxis as the range axis. Something like this should work: DateAxis axis = (DateAxis) plot.getRangeAxis(); axis.setTickUnit(new DateTickUnit(