use of com.vaadin.addon.charts.model.PlotOptionsArea in project charts by vaadin.
the class ContainerWithLotsOfData method createChart.
public static Chart createChart(Series container) {
final Chart chart = new Chart();
final Configuration configuration = chart.getConfiguration();
configuration.getChart().setType(ChartType.AREA);
configuration.getTitle().setText("Data from Vaadin Container");
configuration.getLegend().setEnabled(false);
YAxis yAxis = configuration.getyAxis();
yAxis.setTitle(new AxisTitle("Exchange rate"));
yAxis.setMin(0.6);
yAxis.setStartOnTick(false);
yAxis.setShowFirstLabel(false);
configuration.getTooltip().setShared(true);
PlotOptionsArea plotOptions = new PlotOptionsArea();
GradientColor fillColor = GradientColor.createLinear(0, 0, 0, 1);
fillColor.addColorStop(0, new SolidColor("#4572A7"));
fillColor.addColorStop(1, new SolidColor(2, 0, 0, 0));
plotOptions.setFillColor(fillColor);
plotOptions.setLineWidth(1);
plotOptions.setShadow(false);
Marker marker = plotOptions.getMarker();
marker.setEnabled(false);
Hover hoverState = new Hover(true);
hoverState.setRadius(5);
hoverState.setLineWidth(1);
marker.getStates().setHover(hoverState);
plotOptions.getStates().setHover(new Hover(true));
plotOptions.setShadow(false);
configuration.setPlotOptions(plotOptions);
configuration.setSeries(container);
chart.drawChart(configuration);
return chart;
}
use of com.vaadin.addon.charts.model.PlotOptionsArea in project charts by vaadin.
the class ChartWithExternalDataProviderWithChangingData method createChart.
public static Chart createChart(Series ds) {
final Chart chart = new Chart(ChartType.AREA);
final Configuration configuration = chart.getConfiguration();
configuration.getTitle().setText("Data from Vaadin DataProvider");
configuration.getLegend().setEnabled(false);
YAxis yAxis = configuration.getyAxis();
yAxis.setTitle(new AxisTitle("Data values"));
yAxis.setMin(0.6);
yAxis.setStartOnTick(false);
yAxis.setShowFirstLabel(false);
configuration.getTooltip().setShared(true);
PlotOptionsArea plotOptions = new PlotOptionsArea();
GradientColor fillColor = GradientColor.createLinear(0, 0, 0, 1);
fillColor.addColorStop(0, new SolidColor("#4572A7"));
fillColor.addColorStop(1, new SolidColor(2, 0, 0, 0));
plotOptions.setFillColor(fillColor);
plotOptions.setLineWidth(1);
plotOptions.setShadow(false);
Marker marker = plotOptions.getMarker();
marker.setEnabled(false);
Hover hoverState = new Hover(true);
hoverState.setRadius(5);
hoverState.setLineWidth(1);
marker.getStates().setHover(hoverState);
plotOptions.getStates().setHover(new Hover(true));
plotOptions.setShadow(false);
configuration.setPlotOptions(plotOptions);
configuration.setSeries(ds);
chart.drawChart(configuration);
return chart;
}
use of com.vaadin.addon.charts.model.PlotOptionsArea in project charts by vaadin.
the class DataProviderWithLotsOfData method createChart.
public static Chart createChart(Series ds) {
final Chart chart = new Chart(ChartType.AREA);
final Configuration configuration = chart.getConfiguration();
configuration.getTitle().setText("Data from Vaadin DataProvider");
configuration.getLegend().setEnabled(false);
YAxis yAxis = configuration.getyAxis();
yAxis.setTitle(new AxisTitle("Exchange rate"));
yAxis.setMin(0.6);
yAxis.setStartOnTick(false);
yAxis.setShowFirstLabel(false);
configuration.getTooltip().setShared(true);
PlotOptionsArea plotOptions = new PlotOptionsArea();
GradientColor fillColor = GradientColor.createLinear(0, 0, 0, 1);
fillColor.addColorStop(0, new SolidColor("#4572A7"));
fillColor.addColorStop(1, new SolidColor(2, 0, 0, 0));
plotOptions.setFillColor(fillColor);
plotOptions.setLineWidth(1);
plotOptions.setShadow(false);
Marker marker = plotOptions.getMarker();
marker.setEnabled(false);
Hover hoverState = new Hover(true);
hoverState.setRadius(5);
hoverState.setLineWidth(1);
marker.getStates().setHover(hoverState);
plotOptions.getStates().setHover(new Hover(true));
plotOptions.setShadow(false);
configuration.setPlotOptions(plotOptions);
configuration.setSeries(ds);
chart.drawChart(configuration);
return chart;
}
use of com.vaadin.addon.charts.model.PlotOptionsArea in project charts by vaadin.
the class ColoredContainerSeries method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.AREA);
Configuration conf = chart.getConfiguration();
conf.setTitle(new Title("Colored ContainerDataSeries"));
conf.addxAxis(new XAxis());
YAxis yAxis = new YAxis();
yAxis.setTitle("Numbers");
conf.addyAxis(yAxis);
Collection<Test> col = new ArrayList<>();
col.add(new Test(10, "TEN"));
col.add(new Test(11, "ELEVEN"));
col.add(new Test(12, "TWELVE"));
DataProvider<Test, ?> ds = new ListDataProvider<>(col);
DataProviderSeries<Test> chartDS = new DataProviderSeries<>(ds);
chartDS.setName("Test Series");
chartDS.setY(Test::getNumber);
chartDS.setPointName(Test::getName);
PlotOptionsArea plotOptions = new PlotOptionsArea();
plotOptions.setFillColor(SolidColor.CORNFLOWERBLUE);
plotOptions.setColor(SolidColor.GOLDENROD);
chartDS.setPlotOptions(plotOptions);
// conf.setPlotOptions(plotOptions);
conf.setSeries(chartDS);
chart.drawChart(conf);
return chart;
}
use of com.vaadin.addon.charts.model.PlotOptionsArea in project charts by vaadin.
the class ContainerWithLotsOfData method createContainer.
@SuppressWarnings("unchecked")
private ContainerDataSeries createContainer() {
IndexedContainer vaadinContainer = new IndexedContainer();
ContainerDataSeries container = new ContainerDataSeries(vaadinContainer);
vaadinContainer.addContainerProperty("y", Number.class, null);
for (int i = 0; i < getContainerData().length; i++) {
Item item = vaadinContainer.addItem(i);
item.getItemProperty("y").setValue(getContainerData()[i]);
}
container.setName("USD to EUR");
container.setPlotOptions(new PlotOptionsArea());
container.setYPropertyId("y");
return container;
}
Aggregations