Search in sources :

Example 1 with DataSeriesSerializer

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

the class ChartWidget method update.

@Override
public void update() {
    title.setText(getWidget().getLabel());
    try {
        chart.suspendUpdate(true);
        chart.getTitle().setText(title.getText());
        for (ISeries s : chart.getSeriesSet().getSeries()) chart.getSeriesSet().deleteSeries(s.getId());
        List<DataSeries> series = new DataSeriesSerializer().fromString(dataSeriesSet, get(ChartConfig.class).getData());
        ReportingPeriod reportingPeriod = get(ReportingPeriodConfig.class).getReportingPeriod();
        switch(useCase) {
            case STATEMENT_OF_ASSETS:
                buildAssetSeries(series, reportingPeriod);
                break;
            case PERFORMANCE:
                buildPerformanceSeries(series, reportingPeriod);
                break;
            case RETURN_VOLATILITY:
                throw new UnsupportedOperationException();
            default:
                throw new IllegalArgumentException();
        }
        chart.adjustRange();
    } finally {
        chart.suspendUpdate(false);
    }
    chart.redraw();
}
Also used : ReportingPeriod(name.abuchen.portfolio.snapshot.ReportingPeriod) DataSeriesSerializer(name.abuchen.portfolio.ui.views.dataseries.DataSeriesSerializer) DataSeries(name.abuchen.portfolio.ui.views.dataseries.DataSeries) ISeries(org.swtchart.ISeries)

Aggregations

ReportingPeriod (name.abuchen.portfolio.snapshot.ReportingPeriod)1 DataSeries (name.abuchen.portfolio.ui.views.dataseries.DataSeries)1 DataSeriesSerializer (name.abuchen.portfolio.ui.views.dataseries.DataSeriesSerializer)1 ISeries (org.swtchart.ISeries)1