FREQUENTLY ASKED QUESTIONS

A free public discussion forum for the JFreeChart class library.

FREQUENTLY ASKED QUESTIONS

Postby david.gilbert » Mon May 22, 2006 3:46 pm

Our list of frequently asked questions has been posted on the JFreeChart web site:

http://www.jfree.org/jfreechart/faq.html

Feedback can be posted here.
Dave Gilbert
JFreeChart Project Leader

:idea: Buy the JFreeChart Developer Guide :idea:
david.gilbert
JFreeChart Project Leader
 
Posts: 10759
Joined: Fri Mar 14, 2003 10:29 am
Location: Europe

Postby RichardWest » Thu Sep 27, 2007 9:45 pm

Question: How can I change the color of my bar, line, point, etc. based upon its value?

Answer:

Extend your renderer of choice and override the getItemPaint(...) method. For examples, see the following threads:

BarRenderer:
Configure Negative Bar Color
Changing BarChart bar colors. Is this possible?
Bar Chart - Bars with different colours

XYRenderer:
Different colours on a line between 2 data points (also discusses tabs in TextTitle)

All these examples can be applied to any situation. For a more extensive list of examples/discussions, seach the forum.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
RichardWest
 
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Re: FREQUENTLY ASKED QUESTIONS

Postby paradoxoff » Fri Sep 25, 2009 5:35 pm

Question: The number of tick marks is so high that they overlap/are truncated, and it is impossible to read them! What can I do?

Answer:
The tick marks or "tick labels" are created by the axis. Axes that extend ValueAxis (DateAxis, NumberAxis, LogAxis...) will by default show the labels for as many ticks as possible without tick label overlap. A CategoryAxis will create a label for each unique column key in the respective CategoryDataset.

If your are dealing with overlappig tick marks, you have probably used a CategoryPlot with a CategoryDataset which has a too large number of column keys. Check whether the Comparable instances that you use as column keys are in fact Numbers or Dates. If that is the case, switch to an XYSeriesCollection or TimeSeriesCollection, and build an XYPlot. The ChartFactory contains a number of static methods to create those plots.

If you really need to use a CategoryDataset with a large number of column keys, you can try to wrap that in a SlidingCategoryDataset and expose only a subset of the original dataset to the plot at a time.

If this is not an option as well, you should hide the (useless) tick marks completely (axis.setTickLabelsVisible(false)). In a desktop enviroment (Swing GUI), you can still make the column keys visible by assigning a suitable CategoryToolTipGenerator to the renderer. You will probably want to show the column keys as tool tip. Check StandardCategoryToolTipGenerator as an example.
paradoxoff
 
Posts: 826
Joined: Sat Feb 17, 2007 1:51 pm

Re: FREQUENTLY ASKED QUESTIONS

Postby 8Cuber » Tue Mar 23, 2010 12:26 am

Thanks for the FAQ and additions! Im still new to jfree so this is quite a bunch to sift through...but hopefully it will pay off. :D
A user friendly computer first requires a friendly user.
8Cuber
 
Posts: 1
Joined: Sun Jan 03, 2010 1:59 am
Location: Germany & Blogosphere

Re: FREQUENTLY ASKED QUESTIONS

Postby sabharish » Sat Jun 19, 2010 8:20 am

Hello dear friends,

I need to create a bar chart (plotorientation -> vertical)
x-axis : last seven days [e.g. 19th Jun 10, 18th Jun 10, 17th Jun 10, 16th Jun 10, 15th Jun 10, 14th Jun 10, 13th Jun 10]
y-axis : percentage [e.g. 0 - 100]

My Scenario:
---------------
If I've data availability 50% on 19th Jun 10. The half bar should show in green color and the remaining half bar in red color. If it's 72% data available, then the first 75% bar should show in green color and the remaining 25% bar should show in red color.

Please help me on this as early as possible...

And please suggest me on how to post a sample image in this section...because "A picture is worth a thousand words"

Thanks,
Sabharish babu
sabharish
 
Posts: 2
Joined: Sat Jun 19, 2010 7:53 am
Location: Bangalore, INDIA


Return to JFreeChart - General

Who is online

Users browsing this forum: Google [Bot] and 5 guests

cron