jfreechart

How to draw line chart using jfreechart from top to bottom?

柔情痞子 提交于 2020-01-02 20:10:54
问题 I'm using jfreechart to draw line chart , I need the line to be drawn from top to bottom .... Meaning: 0,0 coordinates will be in the top-left corner. I was able to do it when I used 'CategoryPlot' just by change 'PlotOrientation' but label on the left became overlap..anyhow, I prefer 'xyplot' changing 'setInverted' or 'setDomainAxisLocation' did not help any help will be appreciated update: I'm reposting my code for better clarity (chart drawing part ) In the first code: I got the needed

JFreeChart not appearing on JPanel - may be something to do with my code's logic

孤者浪人 提交于 2020-01-02 05:19:06
问题 This question relates to a similar question I posted on here a few days ago... Here is the interface which will show where I am wanting the chart to appear: I am wanting to display the chart on the large JPanel on the right hand side. What the chart is meant to do is to compare a particular player's stats with their country's average and the overall average (with three bars). The chart (should) know which player to show the comparison by getting the player's name from the textbox (the one

how to start draw line from X - Y axis at o in JFreeChart ChartFactory.createLineChart

给你一囗甜甜゛ 提交于 2020-01-01 17:09:07
问题 i am creating line chart using JFreeChart . Line chart draw properly but i want to start at point 0. how can i do that? public void lineChart() { CategoryDataset ds=createDataset2(); chart2=ChartFactory.createLineChart("Bar Chart", "OPD Number", "Weight", ds,PlotOrientation.VERTICAL,true,true,false); ChartPanel cp = new ChartPanel(chart2); jp.add(cp); //jp is JPanel } public CategoryDataset createDataset2() { final DefaultCategoryDataset dataset= new DefaultCategoryDataset(); final String

Is it possible to customize label for each category in bar chart?

混江龙づ霸主 提交于 2020-01-01 16:48:16
问题 Recently I get a requirement to create a bar chart that show data for each project. Here's an example : As you can see, the Category is the name of the project, and Series are different types of data in that project. However, since system dose not guarantee the uniqueness of project name, using it as categories can cause problem, and I will not able to use project name to generate URL for different projects. On the other hand, If I use unique id as category, I won't able to display the

JfreeChart: dynamic Date time values into XY chart

≡放荡痞女 提交于 2019-12-31 07:42:11
问题 I am using JfreeChart to create dynamic charts. Currently, am facing a problem to create a Chart to show dynamic Date time values from database. Showing above picture, I want to fix Y axis with months JAN to Dec. Since long back trying , but I could not find any solution. Please give me the solution to fix above issue 回答1: Use a DateAxis, like they show here, and format the labels for months. DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM

JfreeChart: dynamic Date time values into XY chart

旧时模样 提交于 2019-12-31 07:41:34
问题 I am using JfreeChart to create dynamic charts. Currently, am facing a problem to create a Chart to show dynamic Date time values from database. Showing above picture, I want to fix Y axis with months JAN to Dec. Since long back trying , but I could not find any solution. Please give me the solution to fix above issue 回答1: Use a DateAxis, like they show here, and format the labels for months. DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM

Timing issue with plotting multiple graphs fast

我的未来我决定 提交于 2019-12-31 04:41:11
问题 In the code below I am conducting an experiment for which I need to plot almost 10 graphs per second ( time interval 100) for total of 50. However when I decrease the time interval TIME INTERVAL ( line 120 down to the bottom) from 200 msec to 100 msec the code raises exception below. I have tired invokeLater etc, yet I am not able to fix this. I pasted here the entire code which generates the graph below. Kindly take a look and let me know what to do. Thanks in advance Exception in thread

Plotting a hysteresis loop with jFreeChart

白昼怎懂夜的黑 提交于 2019-12-31 04:39:15
问题 I need to draw hysteresis loops and then calculate the area closed within the loop. I am using jFreeChart. consider the following data: hyst[0]=0; hyst[1]=0; hyst[2]=0.0098; hyst[3]=0.0196; hyst[4]=0.0489; hyst[5]=0.0879; hyst[6]=0.0684; hyst[7]=0.0489; hyst[8]=0.0196; hyst[9]=0.0098; hyst[10]=0; hyst[11]=0; hyst[12]=0; hyst[13]=0; hyst[14]=0; hyst[15]=-0.0195; hyst[16]=-0.0488; hyst[17]=-0.0391; hyst[18]=-0.0195; hyst[19]=0; hyst[20]=0; When I try : public void plotHysteresis() { int j=0;

Plotting a locus in XY space using JFreeChart

跟風遠走 提交于 2019-12-31 04:22:47
问题 I would like to plot the locus of a particle in two dimensional space. My data is a sequence of X,Y coordinates and I would like to plot these. Would appreciate any pointers to examples that show how to do this. An example of a locus plot can be seen below: Note: I'd like to show the path as a continuous line with arrows showing the direction of motion. Thanks. 回答1: ChartFactory.createScatterPlot() , illustrated here, might be a good starting point. FastScatterPlot , cited here and

How to set the JFreeChart X axis data titles?

江枫思渺然 提交于 2019-12-31 04:09:33
问题 Attached my code snippet here, I am using XYStepChart from chart factory. The x-axis scale at output for the code is being displayed in scale of eg: 05:30:00:00 , 05:30:00:01 , 05:30:00:00 . But I need in values like 1,2,3,4. package org.jfree.chart.demo; import java.awt.BasicStroke; import java.awt.Color; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFrame; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot;