jfreechart

JFreeChart using Large Numbers as Values

我与影子孤独终老i 提交于 2019-11-28 09:45:30
问题 I am currently working on a project using JFreeChart. I got everything working except when I start using large numbers, it goes all funny. DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(1000, "Cars", "2015"); dataset.addValue(5000, "Bikes", "2015"); return dataset; Output from above works perfect, but when I do this: DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(999999999, "Cars", "2015"); dataset.addValue(999999999, "Bikes",

Width of item in second series too wide

青春壹個敷衍的年華 提交于 2019-11-28 09:22:41
问题 I am trying to show 2 OHLCSeries in one chart/seriesCollection. The first series seems to be OK but in the secord there are item(s) with weird width. Look the pic: Maybe the problem comes from count of item in series - 1st series has 20 items and the 2nd series just 1. Here is the complete app code: import java.awt.Dimension; import java.text.SimpleDateFormat; import javax.swing.JFrame; import javax.swing.JPanel; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import

JFreechart SeriesException

不想你离开。 提交于 2019-11-28 09:14:26
问题 I am trying to plot a bar chart using timeseries by introducing the beginning and the end date , but i got a problem with the end date it indicate : Exception in thread "main" org.jfree.data.general.SeriesException : You are attempting to add an observation for the time period 4-mai-2011 but the series already contains an observation for that time period. Duplicates are not permitted. Try using the addOrUpdate() method. final TimeSeries series2 = new TimeSeries("ip max", Day.class); String

Width of the bar in Jfreechart

心不动则不痛 提交于 2019-11-28 08:21:48
Is there a way to adjust the width of the bars in a Barchart? I create my chart with the following code. final JFreeChart chart = ChartFactory.createBarChart("Report", // chart title "Date", // domain axis label "Number", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); You can also set the maximum width of a bar. This is useful if you have a wide chart but occasionally there are only one or two data points and you don't want a single big fat bar taking up the whole area. CategoryPlot categoryPlot = chart

Customize subtitle position - JFreeChart

雨燕双飞 提交于 2019-11-28 06:10:37
问题 I want to know if it is possible to put a JFreeChart subtitle in the bottom of the chart, under the chart, and not under the Title. What I want to do is illustrated on these images: http://i.stack.imgur.com/AmPJ8.jpg and http://i.stack.imgur.com/VBfvL.jpg. I just tried almost everything and cannot do this. I am using subtitle insted of legend, because legend is presented with a red square, indicating the color of the series shown on the graphics. Thanks in advance! Joey 回答1: In this example,

How to display line graph using JFreeChart in jsp?

两盒软妹~` 提交于 2019-11-28 06:02:16
问题 HI All: I am using the below to diplay the line graph. when i run the below code, i am getting the window but it is blank and not displaying the graph. Please help me and also tell me how to diplay the line graph in html page using below code. import org.jfree.chart.*; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.xy.*; public class xyLine { public static void main(String arg[]) { XYSeries series = new XYSeries("Average Weight"); series.add(20.0, 20.0); series.add(40.0,

jfreechart crashes when using Yahoo Finance Quotes

有些话、适合烂在心里 提交于 2019-11-28 05:48:51
问题 QUESTION RESOLVED: solution is changing to JFreeChart v1.0.15 I have a very peculiar problem. What I have set up is a file that sends a url request to the Yahoo Finance website and then uses the results to draw a JFreeChart in a JFrame. What I just can't get my head around is the following: For certain url requests, the JFrame crashes It starts, but only shows a white screen. Whereas for other requests, my program works fine. Example For example: This request: "http://ichart.yahoo.com/table

Trying to use JFreeChart using JSP/Servles; issues with JDBCCategoryDataset and CategoryDataset

痞子三分冷 提交于 2019-11-28 02:28:10
i am trying to connect to a database and execute a query in a servlet. I am following this example JFreeChart Example . If you look at the readData() method, it returns a CategoryDataset when it originally was a JDBCCategoryDataset . I get an error until i cast it do a CategoryDataset . When i run the code, it doesn't work, telling me it cannot cast. Any help would be much appreciated! Because JDBCCategoryDataset implements the CategoryDataset interface, no cast should be required in the assignment: CategoryDataset data = readData(); I get the following chart from the variation of readData()

How to change the TimeSeries and TimeSeriesCollection to XYSeries and XYCollection respectively in java?

眉间皱痕 提交于 2019-11-28 02:20:52
Based on this example , this code is for draging the point in the chart. I want to replace TimeSeries object with XYSeries because I dont want the months in X-axis; I want the series of number like Point1 , Point2 , Point3 and so on, and want the same logic. When replacing with XYSeries I am not getting how to change the logic for XYSeries . package com.example.java; import org.jfree.chart.*; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.entity.ChartEntity; import org.jfree.chart.entity.EntityCollection; import org.jfree.chart.entity.XYItemEntity; import org.jfree.chart.labels

Update PieChart in JFreeChart

十年热恋 提交于 2019-11-28 02:20:46
I have created a PieChart using JFreeChart. I for the life of my cant figure out how to update the chart once it has been created. Is the only way to do that to create an entirely new chart? trashgod As shown here , you can alter a chart after it's been rendered. In this case, update the chart's data model , PieDataset , and the listening view will follow; in this related example a button's Action updates a CategoryDataset . In a MultiplePiePlot , you can update the appearance of the pie chart view directly, as shown here . Addendum: Starting from PieChartDemo1 , re-factor the dataset and add