use of com.vaadin.addon.charts.model.PlotOptionsHeatmap in project charts by vaadin.
the class PlotOptionsJSONSerializationTest method toString_heatMapTurboThresholdIsSet_plotOptionsSerializedWithTurboThreshold.
@Test
public void toString_heatMapTurboThresholdIsSet_plotOptionsSerializedWithTurboThreshold() {
PlotOptionsHeatmap plotOptions = new PlotOptionsHeatmap();
plotOptions.setTurboThreshold(0);
String json = toJSON(plotOptions);
String expected = "{\"turboThreshold\":0}";
assertEquals(expected, json);
}
use of com.vaadin.addon.charts.model.PlotOptionsHeatmap 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.PlotOptionsHeatmap in project charts by vaadin.
the class HeatMapExample method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart();
Configuration config = chart.getConfiguration();
config.getChart().setType(ChartType.HEATMAP);
config.getChart().setMarginTop(40);
config.getChart().setMarginBottom(40);
config.getTitle().setText("Sales per employee per weekday");
config.getxAxis().setCategories("Marta", "Mysia", "Misiek", "Maniek", "Miki", "Guillermo", "Jonatan", "Zdzisław", "Antoni", "Zygmunt");
config.getyAxis().setCategories("Monday", "Tuesday", "Wednesday", "Thursday", "Friday");
config.getColorAxis().setMin(0);
config.getColorAxis().setMinColor(SolidColor.WHITE);
config.getColorAxis().setMaxColor(getThemeColors()[0]);
config.getLegend().setLayout(LayoutDirection.VERTICAL);
config.getLegend().setAlign(HorizontalAlign.RIGHT);
config.getLegend().setMargin(0);
config.getLegend().setVerticalAlign(VerticalAlign.TOP);
config.getLegend().setY(25);
config.getLegend().setSymbolHeight(320);
HeatSeries rs = new HeatSeries("Sales per employee", getRawData());
PlotOptionsHeatmap plotOptionsHeatmap = new PlotOptionsHeatmap();
plotOptionsHeatmap.setDataLabels(new DataLabels());
plotOptionsHeatmap.getDataLabels().setEnabled(true);
SeriesTooltip tooltip = new SeriesTooltip();
tooltip.setHeaderFormat("{series.name}<br/>");
tooltip.setPointFormat("Amount: <b>{point.value}</b> ");
plotOptionsHeatmap.setTooltip(tooltip);
config.setPlotOptions(plotOptionsHeatmap);
config.setSeries(rs);
chart.drawChart(config);
return chart;
}
Aggregations