jfreechart

JFreeChart Get Legend Graphic

随声附和 提交于 2019-12-11 02:28:46
问题 In my application, I am showing data in a table as well as through a Dual Axis Bar/Line JFreeChart. To save some space (as the charts are being saved as PNG and put on PDF with iText PDF), I wanted to take the Graphics from the Legend, use them in the tabular view, and remove the legend. Is there a way to grab the icons that lie with the legend item? I have found the LegendGraphic class, which seemed like would be the method to retrieve the icon from the LegendItem , but have not found

Draw Custom Lines using JFreeChart's XYLineAndShapeRenderer

。_饼干妹妹 提交于 2019-12-11 02:26:08
问题 I have some logic which I am using to construct a series of clusters. So far, to denote the cluster to which each point on the graph belongs to, I am using a series of colours, where points belonging to the same cluster are of the same colour. Besides that, I would also like to display the centre of each cluster since this will help me see how my cluster building algorithm performs. To do this at the moment, I am writing some text on the graph through the use of the XPointerAnnotation class.

XYPointerAnnotation in TimeSeries JFreeChart

强颜欢笑 提交于 2019-12-11 02:15:11
问题 I'm trying to implement XYPointerAnnotation to TimeSeries chart. However I don't know, how does chart finds my y values to plot. Code: final TimeSeries series = new TimeSeries("asdfas"); Hour hour = new Hour(); series.add(2,hour), 123); TimeSeriesCollection collection = new TimeSeriesCollection(); collection.addSeries(series); double temp = Double.parseDouble( series1.getTimePeriod(series1.getItemCount()-1).toString()); XYPointerAnnotation pointer1 = new XYPointerAnnotation( series1.getValue

JFreeChart - Ring Plot Simple Label Positioning

ε祈祈猫儿з 提交于 2019-12-11 02:07:23
问题 I'm having some trouble while working on JFreeChart RingPlot. I've managed to put labels inside my chart, yet I can't change their positions as I want. Here where am I right now; I need to move the labes closer to the edges of the chart so that I can lower the section depth and have a better ring look. So far, I tried to play with setSimpleLabelOffset and setLabelGap methods but didn't work well. Here is my code; DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("Critical"

Number axis setTickUnit to contain a specified number

拥有回忆 提交于 2019-12-11 01:47:44
问题 I am displaying normal distribution using JFreeChart, and I change the tick number to standard deviation; but I would also want there to always be 'mean' value in the middle from which ticks emerge. Cross-posted here. So standard deviation = 2 ; mean = 1 -3 -1 1 3 5 Standard deviation = 5 ; mean = 15 0 5 10 15 20 25 30 JFreeChart.java public class JFreeChartPanel extends JPanel { private final XYPlot plot; double mean = 0.0, sd = 1.0; XYDataset dataset = initDataset(); NumberAxis domain = new

JFreeChart MeterPlot

邮差的信 提交于 2019-12-11 01:44:22
问题 I'm currently doing Agent project in java. At some point I need to show a meter for eg: battery level. I've got 5 agents in my program, each agent creates it's own meter plot with name on it, but somehow they are not updating the dataset. OR they are updating the dataset just that it isnt show on the meterplot. Any idea ? Following is my code : car.java { private CarMeter meter; meter = new CarMeter(getLocalName()); meter.update(currentBatteryCharge); } meterplot.java public class CarMeter

JFreeChart Link Axes

夙愿已清 提交于 2019-12-11 01:00:59
问题 I have created a Frame with two independent separate JFree charts (held in a 2x1 Grid layout). The top chart shows a Canlestick chart, the bottom a time series plot. What I would like to do is link the displayed X-Axis of both charts so that when I zoom in on one chart the other chart zooms to the corresponding time period. Is this possible? If so could you give me an example 回答1: What you need is called CombinedDomainXYPlot . Instead of creating independent JFreeChart objects you will need

CategoryPlot from a JTable - JFreeChart

倾然丶 夕夏残阳落幕 提交于 2019-12-11 00:37:07
问题 I have to implement an histogram using JFreeChart API. This histogram has to represent the datas of this JTable: So I have a JTable with three columns: "thea", "type", "Number of occurrences". My histogram has two targets: the first is to count the number of occurrences of each thea field; the second is to mark with different colors the bars corresponding to JTable records with different types. To implement my histogram I used a DefaultCategoryDataset : private DefaultCategoryDataset

jFreeChart reload dataset issue

独自空忆成欢 提交于 2019-12-10 23:15:52
问题 I use JFreeChart to display some simple data in a column chart. I have no problem in loading the dataset into the chart and display the data, but my issue come when I'm trying to use checkboxes to sort the data. When checked, the data from year2001 should be display, when uncheck, data from all years should be displayed. From performing a println I can see that the checkboxes is working and that the data from Persons.getPersons().getCountSuccessYesMale() is changed, but the chart is not

Adding a ChartPanel to JPanel

怎甘沉沦 提交于 2019-12-10 22:49:36
问题 I've got some not working code here: XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.HORIZONTAL, true, true, true); ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setDomainZoomable(true); jPanel4.setLayout(new BorderLayout()); jPanel4.add(chartpanel, BorderLayout.NORTH); So the problem is that the jPanel4 with a chart is not visible. When I add my