Difference between revisions of "List of charts"
(40 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | ='''Pie Chart'''= | |
+ | |||
{| border="1" | {| border="1" | ||
|+ Pie Charts | |+ Pie Charts | ||
! !! Chart !! Chart data in JTable !! Sample code | ! !! Chart !! Chart data in JTable !! Sample code | ||
|- | |- | ||
− | | PieChart2D || [[image:chart_Pie2d.jpg|thumb|none|150px]] || [[image:chart_Pie2_data.jpg]] || <pre> | + | | PieChart2D || [[image:chart_Pie2d.jpg|thumb|none|150px]] || [[image:chart_Pie2_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
int[][] pairs = new int[1][2]; | int[][] pairs = new int[1][2]; | ||
Line 13: | Line 14: | ||
chartPanel = new ChartPanel(chart, false); </pre> | chartPanel = new ChartPanel(chart, false); </pre> | ||
|- | |- | ||
− | | PieChart3D with rotation|| [[image:chart_Pie3d.jpg|thumb|none|150px]] || [[image:Chart_Pie3d_data.jpg]] || <pre> | + | | PieChart3D with rotation|| [[image:chart_Pie3d.jpg|thumb|none|150px]] || [[image:Chart_Pie3d_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
int[][] pairs = new int[1][2]; | int[][] pairs = new int[1][2]; | ||
Line 22: | Line 23: | ||
chartPanel = new ChartPanel(chart, false); </pre> | chartPanel = new ChartPanel(chart, false); </pre> | ||
|- | |- | ||
− | | RingChart || [[image:Chart_Ring.jpg|thumb|none|150px]] || [[image:chart_Ring_data.jpg]] || <pre> | + | | RingChart || [[image:Chart_Ring.jpg|thumb|none|150px]] || [[image:chart_Ring_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
int[][] pairs = new int[1][2]; | int[][] pairs = new int[1][2]; | ||
Line 34: | Line 35: | ||
|} | |} | ||
− | + | <Strong>Note</strong> | |
+ | |||
+ | Pie chart can be created using the getPieChart method. | ||
+ | |||
+ | See [[list of charts#The_getChart_methods|the get*Chart methods section]] for detail. | ||
+ | |||
− | + | ='''Bar Chart'''= | |
− | |||
{| border="1" | {| border="1" | ||
|+ Bar Charts | |+ Bar Charts | ||
! !! Chart !! Chart data in JTable !! Sample code | ! !! Chart !! Chart data in JTable !! Sample code | ||
|- | |- | ||
− | | Bar2D || [[image:chart_Bar2d.jpg|thumb|none|150px]] || [[image:chart_Bar2d_data.jpg]] || <pre> | + | | Bar2D || [[image:chart_Bar2d.jpg|thumb|none|150px]] || [[image:chart_Bar2d_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 54: | Line 59: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "") | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", |
+ | dataTable, no_category, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | Bar2D Horizontal Layout || [[image:chart_Bar2d_h.jpg|thumb|none|150px]] || [[image:chart_Bar2d_h_data.jpg]] || <pre> | + | | Bar2D Horizontal Layout || [[image:chart_Bar2d_h.jpg|thumb|none|150px]] || [[image:chart_Bar2d_h_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 69: | Line 75: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "horizontal") | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", |
+ | dataTable, no_category, pairs, "horizontal"); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | Bar3D || [[image:chart_Bar3D.jpg|thumb|none|150px]] || [[image:chart_Bar3D_data.jpg]] || <pre> | + | | Bar3D || [[image:chart_Bar3D.jpg|thumb|none|150px]] || [[image:chart_Bar3D_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 84: | Line 91: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "3D") | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", |
+ | dataTable, no_category, pairs, "3D"); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | Layered Bar|| [[image:chart_Bar_layered.jpg|thumb|none|150px]] || [[image:chart_Bar_layered_data.jpg]] || <pre> | + | | Layered Bar|| [[image:chart_Bar_layered.jpg|thumb|none|150px]] || [[image:chart_Bar_layered_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 99: | Line 107: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "layered"); | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", |
+ | dataTable, no_category, pairs, "layered"); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | Stacked Bar || [[image:chart_Bar_stacked.jpg|thumb|none|150px]] || [[image:chart_Bar_stacked_data.jpg]] || <pre> | + | | Stacked Bar || [[image:chart_Bar_stacked.jpg|thumb|none|150px]] || [[image:chart_Bar_stacked_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 114: | Line 123: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", dataTable, no_category, pairs, "stacked"); | + | chart = chartMaker.getCategoryChart("Bar", chartTitle, "Category", "value", |
+ | dataTable, no_category, pairs, "stacked"); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | |Waterfall Bar || [[image:chart_Waterfall.jpg|thumb|none|150px]] || [[image:chart_Waterfall_data.jpg]] || <pre> | + | |Waterfall Bar || [[image:chart_Waterfall.jpg|thumb|none|150px]] || [[image:chart_Waterfall_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 129: | Line 139: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("Bar", "Product Cost Breakdown", | + | chart = chartMaker.getCategoryChart("Bar", "Product Cost Breakdown", |
− | + | "Expense Category", "Cost Per Unit", dataTable, | |
− | + | no_category, pairs, "waterfall"); | |
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | |Statistical Bar || [[image:chart_Statbar.jpg|thumb|none|150px]] || [[image:chart_Statbar_data.jpg]] || <pre> | + | |Statistical Bar || [[image:chart_Statbar.jpg|thumb|none|150px]] || [[image:chart_Statbar_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 146: | Line 156: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("BarStat", chartTitle, "Type", "value", dataTable, no_category, pairs, ""); | + | chart = chartMaker.getCategoryChart("BarStat", chartTitle, "Type", "value", |
+ | dataTable, no_category, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | |Statistical Bar with Raw Data|| [[image:chart_Statbar_raw.jpg|thumb|none|150px]] || [[image:chart_Statbar_raw_data.jpg]] || <pre> | + | |Statistical Bar with Raw Data|| [[image:chart_Statbar_raw.jpg|thumb|none|150px]] || [[image:chart_Statbar_raw_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 162: | Line 173: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("BarStatRaw", chartTitle, "Type", "value", dataTable, no_category, pairs, ""); | + | chart = chartMaker.getCategoryChart("BarStatRaw", chartTitle, "Type", "value", |
+ | dataTable, no_category, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | |XY BarChart using XYDataset|| [[image:chart_Xybar.jpg|thumb|none|150px]] || [[image:chart_Xybar_data.jpg]] || <pre> | + | |XY BarChart using XYDataset with Time Axis|| [[image:chart_Xybar.jpg|thumb|none|150px]] || [[image:chart_Xybar_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 176: | Line 188: | ||
pairs[i][1] = i*2+1; //column 0 stores time | pairs[i][1] = i*2+1; //column 0 stores time | ||
} | } | ||
− | chart = chartMaker.getXYChart("Bar",chartTitle, "Category", "value", dataTable, no_series, pairs,"Year"); | + | chart = chartMaker.getXYChart("Bar", chartTitle, "Category", "value", |
+ | dataTable, no_series, pairs, "Year"); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
+ | |- | ||
+ | |Histogram Chart|| [[image:chart_histogram.jpg|thumb|none|150px]] || [[image:chart_histogram_data.jpg|thumb|none|250px]] || <pre> | ||
+ | |||
+ | 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("Histogram","Category Chart", "Value", "Frequency", dataTable, no_series, pairs, String.valueOf(bin_size)); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | |||
+ | </pre> | ||
+ | |||
|} | |} | ||
+ | |||
+ | <Strong>Note</strong> | ||
Bar chart can be created using either getCategoryChart or getXYChart method depend on the data. | Bar chart can be created using either getCategoryChart or getXYChart method depend on the data. | ||
− | + | See [[list of charts#The_getChart_methods|the get*Chart methods section]] for detail. | |
− | |||
− | |||
− | + | ='''Line Chart'''= | |
− | |||
{| border="1" | {| border="1" | ||
|+ Line Charts | |+ Line Charts | ||
! !! Chart !! Chart data in JTable !! Sample code | ! !! Chart !! Chart data in JTable !! Sample code | ||
|- | |- | ||
− | | Line chart using CategoryDataset || [[image:chart_Line.jpg|thumb|none|150px]] || [[image:chart_Line_data.jpg]] || <pre> | + | | Line chart using CategoryDataset || [[image:chart_Line.jpg|thumb|none|150px]] || [[image:chart_Line_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 206: | Line 234: | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("Line", "Category Chart", "Release", "Class Count", dataTable, no_category, pairs,"nofill"); | + | chart = chartMaker.getCategoryChart("Line", "Category Chart", |
+ | "Release", "Class Count", | ||
+ | dataTable, no_category, pairs,"nofill"); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
− | |||
|- | |- | ||
− | | Line Chart using XYDataset || [[image:chart_Line.jpg|thumb|none|150px]] || [[image:chart_Line_data.jpg]] || <pre> | + | | Line Chart using XYDataset || [[image:chart_Line.jpg|thumb|none|150px]] || [[image:chart_Line_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 220: | Line 249: | ||
pairs[i][1] = 2*i+1; //column y | pairs[i][1] = 2*i+1; //column y | ||
} | } | ||
− | chart = chartMaker.getXYChart("Line",chartTitle, "X", "Y", dataTable, no_series, pairs,""); | + | chart = chartMaker.getXYChart("Line",chartTitle, "X", "Y", |
+ | dataTable, no_series, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | Scatter Line Chart || [[image:chart_Scatter.jpg|thumb|none|150px]] || [[image:chart_Scatter_data.jpg]] || <pre> | + | | Scatter Line Chart || [[image:chart_Scatter.jpg|thumb|none|150px]] || [[image:chart_Scatter_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 233: | Line 263: | ||
pairs[i][1] = 2*i+1; //column y | pairs[i][1] = 2*i+1; //column y | ||
} | } | ||
− | chart = chartMaker.getXYChart("Line","Line Chart", "X", "Y", dataTable, no_series, pairs,"noline"); | + | chart = chartMaker.getXYChart("Line", "Line Chart", "X", "Y", |
+ | dataTable, no_series, pairs,"noline"); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | QQData2Data Chart || [[image:chart_Dd.jpg|thumb|none|150px]] || [[image:chart_Dd_data.jpg]] || <pre> | + | | DotChart || [[image:chart_dotchart.jpg|thumb|none|150px]] || [[image:chart_dotchart_data.jpg|thumb|none|250px]] || <pre> |
+ | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
+ | |||
+ | int no_series = dataTable.getColumnCount(); | ||
+ | int[][] pairs = new int[no_series][2]; | ||
+ | for (int i=0; i<no_series; i++){ | ||
+ | pairs[i][0] = 0; //no column x | ||
+ | pairs[i][1] = 0; //column y | ||
+ | } | ||
+ | chart = chartMaker.getXYChart("Dot","Dot Chart", "Y", "X", dataTable, no_series, pairs,"noline horizontal"); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | IndexChart || [[image:chart_indexchart.jpg|thumb|none|150px]] || [[image:chart_indexchart_data.jpg|thumb|none|250px]] || <pre> | ||
+ | |||
+ | 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("Index","Index Chart", "Row", "Data", dataTable, no_series, pairs,"noshape"); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |||
+ | |- | ||
+ | | QQData2Data Chart || [[image:chart_Dd.jpg|thumb|none|150px]] || [[image:chart_Dd_data.jpg|thumb|none|250px]] || <pre> | ||
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 246: | Line 305: | ||
pairs[i][1] = 2*i+1; //column y | pairs[i][1] = 2*i+1; //column y | ||
} | } | ||
− | chart = chartMaker.getXYChart("LineQQDD","QQD2D Chart", "Group1", "Group 2", dataTable, no_series, pairs,""); | + | chart = chartMaker.getXYChart("LineQQDD", "QQD2D Chart", "Group1", "Group 2", |
+ | dataTable, no_series, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | QQNormal Chart || [[image:chart_Qq.jpg|thumb|none|150px]] || [[image:chart_Qq_data.jpg]] || <pre> | + | | QQNormal Chart || [[image:chart_Qq.jpg|thumb|none|150px]] || [[image:chart_Qq_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 259: | Line 319: | ||
pairs[i][1] = 0; //column y | pairs[i][1] = 0; //column y | ||
} | } | ||
− | chart = chartMaker.getXYChart("LineQQ","QQNormalPlot Chart", "Data", "NormalDistribution of Data", dataTable, no_series, pairs,""); | + | chart = chartMaker.getXYChart("LineQQ", "QQNormalPlot Chart", "Data", |
+ | "NormalDistribution of Data", | ||
+ | dataTable, no_series, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | NormalDistrribution Chart || [[image:chart_Nd.jpg|thumb|none|150px]] || [[image:chart_Nd_data.jpg]] || <pre> | + | | NormalDistrribution Chart || [[image:chart_Nd.jpg|thumb|none|150px]] || [[image:chart_Nd_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
int[][] pairs = new int[1][2]; | int[][] pairs = new int[1][2]; | ||
pairs[0][0] = 0; //mean | pairs[0][0] = 0; //mean | ||
pairs[0][1] = 1; // stdDev | pairs[0][1] = 1; // stdDev | ||
− | chart = chartMaker.getXYChart("ND","Normaldistribution Chart", "X", "Y", dataTable, 1, pairs, "noshape nofill "); | + | |
+ | chart = chartMaker.getXYChart("ND", "Normaldistribution Chart", "X", "Y", | ||
+ | dataTable, 1, pairs, "noshape nofill "); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
|- | |- | ||
− | | StatisticalLine Chart || [[image:chart_Statline.jpg|thumb|none|150px]] || [[image:chart_Statline_data.jpg]] || <pre> | + | | StatisticalLine Chart || [[image:chart_Statline.jpg|thumb|none|150px]] || [[image:chart_Statline_data.jpg|thumb|none|250px]] || <pre> |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 282: | Line 346: | ||
pairs[i][1] = 0; //column 0 stores series name | pairs[i][1] = 0; //column 0 stores series name | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("LineStat", "LineChart", "Type", "value", dataTable, no_category, pairs,""); | + | chart = chartMaker.getCategoryChart("LineStat", "LineChart", "Type", "value", |
+ | dataTable, no_category, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
</pre> | </pre> | ||
− | | StatisticalLine Chart using raw data|| [[image:chart_Statline_raw.jpg|thumb|none|150px]] || [[image:chart_Statline_raw_data.jpg]] || <pre> | + | |- |
+ | | StatisticalLine Chart using raw data|| [[image:chart_Statline_raw.jpg|thumb|none|150px]] || [[image:chart_Statline_raw_data.jpg|thumb|none|250px]] || <pre> | ||
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
Line 295: | Line 361: | ||
pairs[i][1] = 0; //column 0 stores series name | pairs[i][1] = 0; //column 0 stores series name | ||
} | } | ||
− | chart = chartMaker.getCategoryChart("LineStatRaw", "LineChart", "Type", "value", dataTable, no_category, pairs,""); | + | chart = chartMaker.getCategoryChart("LineStatRaw", "LineChart", "Type", "value", |
+ | dataTable, no_category, pairs, ""); | ||
chartPanel = new ChartPanel(chart, false); | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Step Chart using XYDataset || [[image:chart_Step.jpg|thumb|none|150px]] || [[image:chart_Step_data.jpg|thumb|none|250px]] || <pre> | ||
+ | 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); | ||
</pre> | </pre> | ||
|} | |} | ||
+ | |||
+ | <Strong>Note</strong> | ||
Line chart can be created using either getCategoryChart or getXYChart method depend on the data. | Line chart can be created using either getCategoryChart or getXYChart method depend on the data. | ||
− | + | See [[list of charts#The_getChart_methods|the get*Chart methods section]] for detail. | |
+ | |||
+ | = '''Area Chart'''= | ||
+ | |||
+ | |||
+ | {| border="1" | ||
+ | |+ Area Charts | ||
+ | ! !! Chart !! Chart data in JTable !! Sample code | ||
+ | |- | ||
+ | | Area Chart using CategoryDataset|| [[image:chart_Catarea.jpg|thumb|none|150px]] || [[image:chart_Catarea_data.jpg|thumb|none|250px]] || <pre> | ||
+ | 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("Area", "Area Chart", "Category", "value", | ||
+ | dataTable, no_category, pairs, ""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | |||
+ | </pre> | ||
+ | |- | ||
+ | | Area Chart using XYDataset|| [[image:chart_XyArea.jpg|thumb|none|150px]] || [[image:chart_XyArea_data.jpg|thumb|none|250px]] || <pre> | ||
+ | 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("Area", "Area Chart", "X", "Y", | ||
+ | dataTable, no_series, pairs,""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Area Chart with Time Axis || [[image:chart_Area_time.jpg|thumb|none|150px]] || [[image:chart_Area_time_data.jpg|thumb|none|250px]] || <pre> | ||
+ | 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 | ||
+ | } | ||
+ | |||
+ | String time_type = "Day"; | ||
+ | chart = chartMaker.getXYChart("AreaTime","Area Chart", "X", "Y", | ||
+ | dataTable, no_series, pairs, time_type); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Stacked Area Chart || [[image:chart_StackedArea.jpg|thumb|none|150px]] || [[image:chart_StackedArea_data.jpg|thumb|none|250px]] || <pre> | ||
+ | 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.getTableXYAreaChart("Area Chart", "X Vaue", "Y Value", | ||
+ | dataTable, no_series, pairs, ""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |||
+ | |} | ||
+ | |||
+ | <Strong>Note</strong> | ||
+ | |||
+ | Area chart can be created using either getCategoryChart or getXYChart method depend on the data. | ||
+ | |||
+ | Stacked area chart can be created using getTableXYChart method. | ||
+ | |||
+ | See [[list of charts#The_getChart_methods|the get*Chart methods section]] for detail. | ||
+ | |||
+ | = '''Miscellaneous Charts''' = | ||
+ | |||
+ | {| border="1" | ||
+ | |+ Miscellaneous Charts | ||
+ | ! !! Chart !! Chart data in JTable !! Sample code | ||
+ | |- | ||
+ | | Crosshair Chart|| [[image:chart_Crosshair.jpg|thumb|none|150px]] || [[image:chart_Crosshair_data.jpg|thumb|none|250px]] || <pre> | ||
+ | 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); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Crosshair Chart time|| [[image:chart_Crosshair_time.jpg|thumb|none|150px]] || [[image:chart_Crosshair_time_data.jpg|thumb|none|250px]] || <pre> | ||
+ | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
+ | |||
+ | int no_series = dataTable.getColumnCount(); | ||
+ | int[][] pairs = new int[no_series][1]; | ||
+ | for (int i=0; i<no_series; i++){ | ||
+ | pairs[i][0] = i; //column x | ||
+ | } | ||
+ | |||
+ | chart = chartMaker.getCompassChart("CompassChart", | ||
+ | dataTable, no_series, pairs, ""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | BoxAndWhisker Chart|| [[image:chart_Boxwhisker.jpg|thumb|none|150px]] || [[image:chart_Boxwhisker_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | 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.getBoxAndWhiskerCategoryChart(chartTitle, "Category", "value", | ||
+ | dataTable, no_category, pairs,""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Bubble Chart|| [[image:chart_Bubble.jpg|thumb|none|150px]] || [[image:chart_Bubble_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
+ | |||
+ | int no_series = (dataTable.getColumnCount())/3; | ||
+ | int[][] pairs = new int[no_series][3]; | ||
+ | for (int i=0; i<no_series; i++){ | ||
+ | pairs[i][0] = 3*i; //column x | ||
+ | pairs[i][1] = 3*i+1; //column y | ||
+ | pairs[i][2] = 3*i+2; //column y | ||
+ | } | ||
+ | |||
+ | chart = chartMaker.getXYZBubbleChart("Bubble Chart", "X", "Y", | ||
+ | dataTable, no_series, pairs,""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Category Step Chart|| [[image:chart_Catstep.jpg|thumb|none|150px]] || [[image:chart_Catstep_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | 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("Step", "Category Step Chart", "Category", "value", | ||
+ | dataTable, no_category, pairs, ""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | |||
+ | </pre> | ||
+ | |- | ||
+ | | Compass Chart|| [[image:chart_Compass.jpg|thumb|none|150px]] || [[image:chart_Compass_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); | ||
+ | |||
+ | int no_series = dataTable.getColumnCount(); | ||
+ | int[][] pairs = new int[no_series][1]; | ||
+ | for (int i=0; i<no_series; i++){ | ||
+ | pairs[i][0] = i; //column x | ||
+ | } | ||
+ | |||
+ | chart = chartMaker.getCompassChart("CompassChart", dataTable, no_series, pairs, ""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Difference Chart|| [[image:chart_Difftime.jpg|thumb|none|150px]] || [[image:chart_Difftime_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | 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 | ||
+ | } | ||
+ | |||
+ | String time_type = "Day"; | ||
+ | chart = chartMaker.getXYChart("DifferenceTime","Line Chart", "Time", "Value", | ||
+ | dataTable, no_series, pairs, time_type); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Event Frequence Chart|| [[image:chart_Eventfreq.jpg|thumb|none|150px]] || [[image:chart_Eventfreq_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | 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 | ||
+ | } | ||
+ | |||
+ | String time_type = "Day"; | ||
+ | chart = chartMaker.getCategoryChart("EventFreqTime", "Event Frequency Chart", | ||
+ | "Category", "Date", | ||
+ | dataTable, no_category, pairs, "Day Horizontal"); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | |||
+ | </pre> | ||
+ | |- | ||
+ | | Polar Chart|| [[image:chart_Polar.jpg|thumb|none|150px]] || [[image:chart_Polar_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | 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("Polar", "Polar Chart", "X", "Y", | ||
+ | dataTable, no_series, pairs,""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Spiderweb Chart|| [[image:chart_Spiderweb.jpg|thumb|none|150px]] || [[image:chart_Spiderweb_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | 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("SpiderWeb", "SpiderWeb Chart", "Category", "value", | ||
+ | dataTable, no_category, pairs, ""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |- | ||
+ | | Symbolic Chart|| [[image:chart_Symbolic.jpg|thumb|none|150px]] || [[image:chart_Symbolic_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | |||
+ | 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("SymbolicAxis","SymbolicAxis Chart", "X", "Y", | ||
+ | dataTable, no_series, pairs,""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | |||
+ | </pre> | ||
+ | |- | ||
+ | | YInterval Chart|| [[image:chart_Yinterval.jpg|thumb|none|150px]] || [[image:chart_Yinterval_data.jpg|thumb|none|250px]] || | ||
+ | <pre> | ||
+ | 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.getYIntervalChart("YInterVal Chart", "X", "Y", | ||
+ | dataTable, no_series, pairs,""); | ||
+ | chartPanel = new ChartPanel(chart, false); | ||
+ | </pre> | ||
+ | |} | ||
+ | <Strong>Note</strong> | ||
+ | |||
+ | See [[list of charts#The_getChart_methods|the getChart methods section]] for detail. | ||
+ | |||
+ | -------- | ||
+ | -------- | ||
+ | |||
+ | =The get*Chart methods= | ||
+ | |||
+ | * | ||
+ | JFreeChart getPieChart(String title, JTable dataTable, int[][] pairs, String other) | ||
+ | |||
+ | :Options for the getPieChart methods parameter ''other'' are: <strong> 2D/3D/ring, clockwise/counter_clockwise</strong>. ''2D'' is the default. | ||
+ | |||
+ | ---------- | ||
+ | * | ||
+ | JFreeChart getXYChart(String chartType, String title, String xLabel, String yLabel, | ||
+ | JTable dataTable, int numberOfSeries, int[][] pairs, String other) | ||
+ | |||
+ | :Options for the getXYChart method's parameter ''chartType'' are: <strong>line/bar/linetime/lineqq/lineqqdd/area/areatime/step/nd/differencetime/symbolicaxis/polar/dot/index/histogram</strong>. ''line'' is the default. | ||
+ | |||
+ | :Options for the getXYChart method's parameter ''other'' are: <strong>horizontal/vertical, noline/nofill/noshape, year/month/day/minute</strong>. ''Vertical'' is the default. | ||
+ | |||
+ | ---------- | ||
+ | * | ||
+ | JFreeChart getCategoryChart(String chartType, String title, String xLabel, String yLabel, | ||
+ | JTable dataTable, int numberOfCategory, int[][] pairs, String other) | ||
+ | |||
+ | :Options for the getCategoryChart method's parameter ''chartType'' are: <strong>bar/barstat/barstatraw/line/linestat/linestatraw/step/area/areatime/eventfreq/spiderweb</strong>. ''bar'' is the default. | ||
+ | |||
+ | :Options for the getCategoryChart method's parameter ''other'' are: <strong>horizontal/vertical, 3D, stacked/layered/waterfall, year/month/day/minute</strong>. ''Vertical'' is the default. | ||
+ | |||
+ | ---------- | ||
+ | * | ||
+ | JFreeChart getTableXYAreaChart(String title, String xLabel, String yLabel, | ||
+ | JTable dataTable, int numberOfSeries, int[][] pairs, String other) | ||
+ | |||
+ | :The parameter ''other'' in getTableXYAreaChart method is not currently used. | ||
+ | |||
+ | ---------- | ||
+ | * | ||
+ | JFreeChart getBoxAndWhiskerCategoryChart(String title, String xLabel, String yLabel, | ||
+ | JTable dataTable, int numberOfCategory, int[][] pairs, String other) | ||
+ | |||
+ | :The parameter ''other'' in getBoxAndWhiskerChart method is not currently used. | ||
+ | |||
+ | ---------- | ||
+ | * | ||
+ | JFreeChart getCompassChart(String title, JTable dataTable, int numberOfSeries, int[][] pairs, String other) | ||
+ | |||
+ | :The parameter ''other'' in getCompassChart method is not currently used. | ||
+ | |||
+ | ---------- | ||
+ | * | ||
+ | JFreeChart getXYZBubbleChart(String title, String xLabel, String yLabel, | ||
+ | JTable dataTable, int numberOfSeries, int[][] pairs, String other) | ||
+ | |||
+ | :The parameter ''other'' in getXYZBubbleChart method is not currently used. | ||
+ | |||
+ | ---------- | ||
+ | * | ||
+ | JFreeChart getYIntervalChart(String title, String xLabel, String yLabel, | ||
+ | JTable dataTable, int numberOfSeries, int[][] pairs, String other) | ||
− | + | :The parameter ''other'' in getYIntervalChart method is not currently used. |
Latest revision as of 12:44, 6 October 2006
Contents
Pie Chart
Chart | Chart data in JTable | Sample code | |
---|---|---|---|
PieChart2D | Error creating thumbnail: File missing |
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 |
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 |
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); |
Note
Pie chart can be created using the getPieChart method.
See the get*Chart methods section for detail.
Bar Chart
Chart | Chart data in JTable | Sample code | |
---|---|---|---|
Bar2D | Error creating thumbnail: File missing |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 with Time Axis | Error creating thumbnail: File missing |
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); |
Histogram Chart | Error creating thumbnail: File missing |
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("Histogram","Category Chart", "Value", "Frequency", dataTable, no_series, pairs, String.valueOf(bin_size)); chartPanel = new ChartPanel(chart, false);
|
Note
Bar chart can be created using either getCategoryChart or getXYChart method depend on the data.
See the get*Chart methods section for detail.
Line Chart
Chart | Chart data in JTable | Sample code | |
---|---|---|---|
Line chart using CategoryDataset | Error creating thumbnail: File missing |
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 |
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 |
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); |
DotChart | Error creating thumbnail: File missing |
Error creating thumbnail: File missing |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); int no_series = dataTable.getColumnCount(); int[][] pairs = new int[no_series][2]; for (int i=0; i<no_series; i++){ pairs[i][0] = 0; //no column x pairs[i][1] = 0; //column y } chart = chartMaker.getXYChart("Dot","Dot Chart", "Y", "X", dataTable, no_series, pairs,"noline horizontal"); chartPanel = new ChartPanel(chart, false); |
IndexChart | Error creating thumbnail: File missing |
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("Index","Index Chart", "Row", "Data", dataTable, no_series, pairs,"noshape"); chartPanel = new ChartPanel(chart, false); |
QQData2Data Chart | Error creating thumbnail: File missing |
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 |
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 |
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 |
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 |
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 using XYDataset | Error creating thumbnail: File missing |
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); |
Note
Line chart can be created using either getCategoryChart or getXYChart method depend on the data.
See the get*Chart methods section for detail.
Area Chart
Chart | Chart data in JTable | Sample code | |
---|---|---|---|
Area Chart using CategoryDataset | Error creating thumbnail: File missing |
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("Area", "Area Chart", "Category", "value", dataTable, no_category, pairs, ""); chartPanel = new ChartPanel(chart, false); |
Area Chart using XYDataset | Error creating thumbnail: File missing |
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("Area", "Area Chart", "X", "Y", dataTable, no_series, pairs,""); chartPanel = new ChartPanel(chart, false); |
Area Chart with Time Axis | Error creating thumbnail: File missing |
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 } String time_type = "Day"; chart = chartMaker.getXYChart("AreaTime","Area Chart", "X", "Y", dataTable, no_series, pairs, time_type); chartPanel = new ChartPanel(chart, false); |
Stacked Area Chart | Error creating thumbnail: File missing |
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.getTableXYAreaChart("Area Chart", "X Vaue", "Y Value", dataTable, no_series, pairs, ""); chartPanel = new ChartPanel(chart, false); |
Note
Area chart can be created using either getCategoryChart or getXYChart method depend on the data.
Stacked area chart can be created using getTableXYChart method.
See the get*Chart methods section for detail.
Miscellaneous Charts
Chart | Chart data in JTable | Sample code | |
---|---|---|---|
Crosshair Chart | Error creating thumbnail: File missing |
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); |
Crosshair Chart time | Error creating thumbnail: File missing |
Error creating thumbnail: File missing |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); int no_series = dataTable.getColumnCount(); int[][] pairs = new int[no_series][1]; for (int i=0; i<no_series; i++){ pairs[i][0] = i; //column x } chart = chartMaker.getCompassChart("CompassChart", dataTable, no_series, pairs, ""); chartPanel = new ChartPanel(chart, false); |
BoxAndWhisker Chart | Error creating thumbnail: File missing |
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.getBoxAndWhiskerCategoryChart(chartTitle, "Category", "value", dataTable, no_category, pairs,""); chartPanel = new ChartPanel(chart, false); |
Bubble Chart | Error creating thumbnail: File missing |
Error creating thumbnail: File missing |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); int no_series = (dataTable.getColumnCount())/3; int[][] pairs = new int[no_series][3]; for (int i=0; i<no_series; i++){ pairs[i][0] = 3*i; //column x pairs[i][1] = 3*i+1; //column y pairs[i][2] = 3*i+2; //column y } chart = chartMaker.getXYZBubbleChart("Bubble Chart", "X", "Y", dataTable, no_series, pairs,""); chartPanel = new ChartPanel(chart, false); |
Category Step Chart | Error creating thumbnail: File missing |
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("Step", "Category Step Chart", "Category", "value", dataTable, no_category, pairs, ""); chartPanel = new ChartPanel(chart, false); |
Compass Chart | Error creating thumbnail: File missing |
Error creating thumbnail: File missing |
ChartGenerator_JTable chartMaker = new ChartGenerator_JTable(); int no_series = dataTable.getColumnCount(); int[][] pairs = new int[no_series][1]; for (int i=0; i<no_series; i++){ pairs[i][0] = i; //column x } chart = chartMaker.getCompassChart("CompassChart", dataTable, no_series, pairs, ""); chartPanel = new ChartPanel(chart, false); |
Difference Chart | Error creating thumbnail: File missing |
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 } String time_type = "Day"; chart = chartMaker.getXYChart("DifferenceTime","Line Chart", "Time", "Value", dataTable, no_series, pairs, time_type); chartPanel = new ChartPanel(chart, false); |
Event Frequence Chart | Error creating thumbnail: File missing |
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 } String time_type = "Day"; chart = chartMaker.getCategoryChart("EventFreqTime", "Event Frequency Chart", "Category", "Date", dataTable, no_category, pairs, "Day Horizontal"); chartPanel = new ChartPanel(chart, false); |
Polar Chart | Error creating thumbnail: File missing |
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("Polar", "Polar Chart", "X", "Y", dataTable, no_series, pairs,""); chartPanel = new ChartPanel(chart, false); |
Spiderweb Chart | Error creating thumbnail: File missing |
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("SpiderWeb", "SpiderWeb Chart", "Category", "value", dataTable, no_category, pairs, ""); chartPanel = new ChartPanel(chart, false); |
Symbolic Chart | Error creating thumbnail: File missing |
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("SymbolicAxis","SymbolicAxis Chart", "X", "Y", dataTable, no_series, pairs,""); chartPanel = new ChartPanel(chart, false); |
YInterval Chart | Error creating thumbnail: File missing |
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.getYIntervalChart("YInterVal Chart", "X", "Y", dataTable, no_series, pairs,""); chartPanel = new ChartPanel(chart, false); |
Note
See the getChart methods section for detail.
The get*Chart methods
JFreeChart getPieChart(String title, JTable dataTable, int[][] pairs, String other)
- Options for the getPieChart methods parameter other are: 2D/3D/ring, clockwise/counter_clockwise. 2D is the default.
JFreeChart getXYChart(String chartType, String title, String xLabel, String yLabel, JTable dataTable, int numberOfSeries, int[][] pairs, String other)
- Options for the getXYChart method's parameter chartType are: line/bar/linetime/lineqq/lineqqdd/area/areatime/step/nd/differencetime/symbolicaxis/polar/dot/index/histogram. line is the default.
- Options for the getXYChart method's parameter other are: horizontal/vertical, noline/nofill/noshape, year/month/day/minute. Vertical is the default.
JFreeChart getCategoryChart(String chartType, String title, String xLabel, String yLabel, JTable dataTable, int numberOfCategory, int[][] pairs, String other)
- Options for the getCategoryChart method's parameter chartType 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.
JFreeChart getTableXYAreaChart(String title, String xLabel, String yLabel, JTable dataTable, int numberOfSeries, int[][] pairs, String other)
- The parameter other in getTableXYAreaChart method is not currently used.
JFreeChart getBoxAndWhiskerCategoryChart(String title, String xLabel, String yLabel, JTable dataTable, int numberOfCategory, int[][] pairs, String other)
- The parameter other in getBoxAndWhiskerChart method is not currently used.
JFreeChart getCompassChart(String title, JTable dataTable, int numberOfSeries, int[][] pairs, String other)
- The parameter other in getCompassChart method is not currently used.
JFreeChart getXYZBubbleChart(String title, String xLabel, String yLabel, JTable dataTable, int numberOfSeries, int[][] pairs, String other)
- The parameter other in getXYZBubbleChart method is not currently used.
JFreeChart getYIntervalChart(String title, String xLabel, String yLabel, JTable dataTable, int numberOfSeries, int[][] pairs, String other)
- The parameter other in getYIntervalChart method is not currently used.