use of org.jfree.chart.plot.XYPlot 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.plot.XYPlot 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());
}
}
use of org.jfree.chart.plot.XYPlot in project cubrid-manager by CUBRID.
the class HostDashboardHistoryViewPart method loadBrokerChart.
/**
* Load an instance of ChartCompositePart stand for broker monitor info
*
* @param parent the instance of Composite
*/
private void loadBrokerChart(Composite parent) {
brokerComp = new Composite(parent, SWT.NULL);
brokerComp.setLayout(new GridLayout());
brokerComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group brokerGrp = new Group(brokerComp, SWT.NONE);
brokerGrp.setText(Messages.hostBrokerSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
brokerGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
brokerGrp.setLayoutData(gridData);
BrokerDiagData brokerDiagData = new BrokerDiagData();
TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
brokerChartPart = new ChartCompositePart(brokerGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = brokerChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.BROKER);
}
brokerChartPart.loadContent();
JFreeChart chart = (JFreeChart) brokerChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) brokerChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of org.jfree.chart.plot.XYPlot in project qpid-broker-j by apache.
the class ChartProductionTest method assertChartTitlesAndWriteToFile.
private void assertChartTitlesAndWriteToFile(ChartBuilder builder) {
JFreeChart chart = builder.buildChart(_chartingDefinition);
assertEquals(TEST_CHARTTITLE, chart.getTitle().getText());
assertEquals(TEST_CHARTSUBTITLE, ((ShortTextTitle) chart.getSubtitle(1)).getText());
assertEquals(TEST_SERIESLEGEND, chart.getPlot().getLegendItems().get(0).getLabel());
if (chart.getPlot() instanceof XYPlot) {
assertEquals(1, chart.getXYPlot().getDatasetCount());
} else {
assertEquals(1, chart.getCategoryPlot().getDatasetCount());
}
_writer.writeChartToFileSystem(chart, _chartingDefinition);
}
use of org.jfree.chart.plot.XYPlot in project jgnash by ccavanaugh.
the class MonthlyAccountBalanceChart method createVerticalXYBarChart.
private JFreeChart createVerticalXYBarChart(Account a) {
DateFormat df = new SimpleDateFormat("MM/yy");
TimeSeriesCollection data = createTimeSeriesCollection(a);
DateAxis dateAxis = new DateAxis(rb.getString("Column.Date"));
dateAxis.setTickUnit(new DateTickUnit(DateTickUnitType.MONTH, 1, df));
dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
// if (a.getTransactionCount() > 0) {
Date start = DateUtils.asDate(DateUtils.getFirstDayOfTheMonth(startDateField.getLocalDate()));
Date end = DateUtils.asDate(DateUtils.getLastDayOfTheMonth(endDateField.getLocalDate()));
dateAxis.setRange(start, end);
// }
NumberAxis valueAxis = new NumberAxis(rb.getString("Column.Balance"));
StandardXYToolTipGenerator tooltipGenerator = new StandardXYToolTipGenerator("{1}, {2}", df, NumberFormat.getNumberInstance());
XYBarRenderer renderer = new XYBarRenderer(0.2);
renderer.setBaseToolTipGenerator(tooltipGenerator);
XYPlot plot = new XYPlot(data, dateAxis, valueAxis, renderer);
String title = rb.getString("Title.AccountBalance") + " - " + a.getPathName();
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, false);
chart.setBackgroundPaint(null);
return chart;
}
Aggregations