Wednesday, September 8, 2010

Open Source chart libraries

Good Open Source chart libraries.

JfreeChart - http://www.jfree.org/jfreechart/
FusionChartsFree - http://www.fusioncharts.com/free/
JCCKit project (LGPL)
QN Plot project (BSD)
OpenChart2 project (LGPL)
PtPlot project (UC Berkeley copyright)
JRobin project (LGPL)
Java Chart Construction Kit (LGPL, works with JDK 1.1.8)
JOpenChart project (LGPL)
jCharts project (BSD-style)
JChart2D project (LGPL)
Chart2D project (LGPL)
ThunderGraph project (LGPL)
E-Gantt project (Q Public License)
MagPlot project (GPL)


I'm going to demonstrate code samples for bar chats and pie charts with JFreeChart

Note: jfreechart-1.0.13.jar and jcommon-1.0.16.jar should be available within your classpath.

1)  PieChart example....


package sample;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

public class PieChart {

    public static void main(String[] args) {
        // create a dataset...
        DefaultPieDataset data = new DefaultPieDataset();
        data.setValue("Category 1", 43.2);
        data.setValue("Category 2", 27.9);
        data.setValue("Category 3", 79.5);
        // create a chart...
        JFreeChart chart = ChartFactory.createPieChart(
                "Sample Pie Chart",
                data,
                true,    // legend?
                true,    // tooltips?
                false    // URLs?
        );
        // create and display a frame...
        ChartFrame frame = new ChartFrame("First", chart);
        frame.pack();
        frame.setVisible(true);
    }
}


2) BarChart example...

package sample;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultIntervalCategoryDataset;

public class BarChart {

    public static void main(String[] args) {
        // create a dataset...
        double start[][] = new double[2][3];
        start[0][0] = 3;
        start[0][1] = 4;
        start[0][2] = 2;

        start[0][0] = 4;
        start[1][0] = 6;
       
        double end[][] = new double[2][3];

        end[0][0] = 2;
        end[0][1] = 5;
        end[0][2] = 1;

        end[0][0] = 5;
        end[1][0] = 2;

        CategoryDataset data = new DefaultIntervalCategoryDataset(start, end);

        JFreeChart chart = ChartFactory.createBarChart("title",
                "x axis", "y axis",
                data,
                PlotOrientation.VERTICAL,
                true,    // legend?
                true,    // tooltips?
                false    // URLs?
        );
        // create and display a frame...
        ChartFrame frame = new ChartFrame("Second", chart);
        frame.pack();
        frame.setVisible(true);
    }

}

Monday, July 12, 2010

MongoDb In Action

MongoDB is a scalable, high-performance, open source, document-oriented database. MongoDB bridges the gap between key-value stores (which are fast and highly scalable) and traditional RDBMS systems (which provide rich queries and deep functionality).

Thursday, April 15, 2010

Correct Dinner table settings


Planning a dinner and need a reminder of how to set a table and where the cutlery should be placed around the tableware? It's easy to forget how to set a table and the proper place setting of tableware and cutlery. So here's a quick refresher to help you learn how to set a table for that 'perfect' dinner setting.

Friday, March 26, 2010

Cellphone Etiquette

Everyone carries a cellphone these days and whether it’s non-stop texting or loud public calls, there’s no shortage of ways to be completely rude while using them. Here are some tips for adults and children on how to be more polite about cellphone usage.

Cell Phone Etiquette

Wednesday, March 24, 2010

Periodic Table of Visualization Methods

"a picture is worth a 1000 words" is a well known statement. When we are doing some documentation(SRS, PRD, Design Docs, etc...) or marketing/sales presentation we use lots of diagrams(eg: Charts, Trees, MindMaps, Tables, etc..) to explain some thing more clearly.

Here you can find a single place where it has some sample set of Visualization methodologies which we can use within our documentaions or presentations.

Check this out: http://www.visual-literacy.org/periodic_table/periodic_table.html

Move the mouse into each square and check the sample diagrams available.

I hope this will be helpful for Business Analysts, Sales/Marketing people, Technical Writers, etc...

Tuesday, March 23, 2010

Do you need a simple tool to count the lines of code




Use cloc - http://cloc.sourceforge.net/

Its so simple to generate the lines of code of your project. Above shows an output of the current project I'm working on.

Sunday, January 17, 2010

URL Shortners

When your tweeting, you might need to shorten some lengthy URLs. Here are some important URL shortners.

1. http://is.gd/
2. http://migre.me/
3. http://miud.in/

Monday, January 11, 2010

How to get a Blogspot RSS url

Simply add this to the end of your blogger ( blogspot ) address: /atom.xml

Example:
If we need to get RSS URL of my blogger: http://thilina-anjitha.blogspot.com

My RSS url will then be : http://thilina-anjitha.blogspot.com/atom.xml