Search in sources :

Example 46 with XYPlot

use of org.jfree.chart.plot.XYPlot in project cubrid-manager by CUBRID.

the class MonitorStatisticChart method refreshChart.

public void refreshChart(List<StatisticData> statisticDataList) {
    this.statisticDataList = statisticDataList;
    if (chart == null) {
        return;
    }
    int oldDataStatus = isHasValidData ? 1 : 0;
    isHasValidData = false;
    ChartType oldType = chartType;
    XYDataset dataset = createDataset();
    XYPlot plot = chart.getXYPlot();
    int newDataStatus = isHasValidData ? 1 : 0;
    if (!isHasValidData) {
        if (oldDataStatus != newDataStatus) {
            setNoDataPlot(plot);
        }
        plot.setDataset(EMPTY_DATASET);
    } else {
        if (oldDataStatus != newDataStatus) {
            setDataPlot(plot);
        }
        if (chartType != oldType) {
            plot.getRangeAxis().setRange(rangMin, rangMax);
        }
        plot.setDataset(dataset);
    }
}
Also used : XYPlot(org.jfree.chart.plot.XYPlot) ChartType(com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.ChartType) XYDataset(org.jfree.data.xy.XYDataset)

Example 47 with XYPlot

use of org.jfree.chart.plot.XYPlot in project cubrid-manager by CUBRID.

the class WhiteChart method createChart.

public JFreeChart createChart() {
    final Color backGroundColor = Color.WHITE;
    JFreeChart chart = ChartFactory.createTimeSeriesChart(EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, new TimeSeriesCollection(), false, false, false);
    chart.setBackgroundImageAlpha(0.0f);
    chart.setBackgroundPaint(backGroundColor);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setOutlineVisible(false);
    if (backgroundIconPath != null) {
        plot.setBackgroundImage(CommonUITool.getAWTImage(CubridManagerUIPlugin.getImage(backgroundIconPath).getImageData()));
    }
    plot.getDomainAxis().setVisible(false);
    plot.getRangeAxis().setVisible(false);
    return chart;
}
Also used : XYPlot(org.jfree.chart.plot.XYPlot) Color(java.awt.Color) TimeSeriesCollection(org.jfree.data.time.TimeSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart)

Example 48 with XYPlot

use of org.jfree.chart.plot.XYPlot in project cubrid-manager by CUBRID.

the class HostSystemMonitorCompositePart method fireChartSetting.

/**
	 * This method is responsible for preparing data for ChartSettingDlg and
	 * dealing with the results of chartSettingDlg
	 *
	 */
public void fireChartSetting() {
    ChartSettingDlg chartSettingDlg = new ChartSettingDlg(composite.getShell());
    chartSettingDlg.setHasTitlSetting(false);
    chartSettingDlg.setHasHistoryPath(true);
    chartSettingDlg.setHasAxisSetting(false);
    chartSettingDlg.setHasSeriesItemSetting(false);
    chartSettingDlg.setHasChartSelection(true);
    // plot appearance
    XYPlot cpuSeriesPlot = cpuChart.getSeriesChart().getXYPlot();
    String plotBgColor = trimPaintColor(cpuSeriesPlot.getBackgroundPaint().toString());
    String plotDomainGridColor = trimPaintColor(cpuSeriesPlot.getDomainGridlinePaint().toString());
    String plotRangGridColor = trimPaintColor(cpuSeriesPlot.getRangeGridlinePaint().toString());
    chartSettingDlg.setPlotBgColor(plotBgColor);
    chartSettingDlg.setPlotDomainGridColor(plotDomainGridColor);
    chartSettingDlg.setPlotRangGridColor(plotRangGridColor);
    //history setting
    chartSettingDlg.setHistoryFileName(historyFileName);
    chartSettingDlg.setHistoryPath(historyPath);
    // 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();
        JFreeChart memoryBarChart = memoryChart.getBarChart();
        Plot memoryBarPlot = memoryBarChart.getPlot();
        XYPlot memorySeriesPlot = (XYPlot) memoryChart.getSeriesChart().getPlot();
        JFreeChart iowaitBarChart = iowaitChart.getBarChart();
        Plot iowaitBarPlot = iowaitBarChart.getPlot();
        XYPlot iowaitSeriesPlot = (XYPlot) iowaitChart.getSeriesChart().getPlot();
        // history path
        String newHistoryPath = chartSettingDlg.getHistoryPath();
        boolean 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);
        //cpu chart
        cpuBarChart.setBackgroundPaint(bgColor);
        cpuBarPlot.setBackgroundPaint(bgColor);
        cpuSeriesPlot.setBackgroundPaint(bgColor);
        //memoryChart
        memoryBarPlot.setBackgroundPaint(bgColor);
        memoryBarChart.setBackgroundPaint(bgColor);
        memorySeriesPlot.setBackgroundPaint(bgColor);
        //iowaitChart
        iowaitBarPlot.setBackgroundPaint(bgColor);
        iowaitBarChart.setBackgroundPaint(bgColor);
        iowaitSeriesPlot.setBackgroundPaint(bgColor);
        //DomainGridColor
        red = getColorElem(plotDomainGridColor, 0);
        green = getColorElem(plotDomainGridColor, 1);
        blue = getColorElem(plotDomainGridColor, 2);
        Color domainGridlineColor = new Color(red, green, blue);
        //cpu chart
        cpuSeriesPlot.setDomainGridlinePaint(domainGridlineColor);
        //memoryChart
        memorySeriesPlot.setDomainGridlinePaint(domainGridlineColor);
        //delayChart
        iowaitSeriesPlot.setDomainGridlinePaint(domainGridlineColor);
        //RangeGridColor
        red = getColorElem(plotRangGridColor, 0);
        green = getColorElem(plotRangGridColor, 1);
        blue = getColorElem(plotRangGridColor, 2);
        Color rangeGridColor = new Color(red, green, blue);
        //cpu chart
        cpuSeriesPlot.setRangeGridlinePaint(rangeGridColor);
        //memoryChart
        memorySeriesPlot.setRangeGridlinePaint(rangeGridColor);
        //iowaitChart
        iowaitSeriesPlot.setRangeGridlinePaint(rangeGridColor);
        //chart Selection
        fireChartSelection(chartSettingDlg.getChartSelectionLst());
    }
}
Also used : XYPlot(org.jfree.chart.plot.XYPlot) XYPlot(org.jfree.chart.plot.XYPlot) Plot(org.jfree.chart.plot.Plot) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) JFreeChart(org.jfree.chart.JFreeChart)

Example 49 with XYPlot

use of org.jfree.chart.plot.XYPlot in project cubrid-manager by CUBRID.

the class DbSystemMonitorHistoryViewPart 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);
    chartSettingDlg.setHasSeriesItemSetting(false);
    // plot appearance
    XYPlot dbStatplot = cpuChart.getSeriesChart().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);
    // chart selection
    chartSettingDlg.setChartSelectionLst(getSelectedCharts());
    // history path
    chartSettingDlg.setHistoryPath(historyPath);
    chartSettingDlg.setHistoryFileName(historyFileName);
    if (chartSettingDlg.open() == Dialog.OK) {
        // plot appearance
        plotBgColor = chartSettingDlg.getPlotBgColor();
        plotDomainGridColor = chartSettingDlg.getPlotDomainGridColor();
        plotRangGridColor = chartSettingDlg.getPlotRangGridColor();
        //SeriesPlot
        XYPlot cpuSeriesPlot = (XYPlot) cpuChart.getSeriesChart().getPlot();
        XYPlot memorySeriesPlot = (XYPlot) memoryChart.getSeriesChart().getPlot();
        // history path
        String newHistoryPath = chartSettingDlg.getHistoryPath();
        isChangedHistoryPath = historyPath.equals(newHistoryPath) ? false : true;
        if (isChangedHistoryPath) {
            historyPath = newHistoryPath;
            historyFileHelp.setHistoryPath(historyPath);
        }
        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
        cpuSeriesPlot.setBackgroundPaint(bgColor);
        //memoryChart
        memorySeriesPlot.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);
        //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);
        //chart Selection
        fireChartSelection(chartSettingDlg.getChartSelectionLst());
    }
}
Also used : ChartSettingDlg(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartSettingDlg) XYPlot(org.jfree.chart.plot.XYPlot) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor)

Example 50 with XYPlot

use of org.jfree.chart.plot.XYPlot in project cubrid-manager by CUBRID.

the class ChartCompositePart method fireChartSetting.

/**
	 * This method is responsible for preparing data for ChartSettingDlg and
	 * dealing with the results of chartSettingDlg
	 *
	 */
public void fireChartSetting() {
    TextTitle title = chart.getTitle();
    if (title.getBackgroundPaint() == null) {
        ttlBgColor = trimPaintColor(chart.getBackgroundPaint().toString());
    } else {
        ttlBgColor = trimPaintColor(title.getBackgroundPaint().toString());
    }
    Font titleFont = title.getFont();
    String ttlFontName = titleFont.getFontName();
    int ttlFontSize = titleFont.getSize();
    String ttlFontColor = trimPaintColor(title.getPaint().toString());
    // plot
    XYPlot plot = chart.getXYPlot();
    String plotBgColor = trimPaintColor(plot.getBackgroundPaint().toString());
    String plotDomainGridColor = trimPaintColor(plot.getDomainGridlinePaint().toString());
    String plotRangGridColor = trimPaintColor(plot.getRangeGridlinePaint().toString());
    String plotDateAxisColor = trimPaintColor(plot.getRangeAxis().getAxisLinePaint().toString());
    String plotNumberAxisColor = trimPaintColor(plot.getDomainAxis().getAxisLinePaint().toString());
    ChartSettingDlg chartSettingDlg = new ChartSettingDlg(composite.getShell());
    if (ttlBgColor != null) {
        chartSettingDlg.setTtlBgColor(ttlBgColor);
    }
    // title
    chartSettingDlg.setTtlFontName(ttlFontName);
    chartSettingDlg.setTtlFontSize(ttlFontSize);
    chartSettingDlg.setTtlFontColor(ttlFontColor);
    // plot appearance
    chartSettingDlg.setPlotBgColor(plotBgColor);
    chartSettingDlg.setPlotDomainGridColor(plotDomainGridColor);
    chartSettingDlg.setPlotRangGridColor(plotRangGridColor);
    chartSettingDlg.setPlotDateAxisColor(plotDateAxisColor);
    chartSettingDlg.setPlotNumberAxisColor(plotNumberAxisColor);
    // series
    chartSettingDlg.setSettingMap(settingMap);
    // history path
    chartSettingDlg.setHistoryPath(historyPath);
    chartSettingDlg.setHistoryFileName(historyFileName);
    if (chartSettingDlg.open() == Dialog.OK) {
        // title
        ttlBgColor = chartSettingDlg.getTtlBgColor();
        ttlFontName = chartSettingDlg.getTtlFontName();
        ttlFontSize = chartSettingDlg.getTtlFontSize();
        ttlFontColor = chartSettingDlg.getTtlFontColor();
        // plot
        plotBgColor = chartSettingDlg.getPlotBgColor();
        plotDomainGridColor = chartSettingDlg.getPlotDomainGridColor();
        plotRangGridColor = chartSettingDlg.getPlotRangGridColor();
        plotDateAxisColor = chartSettingDlg.getPlotDateAxisColor();
        plotNumberAxisColor = chartSettingDlg.getPlotNumberAxisColor();
        // history path
        String newHistoryPath = chartSettingDlg.getHistoryPath();
        isChangedHistoryPath = historyPath.equals(newHistoryPath) ? false : true;
        if (isChangedHistoryPath) {
            historyPath = newHistoryPath;
        }
        int red = 0;
        int green = 0;
        int blue = 0;
        if (ttlBgColor != null) {
            red = getColorElem(ttlBgColor, 0);
            green = getColorElem(ttlBgColor, 1);
            blue = getColorElem(ttlBgColor, 2);
            title.setBackgroundPaint(new Color(red, green, blue));
        }
        titleFont = new Font(ttlFontName, 1, ttlFontSize);
        title.setFont(titleFont);
        red = getColorElem(ttlFontColor, 0);
        green = getColorElem(ttlFontColor, 1);
        blue = getColorElem(ttlFontColor, 2);
        title.setPaint(new Color(red, green, blue));
        red = getColorElem(plotBgColor, 0);
        green = getColorElem(plotBgColor, 1);
        blue = getColorElem(plotBgColor, 2);
        plot.setBackgroundPaint(new Color(red, green, blue));
        red = getColorElem(plotDomainGridColor, 0);
        green = getColorElem(plotDomainGridColor, 1);
        blue = getColorElem(plotDomainGridColor, 2);
        plot.setDomainGridlinePaint(new Color(red, green, blue));
        red = getColorElem(plotRangGridColor, 0);
        green = getColorElem(plotRangGridColor, 1);
        blue = getColorElem(plotRangGridColor, 2);
        plot.setRangeGridlinePaint(new Color(red, green, blue));
        red = getColorElem(plotDateAxisColor, 0);
        green = getColorElem(plotDateAxisColor, 1);
        blue = getColorElem(plotDateAxisColor, 2);
        plot.getRangeAxis().setAxisLinePaint(new Color(red, green, blue));
        red = getColorElem(plotNumberAxisColor, 0);
        green = getColorElem(plotNumberAxisColor, 1);
        blue = getColorElem(plotNumberAxisColor, 2);
        plot.getDomainAxis().setAxisLinePaint(new Color(red, green, blue));
        // series
        settingMap = chartSettingDlg.getSettingMap();
        updateSettingSeries();
    }
}
Also used : TextTitle(org.jfree.chart.title.TextTitle) XYPlot(org.jfree.chart.plot.XYPlot) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) Font(java.awt.Font)

Aggregations

XYPlot (org.jfree.chart.plot.XYPlot)60 JFreeChart (org.jfree.chart.JFreeChart)37 Color (java.awt.Color)19 DateAxis (org.jfree.chart.axis.DateAxis)18 XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)15 NumberAxis (org.jfree.chart.axis.NumberAxis)12 CommonUITool.trimPaintColor (com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor)11 Map (java.util.Map)11 TimeSeriesCollection (org.jfree.data.time.TimeSeriesCollection)10 SimpleDateFormat (java.text.SimpleDateFormat)9 ValueAxis (org.jfree.chart.axis.ValueAxis)9 XYDataset (org.jfree.data.xy.XYDataset)9 RectangleInsets (org.jfree.ui.RectangleInsets)9 TreeMap (java.util.TreeMap)8 Font (java.awt.Font)7 ChartCompositePart (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart)6 ChartSettingDlg (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartSettingDlg)6 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)6 ShowSetting (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting)6 BasicStroke (java.awt.BasicStroke)6