Search in sources :

Example 1 with ChartComposite

use of org.jfree.experimental.chart.swt.ChartComposite in project cubrid-manager by CUBRID.

the class CombinedBarTimeSeriesChart method loadSeriesChart.

/**
	 * Load the series chart into the given composite
	 * 
	 * @param parent the given composite
	 * @return the instance of composite
	 */
private Composite loadSeriesChart(Composite parent) {
    Group seriesGroup = new Group(parent, SWT.NONE);
    seriesGroup.setText(seriesGroupName);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    seriesGroup.setLayout(layout);
    seriesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    seriesChart = createSeriesChart();
    int red = seriesGroup.getBackground().getRed();
    int green = seriesGroup.getBackground().getGreen();
    int blue = seriesGroup.getBackground().getBlue();
    seriesChart.setBackgroundPaint(new Color(red, green, blue));
    ChartComposite chartComposite = new ChartComposite(seriesGroup, SWT.NONE, seriesChart, false, true, false, false, false);
    FillLayout chartLayout = new FillLayout();
    chartLayout.marginHeight = 0;
    chartLayout.marginWidth = 0;
    chartComposite.setLayout(chartLayout);
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    return parent;
}
Also used : Group(org.eclipse.swt.widgets.Group) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) GridLayout(org.eclipse.swt.layout.GridLayout) Color(java.awt.Color) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint)

Example 2 with ChartComposite

use of org.jfree.experimental.chart.swt.ChartComposite in project cubrid-manager by CUBRID.

the class CombinedBarTimeSeriesChart method loadBarChart.

/**
	 * Load the bar chart into the given composite
	 * 
	 * @param parent the given composite
	 * @return the instance of composite
	 */
private Composite loadBarChart(Composite parent) {
    Group barGroup = new Group(parent, SWT.NONE);
    barGroup.setText(barGroupName);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 6;
    layout.marginWidth = 6;
    barGroup.setLayout(layout);
    barGroup.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    barChart = createBarChart();
    barChart.setBackgroundPaint(Color.BLACK);
    ChartComposite chartComposite = new ChartComposite(barGroup, SWT.NONE, barChart, false, true, false, false, false);
    chartComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    FillLayout chartLayout = new FillLayout();
    chartLayout.marginHeight = 0;
    chartLayout.marginWidth = 0;
    chartComposite.setLayout(chartLayout);
    return parent;
}
Also used : Group(org.eclipse.swt.widgets.Group) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 3 with ChartComposite

use of org.jfree.experimental.chart.swt.ChartComposite in project cubrid-manager by CUBRID.

the class ChartCompositePart method createPlotUnit.

/**
	 * Create plot unit which show the data changing.
	 *
	 * @param parent the parent composite
	 */
public void createPlotUnit(Composite parent) {
    chart = createChart();
    int red = parent.getBackground().getRed();
    int green = parent.getBackground().getGreen();
    int blue = parent.getBackground().getBlue();
    chart.setBackgroundPaint(new Color(red, green, blue));
    chartComposite = new ChartComposite(parent, SWT.NONE, chart, false, true, false, false, false);
    FillLayout fillLayout = new FillLayout();
    fillLayout.marginHeight = 0;
    fillLayout.marginWidth = 0;
    chartComposite.setLayout(fillLayout);
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    if (null != monInstaceData) {
        TextTitle title = chart.getTitle();
        XYPlot plot = chart.getXYPlot();
        // title
        String ttlBgColor = monInstaceData.getTitleBgColor();
        String ttlFontName = monInstaceData.getTitleFontName();
        int ttlFontSize = monInstaceData.getTitleFontSize();
        String ttlFontColor = monInstaceData.getTitleFontColor();
        // plot
        String plotBgColor = monInstaceData.getPlotBgColor();
        String plotDomainGridColor = monInstaceData.getPlotDomainGridColor();
        String plotRangGridColor = monInstaceData.getPlotRangGridColor();
        String plotDateAxisColor = monInstaceData.getPlotDateAxisColor();
        String plotNumberAxisColor = monInstaceData.getPlotNumberAxisColor();
        // history path
        historyPath = monInstaceData.getHistoryPath();
        isChangedHistoryPath = true;
        if (ttlBgColor != null) {
            red = getColorElem(ttlBgColor, 0);
            green = getColorElem(ttlBgColor, 1);
            blue = getColorElem(ttlBgColor, 2);
            title.setBackgroundPaint(new Color(red, green, blue));
        }
        if (!"".equals(ttlFontName)) {
            Font titleFont = new Font(ttlFontName, 0, 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));
    }
}
Also used : ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) 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) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) Font(java.awt.Font)

Example 4 with ChartComposite

use of org.jfree.experimental.chart.swt.ChartComposite in project cubrid-manager by CUBRID.

the class MonitorStatisticChart method loadChart.

public void loadChart() {
    recordMillisecs = System.currentTimeMillis();
    if (groupName != null) {
        final Group chartGroup = addGeneralGroup(composite);
        frame = new ChartComposite(chartGroup, SWT.NONE, createChart(), false, true, false, true, true);
    } else {
        frame = new ChartComposite(composite, SWT.NONE, createChart(), false, true, false, true, true);
    }
    frame.setDisplayToolTips(true);
    GridData gdFrame = new GridData(SWT.FILL, SWT.FILL, true, true);
    frame.setLayoutData(gdFrame);
    frame.setLayout(new FillLayout());
    if (!isDetailView) {
        frame.addChartMouseListener(new ChartMouseListener() {

            public void chartMouseMoved(ChartMouseEvent event) {
            }

            public void chartMouseClicked(ChartMouseEvent event) {
                if (!isHasValidData) {
                    return;
                }
                if (event.getTrigger().getButton() == 1) {
                    long interval = System.currentTimeMillis() - recordMillisecs;
                    if (interval < 300) {
                        //trigger double click action
                        if (editor == null) {
                            return;
                        }
                        editor.openDetailView(statisticChartItem, statisticDataList);
                    } else {
                        recordMillisecs = System.currentTimeMillis();
                    }
                }
            }
        });
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) ChartMouseEvent(org.jfree.chart.ChartMouseEvent) ChartMouseListener(org.jfree.chart.ChartMouseListener)

Example 5 with ChartComposite

use of org.jfree.experimental.chart.swt.ChartComposite in project eclipse-cs by checkstyle.

the class GraphStatsView method createMasterView.

/**
 * Creates the master view containing the chart.
 *
 * @param parent
 *          the parent composite
 * @return the chart composite
 */
public Composite createMasterView(Composite parent) {
    // create the date set for the chart
    mPieDataset = new GraphPieDataset();
    mPieDataset.setShowAllCategories(mShowAllCategoriesAction.isChecked());
    mGraph = createChart(mPieDataset);
    // creates the chart component
    // Composite embeddedComposite = new Composite(parent, SWT.EMBEDDED |
    // SWT.NO_BACKGROUND);
    // embeddedComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // experimental usage of JFreeChart SWT
    // the composite to harbor the Swing chart control
    ChartComposite embeddedComposite = new ChartComposite(parent, SWT.NONE, mGraph, true);
    embeddedComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    embeddedComposite.addChartMouseListener(new ChartMouseListener() {

        @Override
        public void chartMouseClicked(final ChartMouseEvent event) {
            MouseEvent trigger = event.getTrigger();
            if (trigger.getButton() == MouseEvent.BUTTON1 && event.getEntity() instanceof PieSectionEntity) {
                // && trigger.getClickCount() == 2 //doubleclick not correctly
                // detected with the SWT
                // composite
                mMasterComposite.getDisplay().syncExec(new Runnable() {

                    @Override
                    public void run() {
                        mIsDrilledDown = true;
                        mCurrentDetailCategory = (String) ((PieSectionEntity) event.getEntity()).getSectionKey();
                        mStackLayout.topControl = mDetailViewer.getTable();
                        mMainSection.layout();
                        mDetailViewer.setInput(mDetailViewer.getInput());
                        updateActions();
                        updateLabel();
                    }
                });
            } else {
                event.getTrigger().consume();
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent event) {
        // NOOP
        }
    });
    return embeddedComposite;
}
Also used : ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) ChartMouseEvent(org.jfree.chart.ChartMouseEvent) MouseEvent(java.awt.event.MouseEvent) GridData(org.eclipse.swt.layout.GridData) ChartMouseEvent(org.jfree.chart.ChartMouseEvent) PieSectionEntity(org.jfree.chart.entity.PieSectionEntity) ChartMouseListener(org.jfree.chart.ChartMouseListener)

Aggregations

ChartComposite (org.jfree.experimental.chart.swt.ChartComposite)21 GridData (org.eclipse.swt.layout.GridData)17 TalendChartComposite (org.talend.dataprofiler.chart.util.TalendChartComposite)8 FillLayout (org.eclipse.swt.layout.FillLayout)7 ChartMouseEvent (org.jfree.chart.ChartMouseEvent)7 ChartMouseListener (org.jfree.chart.ChartMouseListener)7 JFreeChart (org.jfree.chart.JFreeChart)5 Group (org.eclipse.swt.widgets.Group)4 DisposeEvent (org.eclipse.swt.events.DisposeEvent)3 DisposeListener (org.eclipse.swt.events.DisposeListener)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Menu (org.eclipse.swt.widgets.Menu)3 CategoryItemEntity (org.jfree.chart.entity.CategoryItemEntity)3 ChartEntity (org.jfree.chart.entity.ChartEntity)3 Color (java.awt.Color)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 MenuItem (org.eclipse.swt.widgets.MenuItem)2 XYPlot (org.jfree.chart.plot.XYPlot)2 CommonUITool.trimPaintColor (com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor)1