Archive for the ‘Charts’ Category
Monday, December 1st, 2008
This tip demonstrates how to create custom number format and percent format for the number axis (also known as the range axis in jfreechart)
In order to get the Item labels display a percent value, Edit the chart property "Item Label Number Format" to "##0%" and in order to display percent ...
Posted in Charts, How-to | No Comments »
Tuesday, November 25th, 2008
How to add custom background images to your dashboard charts.
In this example we placed this image as background for the thermometer chart http://www.foreststreams.com/snowcreekwater3web.JPG
import org.jfree.chart.plot.ThermometerPlot;
import org.jfree.chart.JFreeChart;
import java.awt.Toolkit;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
ThermometerPlot plot = (ThermometerPlot)chart.getPlot();
// plot.setInsets(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setThermometerStroke(new BasicStroke(2.0f));
plot.setThermometerPaint(Color.lightGray);
plot.setUnits(ThermometerPlot.UNITS_NONE);
plot.setRange(50000.0,200000.0);
float h = displayFrame.getHeight();
float w = displayFrame.getWidth();
// ...
Posted in Charts, How-to | 1 Comment »
Tuesday, November 25th, 2008
Interval Marker is a special feature that allows you set targets or reference point for your bar or line charts.
Here is a basic bar chart
To add a reference line or interval marker as below
Use the following code for the javascript
//import the necessary classes
import org.jfree.*;
import org.jfree.chart.axis.CategoryAxis;
//import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.NumberAxis;
//import org.jfree.chart.labels.CategoryItemLabelGenerator;
//import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.plot.CategoryPlot;
import ...
Posted in Charts, How-to | No Comments »
Tuesday, November 25th, 2008
How to add a constant horizontal line or a control line.
Following is a simple line chart
The query for the above chart is as follows
select calendar_month_name, sum(quantity_sold)-3500 as qty_sold
from [detail_data$]
where fiscal_year = 2001
and country_region like 'Americas'
group by calendar_month_name
Now if we need to add a Target line which would be a constant ...
Posted in Charts, How-to | 1 Comment »
Thursday, November 20th, 2008
Posted in Charts, General | 1 Comment »
Monday, September 8th, 2008
This is a simple chart to generate. It needs only X and Y values
select film_id x
,count(inventory_id) y1
from inventory
group by film_id
Posted in Charts | No Comments »
Saturday, September 6th, 2008
This is similar to bubble chart
Here is the SQL to generate Scatter plot
select film_id x
,count(inventory_id) y1 ,count(store_id)/10 z1
, film_id y2,count(inventory_id)/5 z2
from inventory
group by film_id
Posted in Charts | 2 Comments »
Friday, September 5th, 2008
Bubble charts are very interesting as it provides a depth to the normal 2 dimensional values.
The depth is percieved by the size of the bubble. You can create a bubble chart by providing a third column that represents the radius of the bubble. This is known as the Z axis.
select ...
Posted in Charts | 1 Comment »
Thursday, September 4th, 2008
Time Series is similar to XY Series chart. The only difference is the first X axis represents a Date or Time value. The Second column represents the Y value. Similarly you can add multiple series by adding more columns to the query
select date(payment_date),sum(amount) from payment
group by date(payment_date)
order by payment_date asc
Posted in Charts | 2 Comments »
Wednesday, September 3rd, 2008
To create this chart all that is needes is just the X and Y information.
The first column in your SQL should be the X value and the second column should be the Y value. If you are going to have multiple series then the X value is shared axis. The ...
Posted in Charts | 2 Comments »