jfreechart

How can I display a JFreeChart in web browser with Stripes Framework

时光总嘲笑我的痴心妄想 提交于 2019-12-01 19:33:10
This is the situation: My 'metrics.jsp' page submits a couple variables that are needed to create the chart. The 'ProjectActionBean.java' calls down to a few other java classes that create the JFreeChart. I can display the chart in a pop-up but I want it to be displayed in the original browser window. JFreeChart placeChart = ChartFactory.createBarChart( "ChartName", "", //x-axis label "", //y-axis label dataset, PlotOrientation.VERTICAL, false, //legend true, //tooltype false); //generate urls ChartFrame frame = new ChartFrame(name, placeChart); frame.pack(); frame.setVisible(true); I've

JFreeChart Legend Display

喜你入骨 提交于 2019-12-01 19:24:20
问题 In my JFreeChart timeseries plots I find the legends lines to thin to see the colour accurately. Another post [ jfreechart - change sample of colors in legend ] suggested overriding a renderer method as follows: renderer = new XYLineAndShapeRenderer() { private static final long serialVersionUID = 1L; public Shape lookupLegendShape(int series) { return new Rectangle(15, 15); } }; this approach works fine until you do what I did renderer.setSeriesShapesVisible(i, false); Once I did that the

modify dataset of an already built chart with Java and JFreeChart

冷暖自知 提交于 2019-12-01 19:20:46
Let's say I've generated a chart with the following code: private ChartPanel createChart(){ XYSeries series1 = new XYSeries("First"); XYSeries series2 = new XYSeries("Second"); XYSeries series3 = new XYSeries("Third"); series1.add(0.0, 5.5); series1.add(5, 10); series1.add(10, 5.5); series2.add(0.0, 2); series2.add(5, 2); series2.add(10, 7); series3.add(0.0, 10); series3.add(5, 5); series3.add(10, 6); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1); dataset.addSeries(series2); dataset.addSeries(series3); JFreeChart chart = ChartFactory.createXYLineChart("line

Tooltip with values while using SpiderWebPlot

你。 提交于 2019-12-01 18:54:34
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.nextInt(20), rowKey, "CALL"); dataSet.addValue(rnd.nextInt(20), rowKey, "CHECK"); dataSet.addValue(rnd

Change JFreeChart Histogram colors dynamically?

痴心易碎 提交于 2019-12-01 18:36:21
I'm trying to show the histogram of an image and show only some colors. I've already done that with JFreeChart and createXYLineChart and getting all the data by iterating over all pixels. To speed it up I'm trying to do it with "createHistogram". I've followed this code . To update the chart with the new values I've used this two methods: XYPlot plot = (XYPlot) chart.getPlot(); plot.setDataset(setHistogram(red, green, blue)); Being setHistogram a method which returns a HistogramDataset depending on which checkbox are activated (boolean red, green and blue). That works properly as intended. The

Create barchart using jfreechart with bars of same category together

夙愿已清 提交于 2019-12-01 18:16:06
I want to make bar chart using jfreechart such that the bars which belong to the same category should be displayed adjacent without any gaps. The categories should be displayed with gaps. Also each category may have different number of bars. How it can be achived using Jfreechart library? Following image is the sample of what I require. Here all the bars of same category should be of same color and with no gap(or a very little gap). Thanks in advance, Abhinav I am aware of the age of this post. Anyway I am posting my solution, maybe someone else who will find himself here looking for the

How to disable zoom by mouse dragged without disabling by mousewheellistener in jfreechart?

自古美人都是妖i 提交于 2019-12-01 18:02:20
问题 I would like to disable zooming by mouse dragging(which paints that rectangle), but not disable zooming by MouseWheel. I found in another topic how to disable zoom reset while dragging mouse to left (restoreAutoBounds) and I'm interested in how to solve this problem. Is there a little shortcut to do that? 回答1: Ok, I've done it, by overriding MouseWheelListener. After chartPannel.setMouseZoomable(false).: chartPanel.addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved

How to disable zoom by mouse dragged without disabling by mousewheellistener in jfreechart?

寵の児 提交于 2019-12-01 17:56:27
I would like to disable zooming by mouse dragging(which paints that rectangle), but not disable zooming by MouseWheel. I found in another topic how to disable zoom reset while dragging mouse to left (restoreAutoBounds) and I'm interested in how to solve this problem. Is there a little shortcut to do that? Ok, I've done it, by overriding MouseWheelListener. After chartPannel.setMouseZoomable(false).: chartPanel.addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent arg0) { if (arg0.getWheelRotation() > 0) { chartPanel.zoomOutDomain(0.5, 0.5); } else if

Create barchart using jfreechart with bars of same category together

女生的网名这么多〃 提交于 2019-12-01 17:19:52
问题 I want to make bar chart using jfreechart such that the bars which belong to the same category should be displayed adjacent without any gaps. The categories should be displayed with gaps. Also each category may have different number of bars. How it can be achived using Jfreechart library? Following image is the sample of what I require. Here all the bars of same category should be of same color and with no gap(or a very little gap). Thanks in advance, Abhinav 回答1: I am aware of the age of

JFreeChart - how to reverse axis order

China☆狼群 提交于 2019-12-01 16:06:29
问题 I'm creating XYPlot and I need to reverse the order on y-Axis (that is, I need lower numbers to be higher on the axis). I would appreciate any hints how to do that. 回答1: I had the same problem as you. I found this: ChartPanel.getChart().getXYPlot().getRangeAxis().setInverted(boolean) 回答2: to reverse the Y-axis ... you can use ChartPanel.getChart().getXYPlot().getDomainAxis().setInverted(boolean) Source: Reverse X-axis numeric labels in JFreeChart 来源: https://stackoverflow.com/questions