use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class BorderColorTest method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.BAR);
chart.setHeight("450px");
chart.setWidth("100%");
chart.getConfiguration().addSeries(new ListSeries(1, 2, 3));
chart.getConfiguration().getChart().setBorderWidth(5);
chart.getConfiguration().getChart().setBorderColor(new SolidColor("green"));
chart.getConfiguration().getChart().setBorderRadius(25);
return chart;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class BoxPlotExample method getChart.
@Override
protected Component getChart() {
chart = new Chart();
chart.getConfiguration().setTitle("Box Plot Example");
Legend legend = new Legend();
legend.setEnabled(false);
chart.getConfiguration().setLegend(legend);
XAxis xaxis = chart.getConfiguration().getxAxis();
xaxis.setTitle("Experiment No.");
xaxis.setCategories("1", "2", "3", "4", "5");
YAxis yAxis = chart.getConfiguration().getyAxis();
yAxis.setTitle("Observations");
PlotLine plotLine = new PlotLine();
plotLine.setColor(new SolidColor("red"));
plotLine.setValue(932);
plotLine.setWidth(1);
plotLine.setZIndex(0);
plotLine.setDashStyle(DashStyle.DASHDOT);
Label label = new Label("Theoretical mean: 932");
label.setAlign(HorizontalAlign.CENTER);
Style style = new Style();
style.setColor(new SolidColor("gray"));
label.setStyle(style);
plotLine.setLabel(label);
PlotLine plotLine2 = new PlotLine();
plotLine2.setColor(new SolidColor("blue"));
plotLine2.setValue(800);
plotLine2.setWidth(1);
plotLine2.setZIndex(500);
plotLine2.setDashStyle(DashStyle.SHORTDASHDOTDOT);
Label label2 = new Label("Second plotline: 800");
label2.setAlign(HorizontalAlign.CENTER);
Style style2 = new Style();
style2.setColor(new SolidColor("gray"));
label2.setStyle(style2);
plotLine2.setLabel(label2);
yAxis.setPlotLines(plotLine, plotLine2);
observations = new DataSeries();
observations.setName("Observations");
// Add PlotBoxItems contain all fields relevant for plot box chart
observations.add(new BoxPlotItem(760, 801, 848, 895, 965));
// Example with no arg constructor
BoxPlotItem plotBoxItem = new BoxPlotItem();
plotBoxItem.setLow(733);
plotBoxItem.setLowerQuartile(853);
plotBoxItem.setMedian(939);
plotBoxItem.setUpperQuartile(980);
plotBoxItem.setHigh(1080);
observations.add(plotBoxItem);
observations.add(new BoxPlotItem(714, 762, 817, 870, 918));
observations.add(new BoxPlotItem(724, 802, 806, 871, 950));
observations.add(new BoxPlotItem(834, 836, 864, 882, 910));
observations.setPlotOptions(getPlotBoxOptions());
chart.getConfiguration().addSeries(observations);
return chart;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class Migration method classnamedifColor.
public void classnamedifColor() {
PlotOptionsArea plotOptions = new PlotOptionsArea();
plotOptions.setFillColor(new SolidColor("#ff0000"));
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class Timeline method chartsTimelineIntroSnippet2.
public void chartsTimelineIntroSnippet2() {
RangeSelector rangeSelector = new RangeSelector();
rangeSelector.setSelected(4);
ButtonTheme theme = new ButtonTheme();
Style style = new Style();
style.setColor(new SolidColor("#0766d8"));
style.setFontWeight(FontWeight.BOLD);
theme.setStyle(style);
rangeSelector.setButtonTheme(theme);
Chart chart = new Chart();
chart.setTimeline(true);
Configuration configuration = chart.getConfiguration();
configuration.setRangeSelector(rangeSelector);
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class ChartTypes method chartTypesTreemap.
public void chartTypesTreemap() {
Chart chart = new Chart();
PlotOptionsTreemap plotOptions = new PlotOptionsTreemap();
plotOptions.setLayoutAlgorithm(TreeMapLayoutAlgorithm.STRIPES);
plotOptions.setAlternateStartingDirection(true);
Level level = new Level();
level.setLevel(1);
level.setLayoutAlgorithm(TreeMapLayoutAlgorithm.SLICEANDDICE);
DataLabels dataLabels = new DataLabels();
dataLabels.setEnabled(true);
dataLabels.setAlign(HorizontalAlign.LEFT);
dataLabels.setVerticalAlign(VerticalAlign.TOP);
Style style = new Style();
style.setFontSize("15px");
style.setFontWeight(FontWeight.BOLD);
dataLabels.setStyle(style);
level.setDataLabels(dataLabels);
plotOptions.setLevels(level);
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 paulA = new TreeSeriesItem("Paul", apples, 4);
TreeSeriesItem anneB = new TreeSeriesItem("Anne", bananas, 4);
TreeSeriesItem rickB = new TreeSeriesItem("Rick", bananas, 10);
TreeSeriesItem paulB = new TreeSeriesItem("Paul", bananas, 1);
TreeSeriesItem anneO = new TreeSeriesItem("Anne", oranges, 1);
TreeSeriesItem rickO = new TreeSeriesItem("Rick", oranges, 3);
TreeSeriesItem paulO = new TreeSeriesItem("Paul", oranges, 3);
TreeSeriesItem susanne = new TreeSeriesItem("Susanne", 2);
susanne.setParent("Kiwi");
susanne.setColor(new SolidColor("#9EDE00"));
series.addAll(apples, bananas, oranges, anneA, rickA, paulA, anneB, rickB, paulB, anneO, rickO, paulO, susanne);
series.setPlotOptions(plotOptions);
chart.getConfiguration().addSeries(series);
chart.getConfiguration().setTitle("Fruit consumption");
}
Aggregations