jfreechart

Jfreechart annotations disappearing

旧城冷巷雨未停 提交于 2019-12-04 05:04:54
问题 I plot a curve with JFreechart. Then the user can draw ranges by dragging the mouse. These I plot using AbstractChartAnnotation to draw a filled Path2D. So far so nice - all aligns perfectly with the curve. When an area was already annotated the new annotation gets deleted. I use XYPlot.removeAnnotation with the new annotation. My problem is that sometimes not only the "new" annotation gets removed, but also a second annotation elsewhere in the plot. It doesn't seem random - I kinda found

How can I display a JFreeChart in web browser with Stripes Framework

自古美人都是妖i 提交于 2019-12-04 03:49:20
问题 This is the situation: My 'metrics.jsp' page submits a couple variables that are needed to create the chart. The 'ProjectActionBean.java' calls down to a few other java classes that create the JFreeChart. I can display the chart in a pop-up but I want it to be displayed in the original browser window. JFreeChart placeChart = ChartFactory.createBarChart( "ChartName", "", //x-axis label "", //y-axis label dataset, PlotOrientation.VERTICAL, false, //legend true, //tooltype false); //generate

To change the X-axis starting value of graph in Jfreechart

痴心易碎 提交于 2019-12-04 03:24:29
问题 I am calculating histogram of red component of the image and stored it in redhisto[]. The index of the array represent the intensity(0 to 255) and the value represent the number of pixel with that intensity. Then plotting those values with JFreeChart. My question is: How to make X-axis value start from 0. Now its starting from negative number. Can we change the color of the bars in the graph code is : public class Histogram extends ApplicationFrame { public Histogram(final String title)

Java&JFreeChart - How to set a JFreeChart's ChartPanel resize with it's container ( say JPanel )?

不羁的心 提交于 2019-12-04 02:37:03
问题 I just found that when i add a ChartPanel to a JFrame, the ChartPanel will resize to fit the frame as the JFrame dragged larger or smaller. However, when i add the ChartPanel to a JPanel, the JPanel's size( width and height ) changes to fit the JFrame as the JFrame resized. But the ChartPanel just keeps it's dimensions, leaving the enlarged JPanel a lot of empty space. How to make ChartPanel resize with it's container in GUI? Here is my sample codes : This case the chart resize with the

Jfreechart: Is it possible to change the bar color?

不羁的心 提交于 2019-12-04 02:20:20
Is it possible to change the bar color? I have coded a simple program for counting. I want to implement one more thing: if the count number is greater than 200, use blue color to draw the bar. If not, use yellow color to do so. Currently, all bar color is in red. So, I would like to ask, is it possible to change the bar color? If yes, can someone give me some guide to realize? Thanks in advance! attached is my coding: <%@page contentType="text/html"%> <%@page import="java.io.*" %> <%@page import="java.sql.*" %> <%@page import="org.jfree.data.category.*" %> <%@page import="org.jfree.chart.*" %>

Adding legend to jFreechart

一世执手 提交于 2019-12-04 02:09:25
问题 I have come up with my final hysteresis plot, which looks like this: My earlier post: Plotting a hysteresis loop with jFreeChart I have used 4 XYSeries for my first hysteresis loop and another four for the second hysteresis loop. If i turn on the legend JFreeChart chart = ChartFactory.createXYLineChart( "Hysteresis Plot", // chart title "Pounds(lb)", // domain axis label "Movement(inch)", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend

JavaFX real-time LineChart with time axis

橙三吉。 提交于 2019-12-04 01:38:54
I'm trying to plot real-time graph, with time axis, but I have found the LineChart constructor only has the signature. LineChart(Axis<X> xAxis, Axis<Y> yAxis) I think embedding jfree chart in javafx is not a proper solution. I want a few of the jfree features in a javafx LineChart , is this possible? Download Ensemble sample from http://www.oracle.com/technetwork/java/javafx/samples/index.html There are several examples in it for dynamic charts, e.g. "Advanced Stock Line Chart". You can take a look at their source code directly in the application. To show time on axis you can use string and

how to plot day-wise chart using Jfreechart

本小妞迷上赌 提交于 2019-12-03 22:22:29
I have data for every 15 minutes. I want to plot a graph to display values from 'date1' to 'date2'. The plot should show every 15 minutes value. But display on X-axis should show only dates. futureelite7 How to create a sample XYPlot with 15 minute intervals (shown as date) 1) Create your data. XYSeries dataSeries = new XYSeries("SMS Sent"); 2) Add your axes. If you want the x-axis to show dates, use a DateAxis as the x-axis. Input your date data as a long (in milliseconds). jfreecharts will take care of the formatting for you. DateAxis dateAxis = new DateAxis(timeAxisTitle); DateTickUnit unit

Jfreechart - any option for multiple XY charts like with the multi pie plot?

橙三吉。 提交于 2019-12-03 20:14:10
Is there anything similar to the multiPiePlot Chart but for xy plots? I have an application that needs to print two or three xy plots on one page. I know you can put multiple data sets on the same plot, but the requirements specify that each must be a separate chart on the same page. trashgod Yes, simply add your ChartPanel instances to a JPanel having GridLayout(0, 1) for a top-to-bottom arrangement. This example uses an orthogonal GridLayout(1, 0) to set three panels across. I used the solution trashgod used, but I've extended the solution to support the sort of printing I wanted to be able

cast DefaultCategoryDataset to CategoryDataset

我只是一个虾纸丫 提交于 2019-12-03 18:18:27
问题 I'm trying to create a basic barchart and when I compile it gives an error like Exception in thread "main" java.lang.ClassCastException: org.jfree.data.category.DefaultCategoryDataset cannot be cast to org.jfree.data.CategoryDataset here is my code package barchart; import java.awt.Color; import java.awt.Dimension; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data