|
|
Line 56: |
Line 56: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("Bar", | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "") |
− | chartTitle, "Category", "value", dataTable, no_category, pairs,
| |
− | "")
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 73: |
Line 71: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("Bar", | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "horizontal") |
− | chartTitle, "Category", "value", dataTable, no_category, pairs,
| |
− | "horizontal")
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 90: |
Line 86: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("Bar", | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "3D") |
− | chartTitle, "Category", "value", dataTable, no_category, pairs,
| |
− | "3D")
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 107: |
Line 101: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("Bar", | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "layered"); |
− | chartTitle, "Category", "value", dataTable, no_category, pairs,
| |
− | "layered");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 124: |
Line 116: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("Bar", | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "stacked"); |
− | chartTitle, "Category", "value", dataTable, no_category, pairs,
| |
− | "stacked");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 141: |
Line 131: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("Bar", "Product Cost Breakdown", | + | chart = chartMaker.getCategoryChart("Bar", "Product Cost Breakdown", "Expense Category", "Cost Per Unit", dataTable, no_category, pairs, "waterfall"); |
− | "Expense Category",
| |
− | "Cost Per Unit", dataTable, no_category, pairs,
| |
− | "waterfall");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 159: |
Line 146: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("BarStat", | + | chart = chartMaker.getCategoryChart("BarStat", chartTitle, "Type", "value", dataTable, no_category, pairs, ""); |
− | chartTitle, "Type", "value", dataTable, no_category, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 177: |
Line 162: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("BarStatRaw", | + | chart = chartMaker.getCategoryChart("BarStatRaw", chartTitle, "Type", "value", dataTable, no_category, pairs, ""); |
− | chartTitle, "Type", "value", dataTable, no_category, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 193: |
Line 176: |
| pairs[i][1] = i*2+1; //column 0 stores time | | pairs[i][1] = i*2+1; //column 0 stores time |
| } | | } |
− | chart = chartMaker.getXYChart("Bar", | + | chart = chartMaker.getXYChart("Bar", chartTitle, "Category", "value", dataTable, no_series, pairs, "Year"); |
− | chartTitle, "Category", "value", dataTable, no_series, pairs,
| |
− | "Year");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 233: |
Line 214: |
| } | | } |
| | | |
− | chart = chartMaker.getCategoryChart("Line", | + | chart = chartMaker.getCategoryChart("Line", "Category Chart", "Release", "Class Count", dataTable, no_category, pairs,"nofill"); |
− | "Category Chart", "Release", "Class Count", dataTable, no_category, pairs,
| |
− | "nofill");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 248: |
Line 227: |
| pairs[i][1] = 2*i+1; //column y | | pairs[i][1] = 2*i+1; //column y |
| } | | } |
− | chart = chartMaker.getXYChart("Line", | + | chart = chartMaker.getXYChart("Line",chartTitle, "X", "Y", dataTable, no_series, pairs, ""); |
− | chartTitle, "X", "Y", dataTable, no_series, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 263: |
Line 240: |
| pairs[i][1] = 2*i+1; //column y | | pairs[i][1] = 2*i+1; //column y |
| } | | } |
− | chart = chartMaker.getXYChart("Line", | + | chart = chartMaker.getXYChart("Line", "Line Chart", "X", "Y", dataTable, no_series, pairs,"noline"); |
− | "Line Chart", "X", "Y", dataTable, no_series, pairs,
| |
− | "noline");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 278: |
Line 253: |
| pairs[i][1] = 2*i+1; //column y | | pairs[i][1] = 2*i+1; //column y |
| } | | } |
− | chart = chartMaker.getXYChart("LineQQDD", | + | chart = chartMaker.getXYChart("LineQQDD", "QQD2D Chart", "Group1", "Group 2", dataTable, no_series, pairs, ""); |
− | "QQD2D Chart", "Group1", "Group 2", dataTable, no_series, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 293: |
Line 266: |
| pairs[i][1] = 0; //column y | | pairs[i][1] = 0; //column y |
| } | | } |
− | chart = chartMaker.getXYChart("LineQQ", | + | chart = chartMaker.getXYChart("LineQQ", "QQNormalPlot Chart", "Data", "NormalDistribution of Data", dataTable, no_series, pairs, ""); |
− | "QQNormalPlot Chart", "Data", "NormalDistribution of Data", dataTable, no_series, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 304: |
Line 275: |
| pairs[0][0] = 0; //mean | | pairs[0][0] = 0; //mean |
| pairs[0][1] = 1; // stdDev | | pairs[0][1] = 1; // stdDev |
− | chart = chartMaker.getXYChart("ND", | + | chart = chartMaker.getXYChart("ND", "Normaldistribution Chart", "X", "Y", dataTable, 1, pairs, "noshape nofill "); |
− | "Normaldistribution Chart", "X", "Y", dataTable, 1, pairs,
| |
− | "noshape nofill ");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 320: |
Line 289: |
| pairs[i][1] = 0; //column 0 stores series name | | pairs[i][1] = 0; //column 0 stores series name |
| } | | } |
− | chart = chartMaker.getCategoryChart("LineStat", | + | chart = chartMaker.getCategoryChart("LineStat", "LineChart", "Type", "value", dataTable, no_category, pairs, ""); |
− | "LineChart", "Type", "value", dataTable, no_category, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 336: |
Line 303: |
| pairs[i][1] = 0; //column 0 stores series name | | pairs[i][1] = 0; //column 0 stores series name |
| } | | } |
− | chart = chartMaker.getCategoryChart("LineStatRaw", | + | chart = chartMaker.getCategoryChart("LineStatRaw", "LineChart", "Type", "value", dataTable, no_category, pairs, ""); |
− | "LineChart", "Type", "value", dataTable, no_category, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Line 351: |
Line 316: |
| pairs[i][1] = 2*i+1; //column y | | pairs[i][1] = 2*i+1; //column y |
| } | | } |
− | chart = chartMaker.getXYChart("Step", | + | chart = chartMaker.getXYChart("Step", "Step Chart", "X", "Y", dataTable, no_series, pairs, ""); |
− | "Step Chart", "X", "Y", dataTable, no_series, pairs,
| |
− | "");
| |
| chartPanel = new ChartPanel(chart, false); | | chartPanel = new ChartPanel(chart, false); |
| </pre> | | </pre> |
Pie Charts
|
Chart |
Chart data in JTable |
Sample code
|
PieChart2D |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int[][] pairs = new int[1][2];
pairs[0][0] = 1; // value
pairs[0][1] = 0; // name
chart = chartMaker.getPieChart(chartTitle, dataTable, pairs,"");
chartPanel = new ChartPanel(chart, false);
|
PieChart3D with rotation |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int[][] pairs = new int[1][2];
pairs[0][0] = 1; // value
pairs[0][1] = 0; // name
chart = chartMaker.getPieChart(chartTitle, dataTable, pairs,"3D counter_clockwise");
chartPanel = new ChartPanel(chart, false);
|
RingChart |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int[][] pairs = new int[1][2];
pairs[0][0] = 1; // value
pairs[0][1] = 0; // name
chart = chartMaker.getPieChart(chartTitle, dataTable, pairs,"ring");
chartPanel = new ChartPanel(chart, false);
|
JFreeChart getPieChart(java.lang.String title, javax.swing.JTable table, int[][] pairs, java.lang.String other)
Options for the getPieChart method are: 2D/3D/ring, clockwise/counter_clockwise. 2D is the default.
Bar Charts
|
Chart |
Chart data in JTable |
Sample code
|
Bar2D |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "")
chartPanel = new ChartPanel(chart, false);
|
Bar2D Horizontal Layout |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "horizontal")
chartPanel = new ChartPanel(chart, false);
|
Bar3D |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "3D")
chartPanel = new ChartPanel(chart, false);
|
Layered Bar |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "layered");
chartPanel = new ChartPanel(chart, false);
|
Stacked Bar |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "stacked");
chartPanel = new ChartPanel(chart, false);
|
Waterfall Bar |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("Bar", "Product Cost Breakdown", "Expense Category", "Cost Per Unit", dataTable, no_category, pairs, "waterfall");
chartPanel = new ChartPanel(chart, false);
|
Statistical Bar |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("BarStat", chartTitle, "Type", "value", dataTable, no_category, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
Statistical Bar with Raw Data |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("BarStatRaw", chartTitle, "Type", "value", dataTable, no_category, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
XY BarChart using XYDataset |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = (dataTable.getColumnCount()-2)/2;
int[][] pairs = new int[no_series][2];
for (int i=0; i<no_series; i++){
pairs[i][0] = i*2; //column 1 stores value
pairs[i][1] = i*2+1; //column 0 stores time
}
chart = chartMaker.getXYChart("Bar", chartTitle, "Category", "value", dataTable, no_series, pairs, "Year");
chartPanel = new ChartPanel(chart, false);
|
Bar chart can be created using either getCategoryChart or getXYChart method depend on the data.
JFreeChart getCategoryChart(java.lang.String chartType, java.lang.String title, java.lang.String xLabel, java.lang.String yLabel, javax.swing.JTable table, int numberOfCategory, int[][] pairs, java.lang.String other)
Options for the getXYChart method's parameterchartType are: bar/barstat/barstatraw/line/linestat/linestatraw/step/area/areatime/eventfreq/spiderweb. bar is the default.
Options for the getCategoryChart method's parameterother are: horizontal/vertical, 3D, stacked/layered/waterfall, year/month/day/minute. Vertical is the default.
JFreeChart getXYChart(java.lang.String chartType, java.lang.String title, java.lang.String xLabel, java.lang.String yLabel, javax.swing.JTable table, int numberOfSeries, int[][] pairs, java.lang.String other)
Options for the getXYChart method's parameterchartType are: line/bar/linetime/lineqq/lineqqdd/area/areatime/step/nd/differencetime/symbolicaxis/polar. line is the default.
Options for the getXYChart method's parameterother are: horizontal/vertical, noline/nofill/noshape, year/month/day/minute. Vertical is the default.
Line Charts
|
Chart |
Chart data in JTable |
Sample code
|
Line chart using CategoryDataset |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("Line", "Category Chart", "Release", "Class Count", dataTable, no_category, pairs,"nofill");
chartPanel = new ChartPanel(chart, false);
|
Line Chart using XYDataset |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = (dataTable.getColumnCount()-2)/2;
int[][] pairs = new int[no_series][2];
for (int i=0; i<no_series; i++){
pairs[i][0] = 2*i; //column x
pairs[i][1] = 2*i+1; //column y
}
chart = chartMaker.getXYChart("Line",chartTitle, "X", "Y", dataTable, no_series, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
Scatter Line Chart |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = (dataTable.getColumnCount()-2)/2;
int[][] pairs = new int[no_series][2];
for (int i=0; i<no_series; i++){
pairs[i][0] = 2*i; //column x
pairs[i][1] = 2*i+1; //column y
}
chart = chartMaker.getXYChart("Line", "Line Chart", "X", "Y", dataTable, no_series, pairs,"noline");
chartPanel = new ChartPanel(chart, false);
|
QQData2Data Chart |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getColumnCount()/2;
int[][] pairs = new int[no_series][2];
for (int i=0; i<no_series; i++){
pairs[i][0] = 2*i; //column x
pairs[i][1] = 2*i+1; //column y
}
chart = chartMaker.getXYChart("LineQQDD", "QQD2D Chart", "Group1", "Group 2", dataTable, no_series, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
QQNormal Chart |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getColumnCount(); //one y column only
int[][] pairs = new int[no_series][2];
for (int i=0; i<no_series; i++){
pairs[i][0] = 0; // there is no x column
pairs[i][1] = 0; //column y
}
chart = chartMaker.getXYChart("LineQQ", "QQNormalPlot Chart", "Data", "NormalDistribution of Data", dataTable, no_series, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
NormalDistrribution Chart |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int[][] pairs = new int[1][2];
pairs[0][0] = 0; //mean
pairs[0][1] = 1; // stdDev
chart = chartMaker.getXYChart("ND", "Normaldistribution Chart", "X", "Y", dataTable, 1, pairs, "noshape nofill ");
chartPanel = new ChartPanel(chart, false);
|
StatisticalLine Chart |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("LineStat", "LineChart", "Type", "value", dataTable, no_category, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
StatisticalLine Chart using raw data |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = dataTable.getRowCount()-1;
int no_category = dataTable.getColumnCount()-2;
int[][] pairs = new int[no_category][2];
for (int i=0; i<no_category; i++){
pairs[i][0] = i+1; //column i store category i
pairs[i][1] = 0; //column 0 stores series name
}
chart = chartMaker.getCategoryChart("LineStatRaw", "LineChart", "Type", "value", dataTable, no_category, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
Step Chart |
Error creating thumbnail: File missing |
|
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable();
int no_series = (dataTable.getColumnCount()-2)/2;
int[][] pairs = new int[no_series][2];
for (int i=0; i<no_series; i++){
pairs[i][0] = 2*i; //column x
pairs[i][1] = 2*i+1; //column y
}
chart = chartMaker.getXYChart("Step", "Step Chart", "X", "Y", dataTable, no_series, pairs, "");
chartPanel = new ChartPanel(chart, false);
|
Line chart can be created using either getCategoryChart or getXYChart method depend on the data.
JFreeChart getXYChart(java.lang.String chartType, java.lang.String title, java.lang.String xLabel, java.lang.String yLabel, javax.swing.JTable table, int numberOfSeries, int[][] pairs, java.lang.String other)
Options for the getXYChart method's parameterchartType are: line/bar/linetime/lineqq/lineqqdd/area/areatime/step/nd/differencetime/symbolicaxis/polar. line is the default.
Options for the getXYChart method's parameterother are: horizontal/vertical, noline/nofill/noshape, year/month/day/minute. Vertical is the default.
JFreeChart getCategoryChart(java.lang.String chartType, java.lang.String title, java.lang.String xLabel, java.lang.String yLabel, javax.swing.JTable table, int numberOfCategory, int[][] pairs, java.lang.String other)
Options for the getXYChart method's parameterchartType are: bar/barstat/barstatraw/line/linestat/linestatraw/step/area/areatime/eventfreq/spiderweb. bar is the default.
Options for the getCategoryChart method's parameter other are: horizontal/vertical, 3D, stacked/layered/waterfall, year/month/day/minute. Vertical is the default.