jfreechart

JFreeChart - Problem in creating moving chart

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 05:23:13
I am using JFreeChart in my java application. Problem I want to plot a XYAreaChart whose domain axis (x-axis) should scroll horizontally automatically when we start plotting the data. I saw the same thing in TimeSeriesCharts but I don't want any timeSeriesChart. I just want the scrolling x-axis. trashgod You'll need to create your own SlidingXYDataset that implements XYDataset in a manner similar to how SlidingCategoryDataset implements CategoryDataset . Addendum: As noted in a comment , a typical implementation can be found here . 来源: https://stackoverflow.com/questions/5367222/jfreechart

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

好久不见. 提交于 2019-11-27 04:54:07
问题 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! 回答1: Because JDBCCategoryDataset implements the CategoryDataset interface, no cast should be required in the

JFreeChart BarChart -> NO gradient

廉价感情. 提交于 2019-11-27 04:46:22
my bar chart is always drawn with a gradient color by default. I just want a simple color without any styled effects . Can anyone help ? Code: final JFreeChart chart = ChartFactory.createBarChart( "", // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend false, // tooltips? false // URLs? ); final CategoryPlot plot = chart.getCategoryPlot(); // SOMETHING HAS TO BE DONE HERE showChart(chart); // Simply shows the chart in a new window Thanks Jes The problem lies in the BarPainter you are using.

Real time graph plotting starting time

若如初见. 提交于 2019-11-27 04:08:23
问题 Here is code based on @trashgod's example about real time plotting: import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.DateAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.data.time

JFreeChart with selectable domain axis and zoom

梦想的初衷 提交于 2019-11-27 04:01:20
问题 How to have chart like https://www.amcharts.com/demos/line-chart-with-scroll-and-zoom/ I am specifically interested in these functionalities To be able to select window of domain axis with those 2 selection controlls. To be able to zoom by selecting portion of domain axis. To be able to zoom out and see the bigger picture. To be able to map to range axis (Y) and see the value on that balloon like tool tip at any point (without Marker) I made initial attempt here Scrollable JFree domain axis

Closing up blank space in JFreeChart bar chart

蓝咒 提交于 2019-11-27 02:31:39
问题 I am using JFreeChart and would like to display a bar chart of player's scores, with the score on the y-axis and the player's games grouped on the x-axis. e.g. String[] {Player name, score, game number} Player 1, 10 , 1 Player 1, 12 , 2 Player 1, 15 , 3 Player 2, 11 , 1 Player 3, 18 , 1 Because the players do not have to play the same number of games, this results in a lot of blank space when the dataSet is created, as it tries to plot a bar for Player 2 & 3 games 2 & 3. data.addValue(score,

Abnormal Behaviour of the Zoom In and Zoom Out Functionality of the JFreeChart?

穿精又带淫゛_ 提交于 2019-11-27 02:24:56
I have observed that the functionality of the "Zoom-In" and "Zoom-out" was implemented quite different than expected.Like for example when i do one step "Zoom-out" and then again after one step back of "Zoom-In". I couldn't see the Original graph again. I don't see "Zoom-In" and "Zoom-out" functionality of JFreechart to be in the sync. public class ChartPanelDemo { private static final String title = "Historical Data Graph"; private ChartPanel chartPanel = createChart(); private JButton ZoomX; private JButton ZoomY; private JButton Zoom; private JButton ZoomXOut; private JButton ZoomYOut;

Populate JFreechart TimeSeriesCollection from Mysql DB?

可紊 提交于 2019-11-27 02:13:05
I'm trying to make a chart in my application that returns me the temperature of days during the months. This chart is a JFreechart TimeSeriesCollection, and I am unable to have the graph read correct data from the database. It shows some of the values, but not all of them, and does not show the correct time. To fix this, I tried to implement the graph as posted here , but still could not solve my problem, even having gone to see this question , as people suggested public class NewClass extends ApplicationFrame { Connection conexao = null; PreparedStatement pst= null; ResultSet rs = null;

How to set different colors to the bars in stacked bar chart in ireport?

我们两清 提交于 2019-11-27 01:56:16
I need to set a unique color to each bar in the stacked bar chart. Whatever the color I see in one bar it shouldn't be repeated in any other bar or any other stack. For example: I have 5 bars in the report. Each bar has 3 different stacks. I want to apply a red related colors to the first bar and its stacks. Second bar should have blue related colors. etc.. It is showed in the attached image. The image shows a very basic requirement what we want. Just created using a normal ms paint. Stacked Bar MS Paint Image You can override the getItemPaint() method of StackedBarRenderer() to return the

What is the right way to create thumbnail charts?

假装没事ソ 提交于 2019-11-26 23:38:50
问题 I'm trying to create a chart of thumbnails of some data with using JScrollPane , but I encounter performance difficulties. This example has about 100 thumbnails charts with 5000 samples in each one. When I'm trying to scroll down and back to up multiple times, scrolling occurs with delay, CPU load increasing, application memory usage reaches over 500 Mb. Is there a way to avoid this performance problem without reducing my data? import java.awt.Color; import java.awt.EventQueue; import java