jfreechart

Android Afreechart - Change point shape, thickness and color of line

痴心易碎 提交于 2019-12-06 11:18:52
I am trying to change the shape of a line chart's points, in my app. I am using afreechart's TimeSeriesChart . I want to make this line fancy in terms of thickness, color and points shape. Where to change the code? which method will use for that? What I'm having now: (source: googlecode.com ) What I want: om/svn/doc/screenshot/images/XYDrawableAnnotationDemo01.png) As you can see, in the first chart, the points of the line chart are opaque and rectangle(square?), and in the second one, they are fancy. So, what needs to be changed? I cant seem to figure out the variable used to store this shape

Is there a workaround to make DateAxis draw tick from the first day of the week?

放肆的年华 提交于 2019-12-06 09:55:43
I bumped into this problem when I created a chart that need a axis with week period. When I set up tick unit of DateAxis with new DateTickUnit(DateTickUnitType.Day, 7) , it display tick mark every 7 days. However, the date of tick mark does not start from the first day of the week. You can observer this behavior in the screenshot. Cyan color line 05-01 w18(May. 1, Week 18) is below the w18(Week 18) tick mark, this is because the date of tick mark w18 are actually May 2, which is Wednesday. This make chart looks incorrect because people tend to think each tick are suppose to be the start of the

JFreeChart interactive chart editing handling ChartMouseEvent

自作多情 提交于 2019-12-06 07:54:40
I'm trying to intercept ChartMouseEvent in order to modify an XYSeries of a JFreeChart object created with ChartFactory.createXYLineChart method (and displayed using a JDialog). I retrieve successfully the coordinate of the mouse event this way: public void chartMouseMoved(ChartMouseEvent arg0) { int x = arg0.getTrigger().getX(); int y = arg0.getTrigger().getY(); The origin of the coordinate system (0,0) is located at the red square in the picture. Now, I would like to calculate in which interval is the mouse in. In order to do this I need: the top-left coordinate of the grey chart (green

How to construct and use TimeSeriesCollections

ぐ巨炮叔叔 提交于 2019-12-06 07:44:35
I want to display some dates in the X axis of a chart, and here it is said that i have to use a TimeSeriesCollections object It seems that i have to add a TimeSeries to the TimeSeriesCollections, and that the TimeSeries has to be constructed using a RegularTimePeriod... I am a bit confused... Can you please explain me what i have to do? If possible can you provide some example code? Thanks TimeSeriesCollections are made up of TimeSeries objects Use this method to add series to the dataset: addSeries(TimeSeries series) When creating TimeSeries objects. Fill them with the time and values. Here

JFreechart, Line Chart with filled Areas

六眼飞鱼酱① 提交于 2019-12-06 07:19:51
问题 I am trying to create chart like below: While I've almost achieved everything by simply creating a line chart and customizing shape/paint for Renderer, I can't seem to find a way to fill the areas under the series line. Any clues, how can I do this? 回答1: You could create your chart with a StackedXYAreaRenderer. Specify AREA_AND_SHAPES in the constructor and enable outlines. See the ChartFactory code for createStackedXYAreaChart() as an example. StackedXYAreaRenderer r = new

Copy Image to Clipboard not working on Linux (Java AWT & SWT)

巧了我就是萌 提交于 2019-12-06 06:06:31
I am developing an Eclipse RCP Application which includes JFreeChart. One of its features is to copy graphs to the clipboard in order to paste them into other applications but it does not work on Linux, There is a SWT sample where you can find a snippet that does not work in Linux. On the other hand JFreeChart implemented this on AWT as: Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); Insets insets = getInsets(); int w = getWidth() - insets.left - insets.right; int h = getHeight() - insets.top - insets.bottom; ChartTransferable selection = new ChartTransferable

JFreechart(Java) - How to draw lines that is partially dashed lines and partially solid lines?

元气小坏坏 提交于 2019-12-06 04:38:23
问题 I'm going to plot a line chart that will change from solid line to dashed line to to indicate real data and forecasting data. I'm not sure if i need to extend some of the classes like XYLineAndShapeRenderer or something else, or maybe there is some convenient way to achieve this? Here is a demostration graph i plotted using Excel. I am talking about the gray lines in the graph. That is what i want. I don't know if there is a renderer that allow me to indicate which range dashed or solid 回答1:

JFreeChart: How to plot a line graph and a scatter on same chart

我只是一个虾纸丫 提交于 2019-12-06 02:59:18
i have two sets of data int[] x1 = {1,2,3,4,5,6,7,8,9,10}; int[] y1 = {1,2,3,5,6,8,9,10,14,11}; int[] x2 = {1,2,3,4,5,6,7,8,9,10}; int[] y2 = {0,2,3,5,0,8,9,8,14,11}; int[] z2 = {1,2,3,1,2,3,1,2,3,1}; I want to plot the x1,y1 as an XYLineChart and then plot x2,y2 as a scatter on the same plot without a line. I also need each scatter point of xy,y2 to be a different color depending on the value of z2 (1=Color.red, 2=Color.green, 3=Color.blue) How can i do this? So far i have: JPanel panel_1 = new JPanel(); panel_1.setLayout(new BorderLayout(0, 0)); XYSeriesCollection dataset = new

Does jFreeChart work/comple in Android 2.x

不打扰是莪最后的温柔 提交于 2019-12-06 02:49:17
问题 Does jFreeChart compile and run in Android 2.2 or above? I tried to run it and received missing swing class errors. There does not seem to be any definitive answer on the web. The answer to this question is either 1) Yes, I use it all the time, here are the steps or 2) No, It doesn't work because _ . I just want to put this issue to rest and get a definitive answer. So please don't suggest other chart packages. Thanks Fish 回答1: JFreeChart will not compile/run in Android as is because it

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

血红的双手。 提交于 2019-12-06 00:40:36
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 dataset = new DefaultCategoryDataset( ); dataset.addValue( 10 , "FIAT" , "Speed"); dataset.addValue( 30