use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer in project gephi by gephi.
the class ChartsUtils method setScatterPlotLinesEnabled.
/**
* Modify a scatter plot to show lines instead or shapes or not.
* @param scatterPlot Scatter plot to modify
* @param enabled Indicates if lines have to be shown
*/
public static void setScatterPlotLinesEnabled(final JFreeChart scatterPlot, final boolean enabled) {
XYPlot plot = (XYPlot) scatterPlot.getPlot();
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
if (enabled) {
renderer.setSeriesLinesVisible(0, true);
renderer.setSeriesShapesVisible(0, false);
} else {
renderer.setSeriesLinesVisible(0, false);
renderer.setSeriesShapesVisible(0, true);
renderer.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(0, 0, 1, 1));
}
renderer.setSeriesPaint(0, Color.RED);
plot.setRenderer(0, renderer);
}
use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer 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.renderer.xy.XYLineAndShapeRenderer 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.renderer.xy.XYLineAndShapeRenderer 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.renderer.xy.XYLineAndShapeRenderer in project cubrid-manager by CUBRID.
the class ChartCompositePart method updateChart.
/**
* Update the plot in chart from scratch.
*
*/
public void updateChart() {
XYPlot plot = (XYPlot) (getChart().getPlot());
TimeSeriesCollection timeseriescollection = (TimeSeriesCollection) (plot.getDataset());
timeseriescollection.removeAllSeries();
XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) plot.getRenderer();
seriesMap.clear();
int number = 0;
for (Map.Entry<String, String> entry : valueMap.entrySet()) {
String key = entry.getKey();
TimeSeries series = new TimeSeries(key);
seriesMap.put(key, series);
if (settingMap.get(key).isChecked()) {
timeseriescollection.addSeries(series);
RGB seriesRgb = settingMap.get(key).getSeriesRgb();
float width = settingMap.get(key).getWidth();
Color color = new Color(seriesRgb.red, seriesRgb.green, seriesRgb.blue);
xylineandshaperenderer.setSeriesPaint(number, color);
xylineandshaperenderer.setSeriesStroke(number, new BasicStroke(width, 0, 2));
number++;
}
}
}
Aggregations