Search in sources :

Example 1 with PerformanceChartSeriesBuilder

use of name.abuchen.portfolio.ui.views.dataseries.PerformanceChartSeriesBuilder 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 2 with PerformanceChartSeriesBuilder

use of name.abuchen.portfolio.ui.views.dataseries.PerformanceChartSeriesBuilder in project portfolio by buchen.

the class ChartWidget method buildPerformanceSeries.

private void buildPerformanceSeries(List<DataSeries> series, ReportingPeriod reportingPeriod) {
    PerformanceChartSeriesBuilder b2 = new PerformanceChartSeriesBuilder(chart, getDashboardData().getDataSeriesCache());
    series.forEach(s -> b2.build(s, reportingPeriod, get(AggregationConfig.class).getAggregation()));
}
Also used : PerformanceChartSeriesBuilder(name.abuchen.portfolio.ui.views.dataseries.PerformanceChartSeriesBuilder)

Aggregations

PerformanceChartSeriesBuilder (name.abuchen.portfolio.ui.views.dataseries.PerformanceChartSeriesBuilder)2 DecimalFormat (java.text.DecimalFormat)1 TimelineChart (name.abuchen.portfolio.ui.util.chart.TimelineChart)1 DataSeriesCache (name.abuchen.portfolio.ui.views.dataseries.DataSeriesCache)1 DataSeriesChartLegend (name.abuchen.portfolio.ui.views.dataseries.DataSeriesChartLegend)1 DataSeriesConfigurator (name.abuchen.portfolio.ui.views.dataseries.DataSeriesConfigurator)1 Composite (org.eclipse.swt.widgets.Composite)1