use of org.eclipse.swtchart.ITitle in project org.eclipse.linuxtools by eclipse-linuxtools.
the class AbstractChartBuilder method buildTitle.
/**
* Builds the chart title.
*/
private void buildTitle() {
ITitle ctitle = chart.getTitle();
ctitle.setForeground(BLACK);
ctitle.setText(this.title);
chart.setProposedSaveAsFilename(this.title);
}
use of org.eclipse.swtchart.ITitle in project swtchart by eclipse.
the class ChartPage method apply.
/*
* @see AbstractPreferencePage#apply()
*/
@Override
public void apply() {
Color color = new Color(Display.getDefault(), backgroundInPlotAreaButton.getColorValue());
chart.setBackgroundInPlotArea(color);
resources.put(PLOT_AREA_BACKGROUND, color);
color = new Color(Display.getDefault(), backgroundButton.getColorValue());
chart.setBackground(color);
resources.put(CHART_BACKGROUND, color);
chart.setOrientation(orientationButton.getSelection() ? SWT.VERTICAL : SWT.HORIZONTAL);
ITitle title = chart.getTitle();
title.setVisible(showTitleButton.getSelection());
title.setText(titleText.getText());
FontData fontData = title.getFont().getFontData()[0];
fontData.setHeight(fontSizeSpinner.getSelection());
Font font = new Font(Display.getDefault(), fontData);
title.setFont(font);
resources.put(TITLE_FONT, font);
color = new Color(Display.getDefault(), titleColorButton.getColorValue());
title.setForeground(color);
resources.put(TITLE_FOREGROUND, color);
}
use of org.eclipse.swtchart.ITitle in project swtchart by eclipse.
the class ScrollableChart method setAxisSettings.
private void setAxisSettings(IAxis axis, IAxisSettings axisSettings) {
if (axis != null && axisSettings != null) {
//
String axisText = axisSettings.getTitle();
ITitle title = axis.getTitle();
title.setText(axisText);
title.setVisible(axisSettings.isVisible());
//
IAxisTick axisTick = axis.getTick();
axisTick.setFormat(axisSettings.getDecimalFormat());
axisTick.setVisible(axisSettings.isVisible());
//
IGrid grid = axis.getGrid();
grid.setForeground(axisSettings.getGridColor());
grid.setStyle(axisSettings.getGridLineStyle());
//
axis.setPosition(axisSettings.getPosition());
/*
* Set the color on demand.
*/
Color color = axisSettings.getColor();
if (color != null) {
title.setForeground(color);
axisTick.setForeground(color);
}
/*
* Add a space between the scale and the label.
*/
Font font = title.getFont();
int length = axisText.length() - 1;
StyleRange styleRange = new StyleRange();
styleRange.length = (length > 0) ? length : 0;
styleRange.background = baseChart.getBackground();
styleRange.foreground = (color != null) ? color : baseChart.getForeground();
styleRange.font = font;
styleRange.rise = getAxisExtraSpaceTitle(axis, axisSettings);
title.setStyleRanges(new StyleRange[] { styleRange });
//
axis.enableLogScale(axisSettings.isEnableLogScale());
/*
* Apply primary axis specific settings.
*/
if (axisSettings instanceof IPrimaryAxisSettings) {
IPrimaryAxisSettings primaryAxisSettings = (IPrimaryAxisSettings) axisSettings;
axis.enableLogScale(primaryAxisSettings.isEnableLogScale());
/*
* Category is only valid for the X-Axis.
*/
if (axis.getDirection() == Direction.X) {
axis.enableCategory(primaryAxisSettings.isEnableCategory());
axis.setCategorySeries(primaryAxisSettings.getCategorySeries());
}
}
}
}
Aggregations