All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.mateu.mdd.vaadin.components.charts.RandomDataProvider Maven / Gradle / Ivy

There is a newer version: 1.1.60
Show newest version
package io.mateu.mdd.vaadin.components.charts;

import com.vaadin.data.provider.ListDataProvider;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Random;

public class RandomDataProvider extends ListDataProvider {

    public RandomDataProvider(int lanes, int columns) {
        super(createRandomData(lanes, columns));
    }


    private static Collection createRandomData(int maxI, int maxJ) {
        Collection l = new ArrayList<>();

        Random rand = new Random(100);

        for (int i = 0; i < maxI; i++) {

            for (int j = 0; j < maxJ; j++) {

                ((ArrayList) l).add(new ChartData("" + i, "" + j, Math.abs(100d * rand.nextDouble())));

            }

        }

        return l;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy