use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class SVGGeneratorTest method createConf.
private Configuration createConf() {
Configuration conf = new Configuration();
conf.setTitle("Historic World Population by Region");
conf.setSubTitle("Source: Wikipedia.org");
XAxis x = new XAxis();
x.setCategories("Africa", "America", "Asia", "Europe", "Oceania");
x.setTitle(new AxisTitle((String) null));
conf.addxAxis(x);
YAxis y = new YAxis();
y.setMin(0);
AxisTitle title = new AxisTitle("Population (millions)");
title.setAlign(VerticalAlign.HIGH);
y.setTitle(title);
conf.addyAxis(y);
Tooltip tooltip = new Tooltip();
// tooltip.setFormatter("this.series.name +': '+ this.y +' millions'");
conf.setTooltip(tooltip);
PlotOptionsBar plot = new PlotOptionsBar();
plot.setDataLabels(new DataLabels(true));
conf.setPlotOptions(plot);
Legend legend = new Legend();
legend.setLayout(LayoutDirection.VERTICAL);
legend.setAlign(HorizontalAlign.RIGHT);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setX(-100);
legend.setY(100);
legend.setFloating(true);
legend.setBorderWidth(1);
legend.setBackgroundColor(new SolidColor("#FFFFFF"));
legend.setShadow(true);
conf.setLegend(legend);
conf.disableCredits();
List<Series> series = new ArrayList<Series>();
series.add(new ListSeries("Year 1800", 107, 31, 635, 203, 2));
series.add(new ListSeries("Year 1900", 133, 156, 947, 408, 6));
series.add(new ListSeries("Year 2008", 973, 914, 4054, 732, 34));
conf.setSeries(series);
return conf;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class PieWithGradientFill method getBrowserMarketShareSeries.
private DataSeries getBrowserMarketShareSeries() {
DataSeriesItem firefox = new DataSeriesItem("Firefox", 45.0);
firefox.setColor(createRadialGradient(new SolidColor(255, 128, 0), new SolidColor(128, 64, 0)));
DataSeriesItem ie = new DataSeriesItem("IE", 26.8);
ie.setColor(createRadialGradient(new SolidColor(0, 255, 255), new SolidColor(0, 128, 128)));
DataSeriesItem chrome = new DataSeriesItem("Chrome", 12.8);
chrome.setColor(createRadialGradient(new SolidColor(255, 255, 0), new SolidColor(128, 128, 0)));
chrome.setSliced(true);
chrome.setSelected(true);
DataSeriesItem safari = new DataSeriesItem("Safari", 8.5);
safari.setColor(createRadialGradient(new SolidColor(0, 128, 255), new SolidColor(0, 64, 128)));
DataSeriesItem opera = new DataSeriesItem("Opera", 6.2);
opera.setColor(createRadialGradient(new SolidColor(255, 0, 0), new SolidColor(128, 0, 0)));
DataSeriesItem others = new DataSeriesItem("Others", 0.7);
others.setColor(createRadialGradient(new SolidColor(0, 128, 0), new SolidColor(0, 64, 0)));
return new DataSeries(firefox, ie, chrome, safari, opera, others);
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class PointClickCoordinatesDonutChart method color.
/**
* Add a small random factor to a color form the vaadin theme.
*
* @param colorIndex
* the index of the color in the colors array.
* @return the new color
*/
private static SolidColor color(int colorIndex) {
SolidColor c = (SolidColor) colors[colorIndex];
String cStr = c.toString().substring(1);
int r = Integer.parseInt(cStr.substring(0, 2), 16);
int g = Integer.parseInt(cStr.substring(2, 4), 16);
int b = Integer.parseInt(cStr.substring(4, 6), 16);
double opacity = (50 + rand.nextInt(95 - 50)) / 100.0;
return new SolidColor(r, g, b, opacity);
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class PointClickCoordinatesTreeMapChart method addSeries.
@Override
protected void addSeries(Configuration conf) {
TreeSeries series = new TreeSeries();
TreeSeriesItem apples = new TreeSeriesItem("A", "Apples");
apples.setColor(new SolidColor("#EC2500"));
TreeSeriesItem bananas = new TreeSeriesItem("B", "Bananas");
bananas.setColor(new SolidColor("#ECE100"));
TreeSeriesItem oranges = new TreeSeriesItem("O", "Oranges");
oranges.setColor(new SolidColor("#EC9800"));
TreeSeriesItem anneA = new TreeSeriesItem("Anne", apples, 5);
TreeSeriesItem rickA = new TreeSeriesItem("Rick", apples, 3);
TreeSeriesItem peterA = new TreeSeriesItem("Peter", apples, 4);
TreeSeriesItem anneB = new TreeSeriesItem("Anne", bananas, 4);
TreeSeriesItem rickB = new TreeSeriesItem("Rick", bananas, 10);
TreeSeriesItem peterB = new TreeSeriesItem("Peter", bananas, 1);
TreeSeriesItem anneO = new TreeSeriesItem("Anne", oranges, 1);
TreeSeriesItem rickO = new TreeSeriesItem("Rick", oranges, 3);
TreeSeriesItem peterO = new TreeSeriesItem("Peter", oranges, 3);
TreeSeriesItem susanne = new TreeSeriesItem("Susanne", 2);
susanne.setParent("Kiwi");
susanne.setColor(new SolidColor("#9EDE00"));
series.addAll(apples, bananas, oranges, anneA, rickA, peterA, anneB, rickB, peterB, anneO, rickO, peterO, susanne);
conf.addSeries(series);
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class PieWithCustomBorder method getBrowserMarketShareSeries.
private DataSeries getBrowserMarketShareSeries() {
DataSeriesItem firefox = new DataSeriesItem("Firefox", 45.0);
firefox.setColor(createRadialGradient(new SolidColor(255, 128, 0), new SolidColor(128, 64, 0)));
DataSeriesItem ie = new DataSeriesItem("IE", 26.8);
ie.setColor(createRadialGradient(new SolidColor(0, 255, 255), new SolidColor(0, 128, 128)));
DataSeriesItem chrome = new DataSeriesItem("Chrome", 12.8);
chrome.setColor(createRadialGradient(new SolidColor(255, 255, 0), new SolidColor(128, 128, 0)));
chrome.setSliced(true);
chrome.setSelected(true);
DataSeriesItem safari = new DataSeriesItem("Safari", 8.5);
safari.setColor(createRadialGradient(new SolidColor(0, 128, 255), new SolidColor(0, 64, 128)));
DataSeriesItem opera = new DataSeriesItem("Opera", 6.2);
opera.setColor(createRadialGradient(new SolidColor(255, 0, 0), new SolidColor(128, 0, 0)));
DataSeriesItem others = new DataSeriesItem("Others", 0.7);
others.setColor(createRadialGradient(new SolidColor(0, 128, 0), new SolidColor(0, 64, 0)));
return new DataSeries(firefox, ie, chrome, safari, opera, others);
}
Aggregations