Search in sources :

Example 71 with SolidColor

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;
}
Also used : ListSeries(com.vaadin.addon.charts.model.ListSeries) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Chart(com.vaadin.addon.charts.Chart)

Example 72 with SolidColor

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;
}
Also used : Legend(com.vaadin.addon.charts.model.Legend) Label(com.vaadin.addon.charts.model.Label) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) DashStyle(com.vaadin.addon.charts.model.DashStyle) Style(com.vaadin.addon.charts.model.style.Style) PlotLine(com.vaadin.addon.charts.model.PlotLine) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) YAxis(com.vaadin.addon.charts.model.YAxis) BoxPlotItem(com.vaadin.addon.charts.model.BoxPlotItem)

Example 73 with SolidColor

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"));
}
Also used : PlotOptionsArea(com.vaadin.addon.charts.model.PlotOptionsArea) SolidColor(com.vaadin.addon.charts.model.style.SolidColor)

Example 74 with SolidColor

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);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) RangeSelector(com.vaadin.addon.charts.model.RangeSelector) Style(com.vaadin.addon.charts.model.style.Style) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) ButtonTheme(com.vaadin.addon.charts.model.style.ButtonTheme) Chart(com.vaadin.addon.charts.Chart)

Example 75 with SolidColor

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");
}
Also used : TreeSeries(com.vaadin.addon.charts.model.TreeSeries) DataLabels(com.vaadin.addon.charts.model.DataLabels) PlotOptionsTreemap(com.vaadin.addon.charts.model.PlotOptionsTreemap) DashStyle(com.vaadin.addon.charts.model.DashStyle) Style(com.vaadin.addon.charts.model.style.Style) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Level(com.vaadin.addon.charts.model.Level) TreeSeriesItem(com.vaadin.addon.charts.model.TreeSeriesItem) Chart(com.vaadin.addon.charts.Chart)

Aggregations

SolidColor (com.vaadin.addon.charts.model.style.SolidColor)82 Configuration (com.vaadin.addon.charts.model.Configuration)55 Chart (com.vaadin.addon.charts.Chart)54 YAxis (com.vaadin.addon.charts.model.YAxis)40 DataSeries (com.vaadin.addon.charts.model.DataSeries)27 ListSeries (com.vaadin.addon.charts.model.ListSeries)26 XAxis (com.vaadin.addon.charts.model.XAxis)26 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)25 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)19 DataLabels (com.vaadin.addon.charts.model.DataLabels)18 Legend (com.vaadin.addon.charts.model.Legend)17 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)15 Marker (com.vaadin.addon.charts.model.Marker)14 Tooltip (com.vaadin.addon.charts.model.Tooltip)14 Style (com.vaadin.addon.charts.model.style.Style)14 Labels (com.vaadin.addon.charts.model.Labels)12 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)11 Random (java.util.Random)10 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)9 PlotOptionsSpline (com.vaadin.addon.charts.model.PlotOptionsSpline)8