Search in sources :

Example 1 with TimelineChart

use of name.abuchen.portfolio.ui.util.chart.TimelineChart in project portfolio by buchen.

the class ExchangeRatesListView method createBottomTable.

@Override
protected void createBottomTable(Composite parent) {
    chart = new TimelineChart(parent);
    // $NON-NLS-1$
    chart.getToolTip().setValueFormat(new DecimalFormat("0.0000"));
    refreshChart(null);
}
Also used : DecimalFormat(java.text.DecimalFormat) TimelineChart(name.abuchen.portfolio.ui.util.chart.TimelineChart)

Example 2 with TimelineChart

use of name.abuchen.portfolio.ui.util.chart.TimelineChart in project portfolio by buchen.

the class PerformanceChartView method createBody.

@Override
protected Composite createBody(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    chart = new TimelineChart(composite);
    chart.getTitle().setText(getTitle());
    chart.getTitle().setVisible(false);
    // $NON-NLS-1$
    chart.getAxisSet().getYAxis(0).getTick().setFormat(new DecimalFormat("0.#%"));
    // $NON-NLS-1$
    chart.getToolTip().setValueFormat(new DecimalFormat("0.##%"));
    DataSeriesCache cache = make(DataSeriesCache.class);
    seriesBuilder = new PerformanceChartSeriesBuilder(chart, cache);
    picker = new DataSeriesConfigurator(this, DataSeries.UseCase.PERFORMANCE);
    picker.addListener(this::updateChart);
    DataSeriesChartLegend legend = new DataSeriesChartLegend(composite, picker);
    // $NON-NLS-1$ //$NON-NLS-2$
    updateTitle(Messages.LabelPerformanceChart + " (" + picker.getConfigurationName() + ")");
    chart.getTitle().setText(getTitle());
    GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 0).applyTo(composite);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(chart);
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.FILL).applyTo(legend);
    setChartSeries();
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) DataSeriesCache(name.abuchen.portfolio.ui.views.dataseries.DataSeriesCache) DataSeriesConfigurator(name.abuchen.portfolio.ui.views.dataseries.DataSeriesConfigurator) DecimalFormat(java.text.DecimalFormat) TimelineChart(name.abuchen.portfolio.ui.util.chart.TimelineChart) DataSeriesChartLegend(name.abuchen.portfolio.ui.views.dataseries.DataSeriesChartLegend) PerformanceChartSeriesBuilder(name.abuchen.portfolio.ui.views.dataseries.PerformanceChartSeriesBuilder)

Example 3 with TimelineChart

use of name.abuchen.portfolio.ui.util.chart.TimelineChart in project portfolio by buchen.

the class StatementOfAssetsHistoryView method createBody.

@Override
protected Composite createBody(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    chart = new TimelineChart(composite);
    chart.getTitle().setVisible(false);
    DataSeriesCache cache = make(DataSeriesCache.class);
    seriesBuilder = new StatementOfAssetsSeriesBuilder(chart, cache);
    configurator = new DataSeriesConfigurator(this, DataSeries.UseCase.STATEMENT_OF_ASSETS);
    configurator.addListener(() -> updateChart());
    DataSeriesChartLegend legend = new DataSeriesChartLegend(composite, configurator);
    // $NON-NLS-1$ //$NON-NLS-2$
    updateTitle(Messages.LabelStatementOfAssetsHistory + " (" + configurator.getConfigurationName() + ")");
    chart.getTitle().setText(getTitle());
    GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 0).applyTo(composite);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(chart);
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.FILL).applyTo(legend);
    configurator.getSelectedDataSeries().forEach(series -> seriesBuilder.build(series, getReportingPeriod()));
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) DataSeriesCache(name.abuchen.portfolio.ui.views.dataseries.DataSeriesCache) DataSeriesConfigurator(name.abuchen.portfolio.ui.views.dataseries.DataSeriesConfigurator) StatementOfAssetsSeriesBuilder(name.abuchen.portfolio.ui.views.dataseries.StatementOfAssetsSeriesBuilder) TimelineChart(name.abuchen.portfolio.ui.util.chart.TimelineChart) DataSeriesChartLegend(name.abuchen.portfolio.ui.views.dataseries.DataSeriesChartLegend)

Example 4 with TimelineChart

use of name.abuchen.portfolio.ui.util.chart.TimelineChart in project portfolio by buchen.

the class AccountListView method createAccountBalanceChart.

private Control createAccountBalanceChart(Composite parent) {
    accountBalanceChart = new TimelineChart(parent);
    accountBalanceChart.getTitle().setVisible(false);
    return accountBalanceChart;
}
Also used : TimelineChart(name.abuchen.portfolio.ui.util.chart.TimelineChart)

Example 5 with TimelineChart

use of name.abuchen.portfolio.ui.util.chart.TimelineChart in project portfolio by buchen.

the class ChartWidget method createControl.

@Override
public Composite createControl(Composite parent, DashboardResources resources) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).applyTo(container);
    container.setBackground(parent.getBackground());
    title = new Label(container, SWT.NONE);
    title.setText(getWidget().getLabel());
    GridDataFactory.fillDefaults().grab(true, false).applyTo(title);
    chart = new TimelineChart(container);
    chart.getTitle().setVisible(false);
    chart.getTitle().setText(title.getText());
    chart.getAxisSet().getYAxis(0).getTick().setVisible(false);
    if (useCase != DataSeries.UseCase.STATEMENT_OF_ASSETS)
        // $NON-NLS-1$
        chart.getToolTip().setValueFormat(new DecimalFormat("0.##%"));
    GC gc = new GC(container);
    gc.setFont(resources.getKpiFont());
    // $NON-NLS-1$
    Point stringExtend = gc.stringExtent("X");
    gc.dispose();
    GridDataFactory.fillDefaults().hint(SWT.DEFAULT, stringExtend.y * 6).grab(true, false).applyTo(chart);
    container.layout();
    return container;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) DecimalFormat(java.text.DecimalFormat) Label(org.eclipse.swt.widgets.Label) TimelineChart(name.abuchen.portfolio.ui.util.chart.TimelineChart) Point(org.eclipse.swt.graphics.Point) GC(org.eclipse.swt.graphics.GC)

Aggregations

TimelineChart (name.abuchen.portfolio.ui.util.chart.TimelineChart)6 DecimalFormat (java.text.DecimalFormat)3 Composite (org.eclipse.swt.widgets.Composite)3 DataSeriesCache (name.abuchen.portfolio.ui.views.dataseries.DataSeriesCache)2 DataSeriesChartLegend (name.abuchen.portfolio.ui.views.dataseries.DataSeriesChartLegend)2 DataSeriesConfigurator (name.abuchen.portfolio.ui.views.dataseries.DataSeriesConfigurator)2 PerformanceChartSeriesBuilder (name.abuchen.portfolio.ui.views.dataseries.PerformanceChartSeriesBuilder)1 StatementOfAssetsSeriesBuilder (name.abuchen.portfolio.ui.views.dataseries.StatementOfAssetsSeriesBuilder)1 GC (org.eclipse.swt.graphics.GC)1 Point (org.eclipse.swt.graphics.Point)1 Label (org.eclipse.swt.widgets.Label)1