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;
}
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;
}
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));
}
}
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();
}
}
}
});
}
}
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;
}
Aggregations