jfreechart

How to set Y axis range of of BarGraph created using ChartFactory.createBarChart

╄→尐↘猪︶ㄣ 提交于 2019-12-07 14:56:18
问题 I have created a bar graph using jfree.chart.ChartFactory using below code. I need to set the range of Y axis as 0 - 100. How can I set the max value. import java.io.File; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.DefaultCategoryDataset; public class BarGraph { public static void main( String[ ] args )throws Exception { final DefaultCategoryDataset

JFreeChart : How to display hours format on the y axis

早过忘川 提交于 2019-12-07 08:45:34
问题 I can't find how to modify the label of the y axis. For now I use a TimeSeries with the MINUTE class, and then insert the TimeSeries into a Dataset. It look like this : final TimeSeries s1 = new TimeSeries("Importation Time", Minute.class); s1.add(new Minute(dateFinal),concateHourAndMinuteToGetASingleValue); dataset.addSeries(s1); What I would like to do is to modify the display label, and put a String (05h20 for exemple) instead of the Double value. Any help would be much appreciated :)

Icon on a JFreeChart XY Plot

旧时模样 提交于 2019-12-07 08:28:54
问题 I have an XY plot of positions and want the newest point to be an icon. Is this possible in JFreeChart? 回答1: On an xy plot you would need to keep track of the last xy point added and then add it using something like the following: double x = 150; double y = 300; XYPlot plot = chart.getXYPlot(); ImageIcon imageIcon = new ImageIcon("/path/to/your/icon.png"); XYAnnotation xyannotation = new XYImageAnnotation(x, y, imageIcon.getImage()); plot.addAnnotation(xyannotation); 来源: https://stackoverflow

JFreeChart: Preserve zoom position when updating chart

空扰寡人 提交于 2019-12-07 03:32:03
问题 My program creates a time series chart using JFreeChart (via Swing ChartPanel) and allows the user to zoom into it (using the ChartPanel's standard zoom feature). The program has parameters (such as smoothing) that can be tweaked at runtime; if tweaked, the chart is replaced using the ChartPanel's "setChart()" method. The timeframe, however, invariably stays the same across all tweaks. When "setChart()" is called, the zoom position is reset so that the entire chart is shown. What I now want

Plot points instead of lines? JFreeChart PolarChart

大城市里の小女人 提交于 2019-12-07 03:14:48
问题 Currently, the PolarChart joins all the coordinates with lines creating a polygon. I just want it to plot each point with a dot and NOT join them together. Is this possible? I have tried using translateValueThetaRadiusToJava2D() and Graphics2D to draw circles but it's very clunky and contrived. Any suggestions welcome! 回答1: So the DefaultPolarItemRenderer takes in all the polar points, converts the polar points to regular Java2D coordinates, makes a Polygon with those points and then draws it

JFreeChart Boxplot Outlier and Farout appearance

∥☆過路亽.° 提交于 2019-12-06 21:15:30
I am using JFreeChart with Java to evaluate experimental results using the boxplot chart. I want to change the color and shape of the outliers and the farout entries. This is how my plots currently look like when I use the normal BoxAndWhiskerRenderer: I set up the renderer like this: BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(true); renderer.setSeriesPaint(0, Color.DARK_GRAY); renderer.setSeriesPaint(1, Color.LIGHT_GRAY); renderer.setSeriesOutlinePaint(0, Color.BLACK); renderer.setSeriesOutlinePaint(1, Color.BLACK); renderer.setUseOutlinePaintForWhiskers

JFreeChart gap between legend labels

末鹿安然 提交于 2019-12-06 16:03:36
I've been using JFreeChart in order to plot some series but I have a doubt related to the space between the labels in the legend. Does anyone know how to set a space between legends? For example, right now: and this is how I want it to look like I'll appreciate your help. Just go to the place in your code where the legend items are set, and change "2012" to "2012 " . You can use the setItemLabelPadding() method in the LegendTitle class. LegendTitle legend = chart.getLegend(); legend.setItemLabelPadding(new RectangleInsets(2, 2, 2, 30)); The only issue with this approach is that it also leaves

Java Graphing Libraries for Web Applicattions?

人走茶凉 提交于 2019-12-06 13:57:52
问题 I've been asked to enhance a JSP Application with (And I quote) "Some Sexy Graphs" I did a quick search on SO and came up with this question which mentions several graphing solutions, however given that this is a Web application I was wondering if there were any good graphing libraries that can render the graphs client side using JQuery or some such? Otherwise, has anyone who has used JFreeChart to produce charts for the Web got any pointers. This is the first time I've done Any JSP (I've

Java Headless Exception after setting -Djava.awt.headless=true

痞子三分冷 提交于 2019-12-06 13:47:40
I am using: Linux Debian 6, Java 1.6.29 and Tomcat 6 I've seen many posts about it explaining that java.awt requires X11 libraries..etc., but they are not solving the problem. I set -Djava.awt.headless=true in my box and I worked around the first problem of the headless environment, now I am getting: java.awt.HeadlessException java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159) java.awt.Window.(Window.java:432) java.awt.Frame.(Frame.java:403) javax.swing.JFrame.(JFrame.java:202) org.jfree.ui.ApplicationFrame.(ApplicationFrame.java:65) ... I know by doing this I just told

Implementing a chart with AFreeChart into a View

情到浓时终转凉″ 提交于 2019-12-06 12:52:56
问题 Here is my problem: I am using AFreeChart to display a chart in my activity. The reason why I used AFreeChart was because I first finished this chart with JFreeChart , and, realized after that, it wasn't compatible with Android. So, with AFreeChart , I could create the same chart with exactly the same code, but I don't know how to display it on a View . Here I am creating the chart: private void creerGraphique(){ //Here I have the creation of the DateSet AFreeChart chart = ChartFactory