use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class ChartTypes method chartTypePolarSnippet2.
public void chartTypePolarSnippet2() {
Chart chart = new Chart(ChartType.LINE);
// Enable the polar projection
Configuration conf = chart.getConfiguration();
// Define the sector of the polar projection
// Full circle
Pane pane = new Pane(0, 360);
conf.addPane(pane);
// Define the X axis and set its value range
XAxis axis = new XAxis();
axis.setMin(0);
axis.setMax(360);
}
use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class ChartTypes method chartTypesHeatMap.
public void chartTypesHeatMap() {
Chart chart = new Chart(ChartType.HEATMAP);
chart.setWidth("600px");
chart.setHeight("300px");
Configuration conf = chart.getConfiguration();
conf.setTitle("Heat Data");
// Set colors for the extremes
conf.getColorAxis().setMinColor(SolidColor.AQUA);
conf.getColorAxis().setMaxColor(SolidColor.RED);
// Set up border and data labels
PlotOptionsHeatmap plotOptions = new PlotOptionsHeatmap();
plotOptions.setBorderColor(SolidColor.WHITE);
plotOptions.setBorderWidth(2);
plotOptions.setDataLabels(new DataLabels(true));
conf.setPlotOptions(plotOptions);
// Create some data
HeatSeries series = new HeatSeries();
// Jan High
series.addHeatPoint(0, 0, 10.9);
// Jan Low
series.addHeatPoint(0, 1, -51.5);
// Feb High
series.addHeatPoint(1, 0, 11.8);
// Dec Low
series.addHeatPoint(11, 1, -47.0);
conf.addSeries(series);
// Set the category labels on the X axis
XAxis xaxis = new XAxis();
xaxis.setTitle("Month");
xaxis.setCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
conf.addxAxis(xaxis);
// Set the category labels on the Y axis
YAxis yaxis = new YAxis();
yaxis.setTitle("");
yaxis.setCategories("High C", "Low C");
conf.addyAxis(yaxis);
}
use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class ChartTypes method chartTypesBubbleSnippet1.
public void chartTypesBubbleSnippet1() {
// Create a bubble chart
Chart chart = new Chart(ChartType.BUBBLE);
chart.setWidth("640px");
chart.setHeight("350px");
// Modify the default configuration a bit
Configuration conf = chart.getConfiguration();
conf.setTitle("Champagne Consumption by Country");
// Disable legend
conf.getLegend().setEnabled(false);
conf.getTooltip().setFormatter("this.point.name + ': ' + " + "Math.round(100*(this.point.z * this.point.z))/100.0 + " + "' M bottles'");
// World map as background
String url = VaadinServlet.getCurrent().getServletContext().getContextPath() + "/VAADIN/themes/mytheme/img/map.png";
conf.getChart().setPlotBackgroundImage(url);
// Show more bubbly bubbles with spherical color gradient
PlotOptionsBubble plotOptions = new PlotOptionsBubble();
Marker marker = new Marker();
GradientColor color = GradientColor.createRadial(0.4, 0.3, 0.7);
color.addColorStop(0.0, new SolidColor(255, 255, 255, 0.5));
color.addColorStop(1.0, new SolidColor(170, 70, 67, 0.5));
marker.setFillColor(color);
plotOptions.setMarker(marker);
conf.setPlotOptions(plotOptions);
// Source: CIVC - Les expeditions de vins de Champagne en 2011
DataSeries series = new DataSeries("Countries");
Object[][] data = { { "France", 181.6 }, { "United Kingdom", 34.53 }, { "United States", 19.37 } };
for (Object[] country : data) {
String name = (String) country[0];
double amount = (Double) country[1];
Coordinate pos = new Coordinate();
DataSeriesItem3d item = new DataSeriesItem3d();
item.setX(pos.longitude * Math.cos(pos.latitude / 2.0 * (Math.PI / 160)));
item.setY(pos.latitude * 1.2);
item.setZ(Math.sqrt(amount));
item.setName(name);
series.add(item);
}
conf.addSeries(series);
// Set the category labels on the axis correspondingly
XAxis xaxis = new XAxis();
xaxis.setExtremes(-180, 180);
conf.addxAxis(xaxis);
// Set the Y axis title
YAxis yaxis = new YAxis();
yaxis.setExtremes(-90, 90);
conf.addyAxis(yaxis);
}
use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class ChartTypes method chartTypeSpiderWebSnippet1.
public void chartTypeSpiderWebSnippet1() {
Chart chart = new Chart(ChartType.LINE);
// Modify the default configuration a bit
Configuration conf = chart.getConfiguration();
conf.getChart().setPolar(true);
// Create the range series
// Source: http://ilmatieteenlaitos.fi/lampotilaennatyksia
ListSeries series = new ListSeries("Temperature Extremes", 10.9, 11.8, 17.5, 25.5, 31.0, 33.8, 37.2, 33.8, 28.8, 19.4, 14.1, 10.8);
conf.addSeries(series);
// Set the category labels on the X axis correspondingly
XAxis xaxis = new XAxis();
xaxis.setCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
xaxis.setTickmarkPlacement(TickmarkPlacement.ON);
xaxis.setLineWidth(0);
conf.addxAxis(xaxis);
// Configure the Y axis
YAxis yaxis = new YAxis();
// Webby look
yaxis.setGridLineInterpolation("polygon");
yaxis.setMin(0);
yaxis.setTickInterval(10);
yaxis.getLabels().setStep(1);
conf.addyAxis(yaxis);
}
use of com.vaadin.addon.charts.model.XAxis in project charts by vaadin.
the class ConfigurationTest method setup.
@Before
public void setup() {
ListSeries row1 = new ListSeries("row1", 1, 2);
ListSeries row2 = new ListSeries("row2", 4, 5);
ListSeries row3 = new ListSeries("row3", 7, 8);
ListSeries row4 = new ListSeries("row4", 10, 11);
String[] cols = { "col1", "col2" };
Chart chart = new Chart(ChartType.COLUMN);
conf = chart.getConfiguration();
XAxis axis = new XAxis();
axis.setCategories(cols);
conf.addxAxis(axis);
conf.setSeries(row1, row2, row3, row4);
}
Aggregations