jfreechart

Java Need stepRender lines for some but not all lines

末鹿安然 提交于 2019-12-24 17:55:58
问题 I have a JFreeChart that has several different lines plotted on it. I need to change some of the lines to step lines. I know I need to use the CategoryStepRenderer but am having trouble implementing it. I attached the following code that I use to change the color of the lines. I would like to be able to do the step line in a similar way. All of the ways I have found involve changing all of the lines. Thanks private void updateChartColor(ArrayList mlColor,ArrayList mlLine){ XYPlot plot=(XYPlot

Jfree chart change Y axis data

怎甘沉沦 提交于 2019-12-24 17:29:57
问题 I am using Jfree chart 0.9.20's XYLineChartDemo for plotting the execution time of running processes in a program. My X axis denotes the time and Y axis should denote the Pid. How can I edit the Jfreechart files to make my Y axis to denote values I want and not numbers 0-range?? Also is there a way to make the line plotted to be made thicker in width? 回答1: study this: public JFreeChart createChart(String axisX, String axisY){ JFreeChart chart = ChartFactory.createTimeSeriesChart(null, axisX,

jFreeChart: Change Bar color regardless of series

ε祈祈猫儿з 提交于 2019-12-24 16:26:53
问题 I need to change the color of Bars regardless of their series. so setSeriesPaint() is not useful in this case. Is there another way? 回答1: You can override the getItemPaint() method to return the desired color, as suggested here. 来源: https://stackoverflow.com/questions/3336010/jfreechart-change-bar-color-regardless-of-series

Right-clicking on a JFreeChart

╄→гoц情女王★ 提交于 2019-12-24 16:05:18
问题 It seems to me that the chartMouseClicked method gets called only when the user left-clicks on a chart. What's being called when the user right-clicks on a chart and the popup menu is displayed? I want to do something in the background when the user right-clicks before the popup menu is displayed. Thanks! 回答1: ChartPanel implements MouseListener to display the context menu. To accommodate disparate platforms, it checks isPopupTrigger() in both mousePressed() and mouseReleased(). You may need

Superscript in jfree chart

╄→尐↘猪︶ㄣ 提交于 2019-12-24 15:35:57
问题 I have a x-y axis in jfree chart. In legend I want to use superscript(A/B^2) is there any solution for this?I found something for labels but how does it work for jfreechart? 回答1: You can use Unicode, e.g. A/B². Addendum: For more complex rendering, consider one of the org.jfree.chart.annotations suitable for imaging, such as XYDrawableAnnotation , XYImageAnnotation , XYDataImageAnnotation . 来源: https://stackoverflow.com/questions/6657538/superscript-in-jfree-chart

Refreshing chart when a new file is opened

こ雲淡風輕ζ 提交于 2019-12-24 14:13:45
问题 I have to represent data returned from a file chooser to a chart. Everything works fine until I press the button again and choose a different file. The problem is that instead of representing the new dataset, it's adding it to the previous one. I tried the revalidate , repaint and remove methods, but nothing worked (or I didn't know where to put those methods. My code looks like this: JButton theButton = new JButton("Choose the file"); theButton.addActionListener(new ActionListener() { public

JFreeChart - IntervalMarker vertical?

走远了吗. 提交于 2019-12-24 11:07:09
问题 In the examples provided by JFreechart , we see that it is possible to display horizontal IntervalMarker s. I would like to build vertical IntervalMarker s and I do not find the way to do that using this example. 回答1: In Cartesian coordinates , the domain is orthogonal to the range, so final IntervalMarker target = new IntervalMarker(10.0, 20.0); target.setLabel("Target Domain"); ... plot.addDomainMarker(target, Layer.BACKGROUND); 来源: https://stackoverflow.com/questions/5964674/jfreechart

JFreeChart - Axis label positioning

北慕城南 提交于 2019-12-24 08:27:13
问题 I want the label of one of my axis to be two words, each aligned to the beginning and end of said axis - I've been doing this by inserting spaces in the Axis label, but it's a crappy solution. Is there a way to align label text for a JFreeChart chart? Thanks for any replies! 回答1: You can override drawLabel to achieve any desired effect. Invoke getFontMetrics() on the parameter g2 to position the text precisely. The JCommon class TextUtilities, used extensively in JFreeChart, may offer more

JFreeChart solution to draw a graph with a lot of data (>100) or (>1000)

不想你离开。 提交于 2019-12-24 08:23:59
问题 I have a graph with a lot of data (>100) or (>1000). Here's how JFreeChart prints the graph now. There are only 11 data points, and each person's name should appear on the x axis, but there are ellipses in place. Is there an ideal way to print large numbers of data like this? public void barchartResults(ArrayList<Person> results, String testName) { int i; setLayout(new FlowLayout(FlowLayout.LEFT, 20, 20)); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String test = results

Why does the x axis disappear when the graph very big

本秂侑毒 提交于 2019-12-24 07:43:08
问题 I am trying to load large graphs using JFreeChart . However, I have a problem with the X axis when the buffered image is above a certain size. The values disappear on the X axis. This can be seen in the third graph on the image. I would appreciate any help in fixing the problem import java.awt.Color; import java.awt.image.BufferedImage; import java.util.ArrayList; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.ValueAxis; import org.jfree