use of org.jfree.chart.JFreeChart in project cubrid-manager by CUBRID.
the class VolumeInformationEditor method createChart.
/**
*
* Create jfreechart
*
* @param dataset DefaultPieDataset
* @return JFreeChart
*/
private static JFreeChart createChart(DefaultPieDataset dataset) {
JFreeChart chart = // chart
ChartFactory.createPieChart3D(// chart
"", // data
dataset, // include legend
true, true, false);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
plot.setSectionOutlinesVisible(false);
plot.setLabelFont(new java.awt.Font("SansSerif", java.awt.Font.PLAIN, 12));
plot.setDirection(Rotation.ANTICLOCKWISE);
plot.setCircular(false);
plot.setLabelLinkMargin(0.0);
plot.setLabelGap(0.0);
plot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
plot.setOutlinePaint(ChartColor.VERY_DARK_BLUE);
plot.setLabelGenerator(null);
plot.setLabelLinksVisible(false);
plot.setLegendLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0}:{1} Mbyte", new DecimalFormat("0.00"), new DecimalFormat("0.00")));
plot.setToolTipGenerator(new StandardPieToolTipGenerator("{0}={1}Mbyte {2}", new DecimalFormat("0.00"), new DecimalFormat("0.00%")));
// plot.setSectionPaint("", SWTResourceManager.getColor(230, 230, 230));
Color[] colors = { new Color(235, 139, 82), new Color(119, 119, 253) };
PieRenderer renderer = new PieRenderer(colors);
renderer.setColor(plot, dataset);
return chart;
}
use of org.jfree.chart.JFreeChart in project cubrid-manager by CUBRID.
the class VolumeFolderInfoEditor method createChart.
/**
*
* Creates a chart.
*
* @param dataset DefaultPieDataset
* @param dbSpaceInfo DbSpaceInfo
* @return jFreeChart
*/
private static JFreeChart createChart(DefaultPieDataset dataset, DbSpaceInfo dbSpaceInfo) {
JFreeChart chart = ChartFactory.createPieChart3D(// chart
dbSpaceInfo.getSpacename() + " Chart", // data
dataset, // include legend
true, true, false);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
plot.setSectionOutlinesVisible(false);
plot.setLabelFont(new java.awt.Font("SansSerif", java.awt.Font.PLAIN, 12));
plot.setDirection(Rotation.ANTICLOCKWISE);
plot.setCircular(false);
plot.setLabelLinkMargin(0.0);
plot.setLabelGap(0.0);
plot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
plot.setOutlinePaint(ChartColor.VERY_DARK_BLUE);
plot.setToolTipGenerator(new StandardPieToolTipGenerator("{0}={1} pages {2}", new DecimalFormat("00.0"), new DecimalFormat("0.00%")));
// plot.setSectionPaint("", SWTResourceManager.getColor(230, 230, 230));
Color[] colors = { new Color(235, 139, 82), new Color(119, 119, 253) };
PieRenderer renderer = new PieRenderer(colors);
renderer.setColor(plot, dataset);
return chart;
}
use of org.jfree.chart.JFreeChart in project cubrid-manager by CUBRID.
the class DbDashboardHistoryViewPart method loadDatabaseChart.
/**
* Load an instance of ChartCompositePart stand for database monitor info
*
* @param parent an instance of Composite
*/
private void loadDatabaseChart(Composite parent) {
dbStatComp = new Composite(parent, SWT.NULL);
dbStatComp.setLayout(new GridLayout());
dbStatComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group dbGrp = new Group(dbStatComp, SWT.NONE);
dbGrp.setText(Messages.dbDatabaseStatusSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
dbGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
dbGrp.setLayoutData(gridData);
DbStatDumpData dbStatDumpData = new DbStatDumpData();
TreeMap<String, String> map = convertMapKey(dbStatDumpData.getDiagStatusResultMap());
dbStatChartPart = new ChartCompositePart(dbGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = dbStatChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.DATABASE);
}
dbStatChartPart.loadContent();
JFreeChart chart = (JFreeChart) dbStatChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) dbStatChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(true);
xyplot.getRangeAxis().setVisible(true);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of org.jfree.chart.JFreeChart in project cubrid-manager by CUBRID.
the class DatabaseDashboardViewPart method loadDatabaseChart.
/**
* Load an instance of ChartCompositePart stand for database monitor info
*
* @param parent an instance of Composite
*/
private void loadDatabaseChart(Composite parent) {
dbStatComp = new Composite(parent, SWT.NULL);
dbStatComp.setLayout(new GridLayout());
dbStatComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group dbGrp = new Group(dbStatComp, SWT.NONE);
dbGrp.setText(Messages.dbDatabaseStatusSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
dbGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
dbGrp.setLayoutData(gridData);
DbStatDumpData dbStatDumpData = new DbStatDumpData();
TreeMap<String, String> map = convertMapKey(dbStatDumpData.getDiagStatusResultMap());
dbStatChartPart = new ChartCompositePart(dbGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = dbStatChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.DATABASE);
}
dbStatChartPart.loadContent();
JFreeChart chart = (JFreeChart) dbStatChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) dbStatChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(false);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of org.jfree.chart.JFreeChart in project cubrid-manager by CUBRID.
the class DatabaseDashboardViewPart method fireChartSetting.
/**
* This method is responsible for preparing data for ChartSettingDlg and
* dealing with the results of chartSettingDlg
*
*/
private void fireChartSetting() {
ChartSettingDlg chartSettingDlg = new ChartSettingDlg(composite.getShell());
chartSettingDlg.setHasTitlSetting(false);
chartSettingDlg.setHasHistoryPath(true);
chartSettingDlg.setHasAxisSetting(false);
chartSettingDlg.setHasChartSelection(true);
// plot appearance
XYPlot dbStatplot = dbStatChartPart.getChart().getXYPlot();
String plotBgColor = trimPaintColor(dbStatplot.getBackgroundPaint().toString());
String plotDomainGridColor = trimPaintColor(dbStatplot.getDomainGridlinePaint().toString());
String plotRangGridColor = trimPaintColor(dbStatplot.getRangeGridlinePaint().toString());
chartSettingDlg.setPlotBgColor(plotBgColor);
chartSettingDlg.setPlotDomainGridColor(plotDomainGridColor);
chartSettingDlg.setPlotRangGridColor(plotRangGridColor);
// series
chartSettingDlg.setSettingMap(dbStatChartPart.getSettingMap());
// history path
chartSettingDlg.setHistoryPath(historyPath);
chartSettingDlg.setHistoryFileName(historyFileName);
// chart selection
chartSettingDlg.setChartSelectionLst(getSelectedCharts());
if (chartSettingDlg.open() == Dialog.OK) {
// plot appearance
plotBgColor = chartSettingDlg.getPlotBgColor();
plotDomainGridColor = chartSettingDlg.getPlotDomainGridColor();
plotRangGridColor = chartSettingDlg.getPlotRangGridColor();
JFreeChart cpuBarChart = cpuChart.getBarChart();
Plot cpuBarPlot = cpuBarChart.getPlot();
XYPlot cpuSeriesPlot = (XYPlot) cpuChart.getSeriesChart().getPlot();
JFreeChart memoryBarChart = memoryChart.getBarChart();
Plot memoryBarPlot = memoryBarChart.getPlot();
XYPlot memorySeriesPlot = (XYPlot) memoryChart.getSeriesChart().getPlot();
JFreeChart delayBarChart = delayChart.getBarChart();
Plot delayBarPlot = delayBarChart.getPlot();
XYPlot delaySeriesPlot = (XYPlot) delayChart.getSeriesChart().getPlot();
JFreeChart countBarChart = countChart.getBarChart();
Plot countBarPlot = countBarChart.getPlot();
XYPlot countSeriesPlot = (XYPlot) countChart.getSeriesChart().getPlot();
// history path
String newHistoryPath = chartSettingDlg.getHistoryPath();
isChangedHistoryPath = historyPath.equals(newHistoryPath) ? false : true;
if (isChangedHistoryPath) {
historyPath = newHistoryPath;
historyFileHelp.setHistoryPath(historyPath);
historyFileHelp.setChangedHistoryPath(true);
}
int red = 0;
int green = 0;
int blue = 0;
//background
red = getColorElem(plotBgColor, 0);
green = getColorElem(plotBgColor, 1);
blue = getColorElem(plotBgColor, 2);
Color bgColor = new Color(red, green, blue);
dbStatplot.setBackgroundPaint(bgColor);
//cpu chart
cpuBarChart.setBackgroundPaint(bgColor);
cpuBarPlot.setBackgroundPaint(bgColor);
cpuSeriesPlot.setBackgroundPaint(bgColor);
//memoryChart
memoryBarPlot.setBackgroundPaint(bgColor);
memoryBarChart.setBackgroundPaint(bgColor);
memorySeriesPlot.setBackgroundPaint(bgColor);
//delayChart
delayBarPlot.setBackgroundPaint(bgColor);
delayBarChart.setBackgroundPaint(bgColor);
delaySeriesPlot.setBackgroundPaint(bgColor);
//countChart;
countBarPlot.setBackgroundPaint(bgColor);
countBarChart.setBackgroundPaint(bgColor);
countSeriesPlot.setBackgroundPaint(bgColor);
//DomainGridColor
//db Chart
red = getColorElem(plotDomainGridColor, 0);
green = getColorElem(plotDomainGridColor, 1);
blue = getColorElem(plotDomainGridColor, 2);
Color domainGridlineColor = new Color(red, green, blue);
dbStatplot.setDomainGridlinePaint(domainGridlineColor);
//cpu chart
cpuSeriesPlot.setDomainGridlinePaint(domainGridlineColor);
//memoryChart
memorySeriesPlot.setDomainGridlinePaint(domainGridlineColor);
//delayChart
delaySeriesPlot.setDomainGridlinePaint(domainGridlineColor);
//countChart;
countSeriesPlot.setDomainGridlinePaint(domainGridlineColor);
//RangeGridColor
red = getColorElem(plotRangGridColor, 0);
green = getColorElem(plotRangGridColor, 1);
blue = getColorElem(plotRangGridColor, 2);
Color rangeGridColor = new Color(red, green, blue);
dbStatplot.setRangeGridlinePaint(rangeGridColor);
//cpu chart
cpuSeriesPlot.setRangeGridlinePaint(rangeGridColor);
//memoryChart
memorySeriesPlot.setRangeGridlinePaint(rangeGridColor);
//delayChart
delaySeriesPlot.setRangeGridlinePaint(rangeGridColor);
//countChart;
countSeriesPlot.setRangeGridlinePaint(rangeGridColor);
dbStatChartPart.setSettingMap(chartSettingDlg.getSettingMap());
dbStatChartPart.updateSettingSeries();
//chart Selection
fireChartSelection(chartSettingDlg.getChartSelectionLst());
}
}
Aggregations