jfreechart

Generate image and display it inside JSP along with other content

岁酱吖の 提交于 2019-12-20 07:29:57
问题 I'm using JFreeChart to generate a dynamic chart depending on the user input. I have a JSP with some textbox and combobox, the user makes the input and submits it, and the Action process it, generating an image of a chart. I need to display this image on the same JSP as before, below the textbox/combobox. If I use response.setContentType("image/jpeg"); etc... then I get a page with the image alone. I thought of saving the image to a file and then access it with <img > , but I'm not sure that

IllegalStateException: PWC3990: getWriter() has already been called for this response

旧巷老猫 提交于 2019-12-20 06:40:08
问题 java.lang.IllegalStateException: PWC3990: getWriter() has already been called for this response How to solve this error? I run a simple servlet code to display the bar graph. 回答1: You cannot call both getOutputStream() and getWriter() on the same response. Keep in mind that JSP implicitly uses getWriter() . 回答2: Also make sure that the request is not being redirected to current servlet from some place else. If it is, then there is a high probability that one of getOutputStream() or getWriter(

JFreeChart: Add and sync a srollbar when zooming a chart (Eclipse plugin / SWT)

不问归期 提交于 2019-12-20 05:35:18
问题 I am using JFreeChart library to plot something in an Eclipse view and currently my code for view initialization looks as follows: @Override public void createPartControl(Composite parent) { JFreeChart chart = null; // Created via different object chart = graph.createLineChart("Test Graph", "x", "y"); ChartComposite frame = new ChartComposite(parent, SWT.NONE, chart, true); frame.setRangeZoomable(false); parent.layout(true); } I wanted to add scrolling to my graph when the user zooms in, but

How to set Jfree GanttChart Subtasks Color and labels

早过忘川 提交于 2019-12-20 05:27:04
问题 I am using the Jfree Charts to display Gantt Chart.I have to display differnt colors to the subtasks that are present under one series. For Example if I have 5 tasks in series One: each task should have different color Also,I need to print label for each task . I tried many ways but not successful and could only set the series color alone. Please can any one help. Thank you. 回答1: One approach is to override getItemPaint() in your subclass of GanttRenderer . Just return a different color for

To convert the double into date format using a class in JFreeChart

丶灬走出姿态 提交于 2019-12-20 05:15:47
问题 I would like to know, if it is possible to set the both parameter as date, which in this example it take the first parameter as comparable and the second as double. But i want the double to be displayed as date. Is there a class that can be used. If not Is there other way to display both as date. For instance i need both the x-axis and y-axis as date. For the data.addValue("8/4/2012" ,7.0) I want it like this ("8/4/2012 20:06:02" ,"8/5/2012") --> Is it possible with the graph below. Thank you

To convert the double into date format using a class in JFreeChart

喜夏-厌秋 提交于 2019-12-20 05:15:26
问题 I would like to know, if it is possible to set the both parameter as date, which in this example it take the first parameter as comparable and the second as double. But i want the double to be displayed as date. Is there a class that can be used. If not Is there other way to display both as date. For instance i need both the x-axis and y-axis as date. For the data.addValue("8/4/2012" ,7.0) I want it like this ("8/4/2012 20:06:02" ,"8/5/2012") --> Is it possible with the graph below. Thank you

JFreeChart CategoryDataset - Axis refresh/repaint problems

怎甘沉沦 提交于 2019-12-20 04:54:10
问题 I'm having issues with refreshing/repainting a BarChart after setting a zero value of a CategoryDataset to a very large number. private class Test extends ApplicationFrame { private DefaultCategoryDataset set; public Test( String newTitle) { super(newTitle); set = new DefaultCategoryDataset(); set.addValue(0, "Test", "1"); JFreeChart barChart = ChartFactory.createBarChart( "Test", "Category", "Score", set, PlotOrientation.VERTICAL, true, true, false); JPanel mainPanel = new JPanel(new

Margin plot and chart in JFreeChart

旧巷老猫 提交于 2019-12-20 04:13:53
问题 Is it possible to make all bartitles located outside the bars in a barchart visible when the max-value is a fixed value? Example of how it looks and how I would like it to look. It should not be any values over 750 (check USA, the last row): Any tips or ideas if it´s maybe possible to make a margin between the plot and the graph to make all labels visible(or any other solution)? 回答1: Update: blank margin (no values on range axis) Ok, so I'll keep the setUpperBound() , but mess around with the

Listening for zoom reset event in JFreeChart

牧云@^-^@ 提交于 2019-12-20 03:47:12
问题 How can I listen to JFreeChart's zoom reset event? 回答1: I did it using this: ChartPanel DCP=new ChartPanel(DailyChart){ @Override public void restoreAutoBounds(){ super.restoreAutoDomainBounds(); super.restoreAutoRangeBounds(); XYPlot plot=(XYPlot)getChart().getPlot(); Calendar Cal=Calendar.getInstance(); String dayName=Cal.getDisplayName(Calendar.DAY_OF_WEEK,Calendar.SHORT,new Locale("en", "us")).toLowerCase(); String tmp[]=((String)Configurations.getWeeklyWorkingSchedule().get(dayName).get(

PlotOrientation of BoxAndWhiskerChart JFreeChart

丶灬走出姿态 提交于 2019-12-20 03:38:04
问题 I have a question about JFreeChart : Is it possible to change the PlotOrientation of a BoxAndWhiskerChart to horizontal? I have a histogram, and I want to add a BoxAndWhiskerChart below. I need it horizontal so I can use the same axis scale. I tried to change the orientation in the Plot and ChartPanel . 回答1: @Catalina Island shows the correct way to change the PlotOrientation here, but you may run into a bug in the BoxAndWhiskerRenderer shown below for PlotOrientation.HORIZONTAL . Note the