use of com.vaadin.addon.charts.model.YAxis in project charts by vaadin.
the class GettingStarted method addColumnsSnippet2.
public void addColumnsSnippet2(List<WeatherInfo> weatherInfo, DataProviderSeries<WeatherInfo> humidity, Configuration conf) {
YAxis humidityYAxis = new YAxis();
humidityYAxis.setTitle("Humidity (%)");
humidityYAxis.setMin(0);
humidityYAxis.setOpposite(true);
conf.addyAxis(humidityYAxis);
humidity.setyAxis(humidityYAxis);
}
use of com.vaadin.addon.charts.model.YAxis in project charts by vaadin.
the class ChartConfiguration method formattingSnippet1.
public void formattingSnippet1(Configuration configuration) {
YAxis yaxis = new YAxis();
Labels ylabels = yaxis.getLabels();
ylabels.setFormatter("function() {return this.value + ' km';}");
}
use of com.vaadin.addon.charts.model.YAxis in project charts by vaadin.
the class ChartTypes method chartTypesGaugeAxisSnippet1.
public void chartTypesGaugeAxisSnippet1() {
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
YAxis yaxis = new YAxis();
yaxis.setTitle("km/h");
// The limits are mandatory
yaxis.setMin(0);
yaxis.setMax(100);
// Other configuration
yaxis.getLabels().setStep(1);
yaxis.setTickInterval(10);
yaxis.setTickLength(10);
yaxis.setTickWidth(1);
yaxis.setMinorTickInterval("1");
yaxis.setMinorTickLength(5);
yaxis.setMinorTickWidth(1);
yaxis.setPlotBands(new PlotBand[] { new PlotBand(0, 60, SolidColor.GREEN), new PlotBand(60, 80, SolidColor.YELLOW), new PlotBand(80, 100, SolidColor.RED) });
// Disable grid
yaxis.setGridLineWidth(0);
conf.addyAxis(yaxis);
}
use of com.vaadin.addon.charts.model.YAxis in project charts by vaadin.
the class ChartTypes method chartTypesWaterfall.
public void chartTypesWaterfall() {
Chart chart = new Chart(ChartType.WATERFALL);
chart.setWidth("500px");
chart.setHeight("350px");
// Modify the default configuration a bit
Configuration conf = chart.getConfiguration();
conf.setTitle("Changes in Reindeer Population in 2011");
conf.getLegend().setEnabled(false);
// Configure X axis
XAxis xaxis = new XAxis();
xaxis.setCategories("Start", "Predators", "Slaughter", "Reproduction", "End");
conf.addxAxis(xaxis);
// Configure Y axis
YAxis yaxis = new YAxis();
yaxis.setTitle("Population (thousands)");
conf.addyAxis(yaxis);
}
use of com.vaadin.addon.charts.model.YAxis in project charts by vaadin.
the class MasterDetailChart method getMasterChart.
private Chart getMasterChart() {
Chart masterChart = new Chart(ChartType.AREA);
masterChart.setHeight("80px");
masterChart.setWidth("100%");
masterChart.setId("master-chart");
Configuration configuration = masterChart.getConfiguration();
configuration.getChart().setZoomType(ZoomType.X);
configuration.getChart().setReflow(false);
configuration.getChart().setBorderWidth(0);
configuration.getChart().setBackgroundColor(null);
configuration.getChart().setMarginLeft(50);
configuration.getChart().setMarginRight(20);
configuration.getTitle().setText("");
configuration.getxAxis().setType(AxisType.DATETIME);
configuration.getxAxis().setShowLastLabel(true);
configuration.getxAxis().setMinRange(14 * DAY_IN_MILLIS);
configuration.getxAxis().setTitle(new AxisTitle(""));
PlotBand mask = new PlotBand();
mask.setColor(new SolidColor(0, 0, 0, 0.2));
mask.setFrom(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
mask.setTo(Util.toHighchartsTS(DEMO_DATASET_END.atStartOfDay().toInstant(ZoneOffset.UTC)));
configuration.getxAxis().setPlotBands(mask);
YAxis yAxis = configuration.getyAxis();
yAxis.setGridLineWidth(0);
yAxis.setLabels(new Labels(false));
yAxis.setTitle(new AxisTitle(""));
yAxis.setMin(0.6);
yAxis.setShowFirstLabel(false);
configuration.getTooltip().setEnabled(false);
configuration.getLegend().setEnabled(false);
configuration.getCredits().setEnabled(false);
PlotOptionsArea plotOptions = new PlotOptionsArea();
plotOptions.setLineWidth(1);
plotOptions.setShadow(false);
Hover hover = new Hover();
hover.setLineWidth(1);
States states = new States();
states.setHover(hover);
plotOptions.setStates(states);
plotOptions.setEnableMouseTracking(false);
plotOptions.setAnimation(false);
configuration.setPlotOptions(plotOptions);
ListSeries ls = new ListSeries();
PlotOptionsArea masterPlotOptions = new PlotOptionsArea();
GradientColor fillColor = GradientColor.createLinear(0, 0, 0, 1);
fillColor.addColorStop(0, new SolidColor(69, 114, 167, 1));
fillColor.addColorStop(1, new SolidColor(69, 114, 167, 0.5));
masterPlotOptions.setFillColor(fillColor);
masterPlotOptions.setPointInterval(24 * 3600 * 1000);
masterPlotOptions.setMarker(new Marker(false));
masterPlotOptions.setPointStart(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
ls.setPlotOptions(masterPlotOptions);
ls.setName("USD to EUR");
ls.setData(FULL_DEMO_DATA_SET);
configuration.addSeries(ls);
masterChart.drawChart(configuration);
return masterChart;
}
Aggregations