Search in sources :

Example 6 with SeriesTooltip

use of com.vaadin.addon.charts.model.SeriesTooltip 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;
}
Also used : DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) HeatSeries(com.vaadin.addon.charts.model.HeatSeries) PlotOptionsHeatmap(com.vaadin.addon.charts.model.PlotOptionsHeatmap) Chart(com.vaadin.addon.charts.Chart) SeriesTooltip(com.vaadin.addon.charts.model.SeriesTooltip)

Aggregations

SeriesTooltip (com.vaadin.addon.charts.model.SeriesTooltip)6 Chart (com.vaadin.addon.charts.Chart)5 Configuration (com.vaadin.addon.charts.model.Configuration)5 Labels (com.vaadin.addon.charts.model.Labels)4 YAxis (com.vaadin.addon.charts.model.YAxis)4 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)4 DataLabels (com.vaadin.addon.charts.model.DataLabels)3 ListSeries (com.vaadin.addon.charts.model.ListSeries)3 Random (java.util.Random)3 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)2 Background (com.vaadin.addon.charts.model.Background)2 PlotOptionsGauge (com.vaadin.addon.charts.model.PlotOptionsGauge)2 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)2 DataSeries (com.vaadin.addon.charts.model.DataSeries)1 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)1 HeatSeries (com.vaadin.addon.charts.model.HeatSeries)1 Pane (com.vaadin.addon.charts.model.Pane)1 PlotBand (com.vaadin.addon.charts.model.PlotBand)1 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)1 PlotOptionsErrorbar (com.vaadin.addon.charts.model.PlotOptionsErrorbar)1