Search in sources :

Example 1 with XYLineAndShapeRenderer

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);
}
Also used : XYPlot(org.jfree.chart.plot.XYPlot) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)

Example 2 with XYLineAndShapeRenderer

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) DateAxis(org.jfree.chart.axis.DateAxis) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) JFreeChart(org.jfree.chart.JFreeChart) GridLayout(org.eclipse.swt.layout.GridLayout) XYPlot(org.jfree.chart.plot.XYPlot) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) ChartCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 3 with XYLineAndShapeRenderer

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) DateAxis(org.jfree.chart.axis.DateAxis) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) JFreeChart(org.jfree.chart.JFreeChart) GridLayout(org.eclipse.swt.layout.GridLayout) XYPlot(org.jfree.chart.plot.XYPlot) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) ChartCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

Example 4 with XYLineAndShapeRenderer

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) DateAxis(org.jfree.chart.axis.DateAxis) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData) JFreeChart(org.jfree.chart.JFreeChart) GridLayout(org.eclipse.swt.layout.GridLayout) XYPlot(org.jfree.chart.plot.XYPlot) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) ChartCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 5 with XYLineAndShapeRenderer

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++;
        }
    }
}
Also used : BasicStroke(java.awt.BasicStroke) TimeSeries(org.jfree.data.time.TimeSeries) XYPlot(org.jfree.chart.plot.XYPlot) TimeSeriesCollection(org.jfree.data.time.TimeSeriesCollection) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) RGB(org.eclipse.swt.graphics.RGB) Map(java.util.Map) TreeMap(java.util.TreeMap)

Aggregations

XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)15 XYPlot (org.jfree.chart.plot.XYPlot)14 JFreeChart (org.jfree.chart.JFreeChart)10 DateAxis (org.jfree.chart.axis.DateAxis)9 Map (java.util.Map)7 BasicStroke (java.awt.BasicStroke)6 Color (java.awt.Color)6 TreeMap (java.util.TreeMap)6 ChartCompositePart (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart)4 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)4 ShowSetting (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting)4 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)4 GridData (org.eclipse.swt.layout.GridData)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 Composite (org.eclipse.swt.widgets.Composite)4 Group (org.eclipse.swt.widgets.Group)4 TimeSeries (org.jfree.data.time.TimeSeries)4 TimeSeriesCollection (org.jfree.data.time.TimeSeriesCollection)4 Font (java.awt.Font)3 NumberAxis (org.jfree.chart.axis.NumberAxis)3