Search in sources :

Example 11 with ITitle

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);
}
Also used : ITitle(org.eclipse.swtchart.ITitle)

Example 12 with ITitle

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);
}
Also used : Color(org.eclipse.swt.graphics.Color) FontData(org.eclipse.swt.graphics.FontData) ITitle(org.eclipse.swtchart.ITitle) Font(org.eclipse.swt.graphics.Font)

Example 13 with ITitle

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());
            }
        }
    }
}
Also used : IAxisTick(org.eclipse.swtchart.IAxisTick) Color(org.eclipse.swt.graphics.Color) StyleRange(org.eclipse.swt.custom.StyleRange) IGrid(org.eclipse.swtchart.IGrid) ITitle(org.eclipse.swtchart.ITitle) Font(org.eclipse.swt.graphics.Font) Point(org.eclipse.swt.graphics.Point)

Aggregations

ITitle (org.eclipse.swtchart.ITitle)13 Font (org.eclipse.swt.graphics.Font)5 Color (org.eclipse.swt.graphics.Color)4 Point (org.eclipse.swt.graphics.Point)4 Rectangle (org.eclipse.swt.graphics.Rectangle)3 IAxis (org.eclipse.swtchart.IAxis)3 FontData (org.eclipse.swt.graphics.FontData)2 Control (org.eclipse.swt.widgets.Control)2 InteractiveChart (org.eclipse.swtchart.extensions.charts.InteractiveChart)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 IChartField (org.eclipse.linuxtools.dataviewers.charts.provider.IChartField)1 MassifSnapshot (org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot)1 StyleRange (org.eclipse.swt.custom.StyleRange)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 Composite (org.eclipse.swt.widgets.Composite)1 IAxisSet (org.eclipse.swtchart.IAxisSet)1 IAxisTick (org.eclipse.swtchart.IAxisTick)1 IBarSeries (org.eclipse.swtchart.IBarSeries)1