Search in sources :

Example 16 with PlotOptionsArea

use of com.vaadin.addon.charts.model.PlotOptionsArea in project charts by vaadin.

the class PolarChart method getChart.

@Override
protected Component getChart() {
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    conf.getChart().setPolar(true);
    conf.setTitle("Polar Chart");
    Pane pane = new Pane(0, 360);
    conf.addPane(pane);
    pane.setBackground(new Background[] {});
    XAxis axis = new XAxis();
    axis.setTickInterval(45);
    axis.setMin(0);
    axis.setMax(360);
    Labels labels = new Labels();
    labels.setFormatter("function() {return this.value + '°';}");
    axis.setLabels(labels);
    YAxis yaxs = new YAxis();
    yaxs.setMin(0);
    conf.addxAxis(axis);
    conf.addyAxis(yaxs);
    PlotOptionsSeries series = new PlotOptionsSeries();
    PlotOptionsColumn column = new PlotOptionsColumn();
    series.setPointStart(0);
    series.setPointInterval(45);
    column.setPointPadding(0);
    column.setGroupPadding(0);
    conf.setPlotOptions(series, column);
    ListSeries col = new ListSeries(8, 7, 6, 5, 4, 3, 2, 1);
    ListSeries line = new ListSeries(1, 2, 3, 4, 5, 6, 7, 8);
    ListSeries area = new ListSeries(1, 8, 2, 7, 3, 6, 4, 5);
    col.setPlotOptions(new PlotOptionsColumn());
    col.setName(ChartType.COLUMN.toString());
    line.setPlotOptions(new PlotOptionsLine());
    line.setName(ChartType.LINE.toString());
    area.setPlotOptions(new PlotOptionsArea());
    area.setName(ChartType.AREA.toString());
    conf.setSeries(col, line, area);
    chart.drawChart(conf);
    return chart;
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsColumn(com.vaadin.addon.charts.model.PlotOptionsColumn) ListSeries(com.vaadin.addon.charts.model.ListSeries) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine) PlotOptionsArea(com.vaadin.addon.charts.model.PlotOptionsArea) Labels(com.vaadin.addon.charts.model.Labels) Pane(com.vaadin.addon.charts.model.Pane) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) PlotOptionsSeries(com.vaadin.addon.charts.model.PlotOptionsSeries) YAxis(com.vaadin.addon.charts.model.YAxis)

Example 17 with PlotOptionsArea

use of com.vaadin.addon.charts.model.PlotOptionsArea 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 18 with PlotOptionsArea

use of com.vaadin.addon.charts.model.PlotOptionsArea in project charts by vaadin.

the class ChartDesignWriterTest method writeConfiguration_plotOptionsWithReservedWord_prefixIsWrittenToReservedTagName.

@Test
public void writeConfiguration_plotOptionsWithReservedWord_prefixIsWrittenToReservedTagName() {
    DesignContext designContext = new DesignContext();
    Configuration configuration = new Configuration();
    PlotOptionsArea plotOptionsArea = new PlotOptionsArea();
    plotOptionsArea.setAnimation(false);
    configuration.addPlotOptions(plotOptionsArea);
    Element parent = new Element(Tag.valueOf("test"), "");
    ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
    assertEquals("<plot-options><chart-area animation=\"false\"></chart-area></plot-options>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsArea(com.vaadin.addon.charts.model.PlotOptionsArea) Element(org.jsoup.nodes.Element) DesignContext(com.vaadin.ui.declarative.DesignContext) Test(org.junit.Test)

Aggregations

PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)18 Configuration (com.vaadin.addon.charts.model.Configuration)16 Chart (com.vaadin.addon.charts.Chart)15 YAxis (com.vaadin.addon.charts.model.YAxis)13 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)11 ListSeries (com.vaadin.addon.charts.model.ListSeries)11 Marker (com.vaadin.addon.charts.model.Marker)9 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)9 XAxis (com.vaadin.addon.charts.model.XAxis)8 Hover (com.vaadin.addon.charts.model.Hover)7 Title (com.vaadin.addon.charts.model.Title)7 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)7 States (com.vaadin.addon.charts.model.States)5 Labels (com.vaadin.addon.charts.model.Labels)4 Subtitle (com.vaadin.addon.charts.model.Subtitle)4 Tooltip (com.vaadin.addon.charts.model.Tooltip)4 Legend (com.vaadin.addon.charts.model.Legend)3 ParseException (java.text.ParseException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 PlotBand (com.vaadin.addon.charts.model.PlotBand)2