Project

General

Profile

Bug #120

support for vaadin 7.1?

Added by petr prikryl about 5 years ago. Updated about 4 years ago.

Status:
New
Priority:
High
Target version:
Start date:
09/18/2013
Due date:
% Done:

0%

Estimated time:

Description

Hello, do you support last vaadin version?
I tried to copy&paste examples of donuts chart, but neither one rendered as I expected base on your demo page:
setup
Vaadin 7.1.5
plugin 1.7.0
based on: http://vaadin.dussan.org/dchartsdemo/#donutCharts/dataLabelsAndLegend

And results are on screenshot:

package cz.admin24.myachievo.web2.reports;

import org.dussan.vaadin.dcharts.DCharts;
import org.dussan.vaadin.dcharts.data.DataSeries;
import org.dussan.vaadin.dcharts.metadata.DataLabels;
import org.dussan.vaadin.dcharts.metadata.LegendPlacements;
import org.dussan.vaadin.dcharts.metadata.locations.LegendLocations;
import org.dussan.vaadin.dcharts.metadata.renderers.SeriesRenderers;
import org.dussan.vaadin.dcharts.options.Legend;
import org.dussan.vaadin.dcharts.options.Options;
import org.dussan.vaadin.dcharts.options.SeriesDefaults;
import org.dussan.vaadin.dcharts.renderers.series.DonutRenderer;

import cz.admin24.myachievo.web2.widgets.chart.Widget;

public class TestChart extends Widget {

    public TestChart() {
        DataSeries dataSeries = new DataSeries();
        dataSeries.newSeries()
            .add("a", 6)
            .add("b", 8)
            .add("c", 14)
            .add("d", 20);
        dataSeries.newSeries()
            .add("a", 8)
            .add("b", 12)
            .add("c", 6)
            .add("d", 9);

        SeriesDefaults seriesDefaults = new SeriesDefaults()
            .setRenderer(SeriesRenderers.DONUT)
            .setRendererOptions(
                new DonutRenderer()
                    .setSliceMargin(3)
                    .setStartAngle(-90)
                    .setShowDataLabels(true)
                    .setDataLabels(DataLabels.VALUE));

        Legend legend = new Legend()
            .setShow(true)
            .setPlacement(LegendPlacements.OUTSIDE_GRID)
            .setLocation(LegendLocations.WEST);

        Options options = new Options()
            .setSeriesDefaults(seriesDefaults)
            .setLegend(legend);

        DCharts chart = new DCharts()
            .setDataSeries(dataSeries)
            .setOptions(options)
            .show();
        addComponent(chart);
    }
}

screenshot.PNG (69.1 KB) screenshot.PNG petr prikryl, 09/18/2013 05:39 PM
97

History

#1 Updated by Tomas Dosek almost 5 years ago

Looking at the BaseData.java class which is responsible for adding items into series it seems like
the add operation for series and subseries is identical. On first .add it causes the input object to get
wrapped as [Object] which is on the second calling of .add evaluated as subseries, hence the second object gets
added as a first Item of new series. Removing typecast to Object[] from the else branch could probably solve the issue.

Please note I'm taking a look to this code only few minutes so the mentioned ideas might not be totally right. ;)

@SuppressWarnings("unchecked")
public T add(Object... data) {
if (hasSubSeries()) {
subSeries.add((Object[]) data);
} else {
series.add((Object[]) data);
}
return (T) this;
}

I'll try to compile the proposed change and test it.

Tom

#2 Updated by Dušan Vejnovič about 4 years ago

  • Assignee set to Dušan Vejnovič
  • Target version set to 2.0.0

Also available in: Atom PDF