jfreechart

How to get started with JFreeChart?

北城以北 提交于 2019-12-01 23:28:07
问题 I have downloaded the latest version of JFreeChart (1.0.14) and want to start using it. I only have imported standard Java packages like java.io.* before and never dealt with 3rd party libraries. What do I need to tell jGRASP so it knows about and can access the JFreeChart library? I have tried to import it like this import org.jfree.chart.ChartFactory; but getting the following error java:1: package org.jfree.chart does not exist . 回答1: You have to add a library's jar file into both compile

Changing custom colors in JFreeChart stacked 3D bar chart

浪尽此生 提交于 2019-12-01 23:23:38
I have already searched enough on web but with no luck. I have created a stacked 3d bar chart wherein I am unable to change the default colors. I tried all the advices provided . Below a small snippet of my code. This is my input. My Data from Db is: A 0 2 B 15 53 C 0 2 D 0 2 E 0 1 F 1 0 G 0 1 Somehow I converted this to dataset requirement and also added items and models. CategoryDataset dataset = DatasetUtilities.createCategoryDataset(item,models, data); chart = ChartFactory.createStackedBarChart3D(chartDescription, X-axis, Y-axis, dataset,PlotOrientation.VERTICAL, true, true, true);

JFreeChart tick label cut off

大兔子大兔子 提交于 2019-12-01 22:31:21
When rendering a chart using JFreeChart, if there is a tick label near to the end of the horizontal axis the label is partially cut off at the border of the image, eg: | | +----------+------------------+- 01 Jun 11 01 Jul <--- missing year Is there any way that I can prevent this? It is possible to add some kind of margin or similar? Thanks Assuming a DateAxis , the parent ValueAxis method setUpperMargin() may suffice. 来源: https://stackoverflow.com/questions/7851540/jfreechart-tick-label-cut-off

JasperReports: How to mask or filter the labels at the chart's axis

眉间皱痕 提交于 2019-12-01 22:31:13
I´m using a simple area chart based on a simple Dataset like this: DateTime(sql.timestamp) |Value(Integer) 2012-02-17 00:02:02 |100 2012-02-17 00:02:08 |110 2012-02-17 00:02:20 |90 2012-02-17 00:02:35 |10 2012-02-17 00:02:40 |130 2012-02-17 00:04:22 |14 2012-02-17 00:04:33 |45 2012-02-17 00:05:02 |60 ... DateTime is used by Category Axis, Value is used by Range Axis. In the Dataset are ~1000 Records In the Labels of the Category Axis will every DateTime Value be shown. But that is with 1000 records too much, the Category Labels will be shown as Black Line. And that is my problem. I´d tried to

How to change color of particular sub-task in JFreeChart Gantt Chart?

橙三吉。 提交于 2019-12-01 22:29:46
I have a Gantt Chart with 5 tasks. Each task is divided into 3 sub-tasks. I need to define different color for each sub-task, e.g. Sub-task1: "light blue", Sub-task2: "blue", Sub-task3: "dark blue". I tried to google some examples, but I didn't find any full working example. Thanks. Update#1: I'm using IntervalCategoryDataset for the dataset. IntervalCategoryDataset dataset = createDataset(data); final Task t = new Task("Resource " + i, date(time11), date(time14)); t.addSubtask(new Task("Resource " + i, date(time11), date(time12))); t.addSubtask(new Task("Resource " + i, date(time12), date

Adding a static gridline to a JFreeChart time series chart

别等时光非礼了梦想. 提交于 2019-12-01 22:17:23
I am trying to implement a timeseries chart with a peculiar requirement in JFreeChart. I can draw the chart, but I don't know how to implement the vertical red line at the last value in the chart. It should always be in the same spot and should always intersect with the last value. I am absolutely out of ideas on how this would be done. I was thinking that it might be possible to implement it as a static gridline, but I don't know how to specify one. Also, the size of the charts will be static, so some roundabout way of doing this is acceptable, hopefully without introducing any 3rd party

Customize bar colors in XYJfree chart

馋奶兔 提交于 2019-12-01 22:03:13
how to paint different bars in different colors, I tried to use renderer, here is my sample code: public IntervalXYDataset createDataset() throws InterruptedException { parseFile(); final XYSeries series = new XYSeries("Analysis"); int i=0; while(parsedArray[i]!=0) { series.add(xaxisArray[i], yaxisArray[i]); i++; } final XYSeriesCollection dataset = new XYSeriesCollection(series); dataset.setIntervalWidth(0.15);//set width here return dataset; } and this is how I am drawing the graph: public className (final String title) throws InterruptedException { super(title); IntervalXYDataset dataset =

Tooltip with values while using SpiderWebPlot

五迷三道 提交于 2019-12-01 21:32:27
问题 I'm using SpiderWebPlot from JFreeChart in order to generate a chart. But what I want to have, is tooltips with values. I've found that I should set StandardCategoryTooltipGenerator to the plot, but that doesn't seem to be the point. Here is my sample code: private JFreeChart prepareChart() { Random rnd = new java.util.Random(); DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); String rowKey = "Osobnik"; dataSet.addValue(rnd.nextInt(20), rowKey, "BLUFF"); dataSet.addValue(rnd

JFreeChart Date axis Formatting issue

删除回忆录丶 提交于 2019-12-01 21:22:43
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.MONTH) + 1; int day = cal.get(Calendar.DAY_OF_MONTH); int year = cal.get(Calendar.YEAR); regressionSeries

How to get started with JFreeChart?

穿精又带淫゛_ 提交于 2019-12-01 21:00:49
I have downloaded the latest version of JFreeChart (1.0.14) and want to start using it. I only have imported standard Java packages like java.io.* before and never dealt with 3rd party libraries. What do I need to tell jGRASP so it knows about and can access the JFreeChart library? I have tried to import it like this import org.jfree.chart.ChartFactory; but getting the following error java:1: package org.jfree.chart does not exist . You have to add a library's jar file into both compile-time and run-time CLASSPATH . In jGRASP you can do it through "Settings > PATH/CLASSPATH > Workspace" dialog