legend 1 « Legend « JFreeChart Q&A





1. Data table with legends in JfreeChart/Java    stackoverflow.com

I am using JFreeChart to generate images. I am trying to create barchart like below. I am able to create it successfully without data table. I tried to get more information ...

2. Sorting the Legend by the Backing Object    stackoverflow.com

Is there a way to sort the items in a JFreeChart legend by their backing object? I've noticed that the TimeSeries/Series sets the title via a Comparable object. Is there a ...

3. JFreeChart Get Legend Graphic    stackoverflow.com

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 ...

4. New Legend API: how to use?    jfree.org

Okay, but now I get a NullPointerException after I replaced the code to get it back compiling: JFreeChart.getLegend() return null. But there is no JFreeChart.setLegend() or createLegend(). How do I set the legend on? I tried chart.setOldLegend(new DefaultOldLegend()); but then I get a NullPointerException when I do a LegendTitle lt = chart.getLegend(); do set font, color, border, etc. ... It seems ...

5. Problem With Legend    jfree.org

I'm trying to get a legend to display on the East side of my chart. When I try: JFreeChart chart = new JFreeChart("Title", JFreeChart.DEFAULT_TITLE_FONT, plot, true); Legend legend = chart.getLegend(); legend.setAnchor(Legend.EAST); I get a fatal exception. So I tried: JFreeChart chart = new JFreeChart("Title", JFreeChart.DEFAULT_TITLE_FONT, plot, true); System.out.println(chart.getLegend()); and null was output. Any suggestions? Is this a bug? Is there a ...

6. Wordwrap of Legends???    jfree.org

7. Double Legends?    jfree.org

Hi, I'm creating an XYPlot that has a legend, with the legend being created when I call ChartFactory.createXYLineChart() by passing true in the legend parameter. The legend shows up as expected, but when I open the properties window by right-clicking the graph and go to the "Legend" tab, the box that says "Show Legend" is still not checked, and when I ...

8. Legend and jfreechart rc1    jfree.org

Hi I must have missed something here, and suspect that this is something I should know. I upgraded to rc1, and when I try to compile it wont, because of the Legend class. Earlier I used jfreechart.getLegend() and placed the legend where I wanted it. Now that method returns a LegendTitle instance, and I cant seem to find a way to ...





10. Icon in the chart's legend    jfree.org

Hi, I have just started using JFreeChart. The library looks great! I decided to use it in my app. I have got one question. Is it possible to put an icon +value instead of text + value in the legend of the PieChart3D? I have found: plot.setLegendLabelGenerator(new StandardPieItemLabelGenerator(pattern)); but it seems that StandardPieItemLabelGenerator does not allow to put an icon as ...

12. How to move the Legend???    jfree.org

13. What happen to class Legend upgrading from 0.9.21 to 1.0.0    jfree.org

I have recently had to upgrade the JFreeChart jar file and some code no longer compiles. I am not the resident chart expert and have had to upgrade some jars for one reason or another. The code that no longer works looks like JFreeChart chart = ... ... chart.getLegend().setAnchor(Legend.SOUTH); In version 0.9.21 the getLegend method returned a Legend but now returns ...

14. problem with legend    jfree.org

Hello! I have a 3d bar chart which each bar has a different color but belong to the same serie. I have done that defining my own renderer extending BarRenderer3D. Now, i would like to create a legend with the differents colors of my bars. My question is how can i create a new legend defining myself colors and text item. ...

15. Custom Legend    jfree.org

16. legends visibility    jfree.org

You can use the addLegend() method in the JFreeChart class. You might run into a problem with the fact that the legend is added to the chart as a subtitle, and its position in the subtitle list affects its position on the chart. So there may be cases where you have to fetch all the subtitles, clear the subtitles from the ...





17. moving the legend    jfree.org

18. Range marker legend    jfree.org

19. Legends disappeared from 0.9.7 to 1.0.0-rc1    jfree.org

In the latest release, legends are implemented using a new LegendTitle class, which is an extension of the org.jfree.chart.title.Title class. The main advantages of the new implementation are: - no special code is required to position the legend, it can be placed anywhere that a chart (sub)title can be placed; - multiple legends can be added to a chart; - hooks ...

20. Legend problem in JFreechart    jfree.org

21. Manipulating Legends    jfree.org

22. legend    jfree.org

23. Legend    jfree.org

Hi, Legend part is displaying on separate image,but if i disable legend in chart, at that time standardLegend object is null. ...... my code is like this.... StandardLegend legend=(StandardLegend)chart.getLegend(); BufferedImage image = new BufferedImage(480, 315, BufferedImage.SCALE_DEFAULT); Graphics2D g2 = image.createGraphics(); Rectangle2D chartArea = new Rectangle2D.Double(10, 15, 150, 150); legend.draw(g2,chartArea,null); ChartUtilities.writeBufferedImageAsPNG(out, image); chart is actual chart instance. I am getting from actual ...

24. Can I invert legend (without inverting the whole chart)?    jfree.org

Hello, I have following problem: the customer wants the legend for the stacked bar chart to be inverted as he supposes that in such way it is easier to read the graph. That means, that not the whole graph must be inverted, but only the order of series in a legend (the colors must still correspond with the graph!). Is it ...

25. Display legend    jfree.org

27. Hyperlink on legend    jfree.org

28. Legend problem    jfree.org

29. Help with Legend! URGENT!    jfree.org

30. 1 CombinedChart with 2 legends    jfree.org

32. custom legend ( in v.0.9.21 )    jfree.org

33. Custom Legends    jfree.org

HI I am creating BarChart with 2 Y-Axis. I want only some items to be shown in Legends. I am using following code where I have subclassed Plot and overriddern getLegendItems() method. But its not working. ************************************************************* final CategoryItemRenderer r1 = plot.getRenderer();final CategoryItemRenderer r2 = plot.getRenderer(1); if (r1 != null) { final LegendItem item = r1.getLegendItem(0, 0); result.add(item); } if (r2 ...

34. Separating Legend    jfree.org

35. Clickable legends?    jfree.org

Pre-1.0, when you clicked on a legend, a ChartMouseEvent was generated whose Entity was a LegendItemEntity. Of course, now that legends are no different from any other title, these events are no longer thrown. I tried using the LegendTitle's getBounds() and related methods, but they return zeros. Has anyone come up with a good way to handle clicking on legends?

37. Legend    jfree.org

Hi, I am facing a problem where the legend occupies the entire graph area suppressing the graph image. This happens when there are lots of sections on the graph and the space alloted for the graph(say 500x300) is not enough.Is there anyway we can cause the legend area to grow dynamically as needed? Or any other alternative suggestions.

39. Moving the legend    jfree.org

I have managed to move the legend of my charts to the the side, but they are still taking up a lot of space. I was wondering if it is possible to place the legend into the graph, or maybe even move the legend dynamically by using the mouse. My charts contain alot of blank space, and I would like to ...

40. Chart legend presentation    jfree.org

My users are having some difficulty with the default method of how multi axis charts are being displayed. They want duplicates amongs the axis to be merged in the legend but visible in the chart. The duplicate merging should also merge the color. So items with the same name should be the same color. I have tried to use a specific ...

41. Problem with Legend    jfree.org

42. XYSereies and Legend customisation    jfree.org

Hello All, I have a XYSeries, and I would like to customise the legend items. In my program I have 9 series but I only want to have 2 items displayed in the legend. Can anyone help me in solving this problem? Ive tried using LegendItem and LegendItemCollection but I have not been successful. I need some help please. Thanks very ...

43. Heading/Title for Legend    jfree.org

44. legend over chart    jfree.org

45. How do I create my own legends?    jfree.org

Hey Guys, I made a stackedBarChart with a line and this chart isn't generating a legend below it. Its ok cos I need to set it myself. But I have no clue how to create a set of Legends manually. I need to create some specifying the color of the little box and its name. Could anyone help me with this? ...

47. Alpha Transparency and the Legend    jfree.org

David, Would it be possible to add in a future release the ability to either set the foreground alpha transparency on the Legend, or have it track the actual value from the plot? When I use alpha transparency on the plot, the colors graphed do not appear to be the same as those displayed in the legend. Thanks, --kirby

48. Legend Superscripts    jfree.org

I have a need to have some text formatted as a superscript in a legend label. Basically I want to do this for footnoting purposes. Is this currently supported? If not, how would I go about implementing this? If it makes it easier, the superscript text could be at the end of the label.

51. Overlaid chart with no legend    jfree.org

Hi, I created an overlaid chart. It includes line and stackedarea graphs. It has 6 series in total and they are all displayed in the legend for this graph. The thing is I want to remove the legend and I tried the following ways: 1) JFreeChart(java.lang.String title, java.awt.Font titleFont, Plot plot, boolean createLegend) where I set createLegend False. 2) chart.removeLegend(); Both ...

52. Legends and other customizations    jfree.org

Greetings! My company recently purchased the license and I must say thank you as this has saved me alot of trouble!! Anyway I do have a question on customizing the display of the chart! My project involves replicating an old software which displayed its graphs in Excel format. Now I have been able to write the code to display the graphs...the ...

53. How to resize a legend    jfree.org

54. Combined chart with no legends?    jfree.org

Hi, I have a combined chart: Stacked Area Chart in the background and Line charts on top. I define custom colors for these charts. I would like to turn the legends off since they are meaningless for this chart. I have tried removeLegend() function. However when I use it - it changes my colors to vivid red and green colors - ...

55. Exctracting and showing only Legend    jfree.org

I have got myself into a bit of a pickle, my charts allows users to select as many categories as they wish to the point that the chart image is taken up with just the legend. So I have used the get legend function and put this into and chart image giving the users the ability to see the chart and ...

56. Legend covers up my chart    jfree.org

57. Problem with legend    jfree.org

I work at an application and I use JFreeChart for creating the charts. I want to add multiple datasets on the same chart (I add multiple datasets instead of adding multiple series in the same chart because this makes the things much easier with the logic of the application). But I have a problem with the legend. Even if I cannot ...

58. Legend on Right side of Chart    jfree.org

Still i have problems to change legend position by josram77 Fri Jul 20, 2007 10:05 pm I did the change suggested to my code... But i have the same result... So i prefer to send you my code... maybe you see other kind of error. Code: Select all public static JFreeChart crtBarChart3D(String chartTitle, String titleX, String titleY, ...

59. Change background legend    jfree.org

60. Legend Data in the ImageMap    jfree.org

63. Legend API, creating custom legend    jfree.org

Hi all, I am usign Pie plot for rendering my Pie Chart. I want to create my own legends (like changing the shape of the legend). Can anybody help me in using :- chart.addLegent(new LegendTitle(LegendItemSource)); I am bit confused on "LegendItemSource". Previously it was possible with StandardLegend. final StandardLegend stdLegend = new StandardLegend(chart); chart.setLegend(stdLegend);

64. Padding in chart legend    jfree.org

Ok, last stupid question (for now): I need some more white space between the border and the bullets & text in my legends. I thought the following would have some effect: LegendTitle legend = (LegendTitle) chart.getLegend(); legend.setItemLabelPadding(new RectangleInsets(10, 10, 10, 10)); ... and while it compiles, it seems to do nothing. I'm doing this as an add-on class with iReports, so ...

65. Legend Customisation    jfree.org

I am plotting a dataset with many series, and would like to customise the legend; Currently, the FlowArrangement will simply add LegendItems one after the other on the same line until the edge of the plot is reached at which point a new line in the legend is started. Instead I would like to control the number of LegendItems displayed on ...

67. How do I manage a legend in a combined chart?    jfree.org

I am creating a combined chart (for time series data) that will use several stacked area charts (like that in StackedXYAreaChartDemo1) and a step chart (like XYStepRendererDemo1). But the values in the different charts are related. The first series in chart one is connected to the first series in all of the other charts (in one chart, the value may be ...

68. Legends - Round Corners    jfree.org

69. Jfree Chart legend    jfree.org

70. Double legends on createScatterPlot    jfree.org

Double legends on createScatterPlot by michael714 Tue Jun 10, 2008 5:37 am Hello, Anyone know why I'm getting double legends when using createScatterPlot? Here's the code I use: Code: Select all JFreeChart chart = ChartFactory.createScatterPlot ...

71. Rounded Legend Corners    jfree.org

Hi, After looking around for a while, I found that was pretty easy to set rounded corners to legends, using StandardLegend. Once StardardLegend is not supported anymore, I'd like to know if there is any direct way I can do it with LegendTitle. Or must I write my own BlockFrame implementation? Thank you.

72. Legend Gap    jfree.org

73. Displaying legends in a scollpane    jfree.org

Hi, When I try to plot the graph for more number of series , say for example 200 to 300 or more, there is no space for graph, only the legengs occupy all the sapce. So I tried with the create chart with legends "false", this does not meet my need, I need to display all the legends in a separate ...

74. Showing legends only    jfree.org

75. Handling Legend    jfree.org

Can we decide the legends before hand of plotting the graph? For a huge dataset, Legends do not fit in correct proportion of the view. I have seen similar questions in the forum. I have got some hint of using LegendTitle class with custom Arrangement instances..... which I basically did not understand. Can someone help me on this topic?

77. Making a legend    jfree.org

79. Legends truncated    jfree.org

80. Facilitating Legend Wrapper    jfree.org

Hi, I am currently working to apply a wrapper to the legend to add subtitles without disrupting the auto-arrangement of the existing legend items(data series). I just wanted to add a few subtitles below the regular legend. The following is the code block that I wrote to implement the legend wrapper. BlockContainer legendinfo = new BlockContainer(); TextTitle equation = new TextTitle(); ...

81. Vertical Legend    jfree.org

/** * Constructs a new (empty) legend for the specified source. * * @param source the source. */ ...

82. Problem with Legend    jfree.org

by bcarrdba Thu Nov 27, 2008 2:45 pm Hi David, This happens when I first generate a report for a two day period (with domain auto range turned on). The report displays fine at this point. With the x-axis ONLY displaying the hour (ie. 12:00). However if the user selects "create projection" I then do a Code: Select all plot.setDataset( ...

83. Chart Legend not displayed    jfree.org

84. Issue in Legends    jfree.org

Hi I am creating a pie chart with jfree and i find few issues in it.. 1. The section label is getting hided under the chart frame since I have more than 10 sections. 2. Also is there any to make the section labels are of same length irrespective of the labels. thanks in advance...

85. legend -> visible/invisible    jfree.org

Hello, I have a problem with the legend in the JFreechart, so when I zoom into the chart I will 1. reload data from my database 2. series.clear(); (TimeSeries series) so the lines remove from the chart 3. clear the legend -> how can I do this -> if I invoke chart.removeLegend(); than the legend is removed but if I fill ...

86. Legend to file    jfree.org

87. Legend arrangement problem    jfree.org

Hello, I display several datasets in the same XYPlot and I'd want to set a legend like the following example : --dataset1Item1 --dataset1Item2 --dataset2Item1 --dataset2Item2 --dataset2Item3 ... Each dataset has its own line in the legend and if there are too many items regarding the specified chart width, then the list of items continues in a new line. I use the ...

88. TextTitle above Legend    jfree.org

89. Large legend causing display issue    jfree.org

JFreeChart jfc; jfc = ChartFactory.createTimeSeriesChart( sStatName, "Time", sStatName, dataset, true, ...

90. Missing legend information on some chart types.    jfree.org

I have a chart mouse listener on my JFreeChart objects listening for mouse clicks on the legend entity. I retrieve the value of the clicked legend item through the method LegendItemEntity.getSeriesKey(). This works correctly for the charts I have utilised thus far (bar, pie, time series, line, and area). I have recently added two new types: Spider-Web and Multiple-Pie. However, the ...

91. Replace '-' with ' ' in Legend    jfree.org

Hello! I have a requirement in which i have to create Group Stacked Bar chart using Series Expression with contains '-' so it is showing in Chart legends too, i need this '-' for Grouping in chart and i don't want to show it in legend (ie replace '-' this with ' ' (sapce)). Any one has solution to this then ...

92. One problem remaining with my legend    jfree.org

OK, after a little trial and tribulation, I have it all working, as far as my legend goes. The lines on the chart are fine, and their respective colours are easy to identify. However, the lines used for the legend are much too short and thin for me to easily see what the colour is. How does one thicken the lines ...

93. fixed legend?    jfree.org

hi, I want to create a xy line chart, which will display the legends right of the plot. My problem is when the legend text is long, it will squeeze the plot and make it smaller. So I want to display the legend in a area with fixed width and variable height, that will display the text in multiple columns. How ...

94. SpiderWeb Legend Entry    jfree.org

What are you doing with the LegendItems? For every rendering cycle, a new set of LegendItems will be created and used to create the LegendTitle. However you can use an arbitrary/user defined LegendItemSource for the LegendTitle instead of the plot. Alternatively you could subclass SpiderWebPlot, override getLegendItems() and use the constructor for the LegendItems that allows you to set the shapeFilled-flag ...

95. Legend links    jfree.org

Maybe with an imagemap... An alternative is to draw the chart with no legend, and create the legend yourself adjacent to it using plain old HTML. You can make the colored boxes or lines etc. using CSS-styled divs., img tags, SVG, etc. I've found that an HTML table works pretty well as a legend and an added benefit is adding more ...

96. Legend as a sole ui element    jfree.org

Hello, I have to display several graphs in one window. Each graph has the same legend as all the others. I know how to disable the legends in each graph. But now I need one legend which I want to display as a sole ui element. E.g. lets say A, B, C, D are graphs, I would like to have something ...

97. Class Legend    jfree.org

98. getLegendItems influences not only the legend?    jfree.org

Hi all, I have overridden the method getLegendItem in my renderer (extends LineAndShapeRenderer) and I return null for the legend item that I won't display in the legend. So far so good. What I don't unterstand is the fact that the series in my chart are now drawed with a different color and shape. I thinked that overridin this method should ...

99. Icon in the chart's legend    jfree.org

Hey, I recently started using JFreechart and its very interesting. I am stuck at one point. I wanted to add an Image Icon on to the Legend but was unable to do so. I need Legend Label with ICON next to it. I even cheked related posts but there are none. Can some one help? Its a Java Swing application I'm ...

100. Legends not shown when NO Data.    jfree.org

Thanks a ton Barbarius for your reply. But this is not the case with standard charts. I am showing same data with Standard, Stacked Bar and Bar charts. But all legends are appearing for standard chart even if there is no data. I am curios to know why it is happening with Bar Charts only. Thanks, Neeraj Kamboj