jfreechart

Add a line chart beneath an existing pie chart

跟風遠走 提交于 2019-12-18 09:10:54
问题 When I click on a section of my piechart, I would like to see under first chart another chart (line chart). Now I generated another panel chart, but I lost first panel, because the second chart paint on first panel and second paint a first chart, but second has bad dimension; see image. How i can adjust my problem? JFreeChart chart = ChartFactory.createPieChart("Pratiche complessive", dataset, true, true, false); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new

JFreeChart Date axis Formatting issue

北城以北 提交于 2019-12-18 08:58:48
问题 I have a time series chart. I have my x-axis as a Date, and the Y-axis are just numbers. I am trying to format the date on the x-axis, however I keep getting exceptions. My code is below: TimeSeries trueSeries = new TimeSeries("True Data"); TimeSeries regressionSeries = new TimeSeries("Regression Line"); TimeSeries averageSeries = new TimeSeries("Moving Average"); for (Date date : regression.keySet()) { Calendar cal = Calendar.getInstance(); cal.setTime(date); int month = cal.get(Calendar

Get Area or Elements in zoomed Scatterplot

非 Y 不嫁゛ 提交于 2019-12-18 07:35:51
问题 I've got the following problem. I want to zoom-in a Scatterplot and then select all the displayed elements. It would be sufficient to somehow get the displayed area in the zoomed-in Scatterplot. From the range of this area i could determine which elements are displayed in the area and which are not. \edit: Found the Solution (Implementing AxisChangeListener Interface) import java.awt.Color; import java.awt.Dimension; import org.jfree.chart.ChartPanel; import org.jfree.chart.event

How to make plot a curve using JFreeChart?

坚强是说给别人听的谎言 提交于 2019-12-18 07:06:22
问题 I have managed to plot a linear graph. The following is the code: private JPanel createGraph() { JPanel panel = new JPanel(); XYSeries series = new XYSeries("MyGraph"); series.add(0, 1); series.add(1, 2); series.add(2, 5); series.add(7, 8); series.add(9, 10); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createXYLineChart( "XY Chart", "x-axis", "y-axis", dataset, PlotOrientation.VERTICAL, true, true, false ); ChartPanel

Custom graph - Java Swing

情到浓时终转凉″ 提交于 2019-12-18 06:54:57
问题 I'm trying to create a custom dynamic histogram type bar graph in Java. I've searched a lot but coudn't find a way to achieve this. I'm aware of the JFreeChart library but it doesn't meet my needs. This is what the JFreeChart histogram looks like : But what I want is a dyanamic Histogram with just X-axis. This photoshopped image will make it easier to understand. The JFrame will have fixed boundaries. As you can see, there should be no Y-axis. The bars' height should adjust automatically

Dynamically generate JFreeChart in servlet

对着背影说爱祢 提交于 2019-12-18 06:19:10
问题 I'm trying to generate graphs dynamically using JFreeChart as a result of some checkboxes the user selects, but I can't figure out how best to get the generated datasets into chart form (I have code that makes charts from these, but need to produce pngs) and into the JSP view. Currently, I can only think of sending the Datasets to the JSP, but can't think of what to do from there... How do I make it so that: user submits form to servlet, servlet generates datasets, charts produced from

Embed the legend into the plot area of JFreeChart

岁酱吖の 提交于 2019-12-18 05:57:48
问题 In JFreeChart , is it possible to embed the legend into the chart itself? Legend can be set on top, bottom, left, right of the chart as follows, but is it possible to imbed it into the chart? LegendTitle legend=chart.getLegend(); legend.setPosition(RectangleEdge.TOP); 回答1: There is an example of how to set the legend inside the polt are included in the JFreeChart Samples XYTitleAnnotationDemo1 , this is the key part: XYPlot plot = (XYPlot) chart.getPlot(); LegendTitle lt = new LegendTitle

Hide some category labels in JFreeChart to avoid overlapping

谁说我不能喝 提交于 2019-12-17 21:32:45
问题 I'm generating a StackedBarChart using JFreeChart. Depending on the input data I can have a lot of categories (usually between 20 and 40), leading to overlapping of the labels. In the following screenshot you can see the chart with categories from 1 to 38: I'd like to show some of the category labels as reference, but not all. It would be perfect to show the first and last, and every fifth inbetween. Is this possible? I can't change the width of the chart, and making the labels smaller does

Rendering Swing component smoothly every 500 millisecond

*爱你&永不变心* 提交于 2019-12-17 20:52:43
问题 I am facing rendering problem when I call paintComponent() every 500 millisecond to show updated charts. I have around 30 barcharts created by using JFreeChart on Panel . Rendering with error and How can I solve this problem? private void ShowGraphs() { FirstChart.removeAll(); SecondChart.removeAll(); ThirdChart.removeAll(); FirstChart.add(Label1); SecondChart.add(Label2); ThirdChart.add(Label3); ChartUpdate(P1,FirstChart); ChartUpdate(P2,SecondChart); ChartUpdate(P3,ThirdChart); //FirstChart

Text labels inside jfree Gantt chart bars

有些话、适合烂在心里 提交于 2019-12-17 20:28:51
问题 I have a simple Gantt chart here, that consists of a number of Tasks just like that: TaskSeries s1 = new TaskSeries("Planned Tasks"); Task newTask = new Task("Task" + String.valueOf(taskIndex), new SimpleTimePeriod(currentTime, currentTime + (int) distributionTime) ); s1.add(newTask) final TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); JFreeChart chart = ChartFactory.createGanttChart( "Distribution ", "Task", "Time", collection, true, true, false ); Is there