Search in sources :

Example 26 with DataLabels

use of com.vaadin.addon.charts.model.DataLabels in project charts by vaadin.

the class Migration method exampleResult.

public Chart exampleResult() {
    Chart chart = new Chart();
    Configuration config = chart.getConfiguration();
    config.setTitle("Charts migration");
    config.getTitle().setAlign(HorizontalAlign.LEFT);
    Crosshair xCrossHair = new Crosshair();
    xCrossHair.setColor(SolidColor.BLACK);
    xCrossHair.setDashStyle(DashStyle.SOLID);
    xCrossHair.setWidth(10);
    xCrossHair.setZIndex(0);
    config.getxAxis().setCrosshair(xCrossHair);
    Crosshair yCrossHair = new Crosshair();
    yCrossHair.setColor(new SolidColor("#880000"));
    yCrossHair.setDashStyle(DashStyle.DOT);
    yCrossHair.setWidth(5);
    yCrossHair.setZIndex(1);
    config.getyAxis().setCrosshair(yCrossHair);
    config.getLegend().setEnabled(false);
    config.getTooltip().setEnabled(false);
    ListSeries ls = new ListSeries();
    ls.setName("Data");
    ls.setData(29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4);
    PlotOptionsAreaspline plotOptions = new PlotOptionsAreaspline();
    plotOptions.setColor(SolidColor.BURLYWOOD);
    plotOptions.setDataLabels(new DataLabels(false));
    ls.setPlotOptions(plotOptions);
    config.setSeries(ls);
    return chart;
}
Also used : DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) ListSeries(com.vaadin.addon.charts.model.ListSeries) Crosshair(com.vaadin.addon.charts.model.Crosshair) PlotOptionsAreaspline(com.vaadin.addon.charts.model.PlotOptionsAreaspline) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Chart(com.vaadin.addon.charts.Chart)

Example 27 with DataLabels

use of com.vaadin.addon.charts.model.DataLabels in project charts by vaadin.

the class ChartExportDemo method createChartConf.

private static Configuration createChartConf() {
    Configuration conf = new Configuration();
    conf.getChart().setType(ChartType.PIE);
    conf.setTitle("Browser market shares at a specific website, 2010");
    PlotOptionsPie plotOptions = new PlotOptionsPie();
    plotOptions.setCursor(Cursor.POINTER);
    DataLabels dataLabels = new DataLabels();
    dataLabels.setEnabled(true);
    dataLabels.setColor(new SolidColor(0, 0, 0));
    dataLabels.setConnectorColor(new SolidColor(0, 0, 0));
    dataLabels.setFormatter("'<b>'+ this.point.name +'</b>: '+ this.percentage +' %'");
    plotOptions.setDataLabels(dataLabels);
    conf.setPlotOptions(plotOptions);
    DataSeries series = new DataSeries();
    series.add(new DataSeriesItem("Firefox", 45.0));
    series.add(new DataSeriesItem("IE", 26.8));
    DataSeriesItem chrome = new DataSeriesItem("Chrome", 12.8);
    chrome.setSliced(true);
    chrome.setSelected(true);
    series.add(chrome);
    series.add(new DataSeriesItem("Safari", 8.5));
    series.add(new DataSeriesItem("Opera", 6.2));
    series.add(new DataSeriesItem("Others", 0.7));
    conf.setSeries(series);
    return conf;
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) DataSeries(com.vaadin.addon.charts.model.DataSeries) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem)

Example 28 with DataLabels

use of com.vaadin.addon.charts.model.DataLabels in project charts by vaadin.

the class ChartTypes method chartTypesSolidGaugePlotoptionsSnippet1.

public void chartTypesSolidGaugePlotoptionsSnippet1() {
    Chart chart = new Chart(ChartType.SOLIDGAUGE);
    Configuration conf = chart.getConfiguration();
    PlotOptionsSolidgauge options = new PlotOptionsSolidgauge();
    // Move the value display box at the center a bit higher
    DataLabels dataLabels = new DataLabels();
    dataLabels.setY(-20);
    options.setDataLabels(dataLabels);
    conf.setPlotOptions(options);
}
Also used : DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsSolidgauge(com.vaadin.addon.charts.model.PlotOptionsSolidgauge) Chart(com.vaadin.addon.charts.Chart)

Example 29 with DataLabels

use of com.vaadin.addon.charts.model.DataLabels in project charts by vaadin.

the class ChartTypes method chartTypesWaterfallPlotoptions.

public void chartTypesWaterfallPlotoptions() {
    // Define the colors
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    final Color balanceColor = SolidColor.BLACK;
    final Color positiveColor = SolidColor.BLUE;
    final Color negativeColor = SolidColor.RED;
    // Configure the colors
    PlotOptionsWaterfall options = new PlotOptionsWaterfall();
    options.setUpColor(positiveColor);
    options.setColor(negativeColor);
    // Configure the labels
    DataLabels labels = new DataLabels(true);
    labels.setVerticalAlign(VerticalAlign.TOP);
    labels.setY(-20);
    labels.setFormatter("Math.floor(this.y/1000) + 'k'");
    Style style = new Style();
    style.setColor(SolidColor.BLACK);
    style.setFontWeight(FontWeight.BOLD);
    labels.setStyle(style);
    options.setDataLabels(labels);
    options.setPointPadding(0);
    conf.setPlotOptions(options);
}
Also used : DataLabels(com.vaadin.addon.charts.model.DataLabels) Configuration(com.vaadin.addon.charts.model.Configuration) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Color(com.vaadin.addon.charts.model.style.Color) GradientColor(com.vaadin.addon.charts.model.style.GradientColor) PlotOptionsWaterfall(com.vaadin.addon.charts.model.PlotOptionsWaterfall) DashStyle(com.vaadin.addon.charts.model.DashStyle) Style(com.vaadin.addon.charts.model.style.Style) Chart(com.vaadin.addon.charts.Chart)

Example 30 with DataLabels

use of com.vaadin.addon.charts.model.DataLabels in project charts by vaadin.

the class PointClickCoordinatesDonutChart method createOuterSeries.

private Series createOuterSeries() {
    DataSeries outerSeries = new DataSeries();
    outerSeries.setName("Versions");
    PlotOptionsPie outerSeriesOptions = new PlotOptionsPie();
    outerSeries.setPlotOptions(outerSeriesOptions);
    outerSeriesOptions.setInnerSize("237px");
    outerSeriesOptions.setSize("318px");
    outerSeriesOptions.setDataLabels(new DataLabels());
    outerSeriesOptions.getDataLabels().setFormatter("this.y > 1 ? '<b>'+ this.point.name +':</b> '+ this.y +'%' : null");
    DataSeriesItem[] outerItems = new DataSeriesItem[] { /* @formatter:off */
    new DataSeriesItem("MSIE 6.0", 10.85, color(0)), new DataSeriesItem("MSIE 7.0", 7.35, color(0)), new DataSeriesItem("MSIE 8.0", 33.06, color(0)), new DataSeriesItem("MSIE 9.0", 2.81, color(0)), new DataSeriesItem("Firefox 2.0", 0.20, color(1)), new DataSeriesItem("Firefox 3.0", 0.83, color(1)), new DataSeriesItem("Firefox 3.5", 1.58, color(1)), new DataSeriesItem("Firefox 3.6", 13.12, color(1)), new DataSeriesItem("Firefox 4.0", 5.43, color(1)), new DataSeriesItem("Chrome 5.0", 0.12, color(2)), new DataSeriesItem("Chrome 6.0", 0.19, color(2)), new DataSeriesItem("Chrome 7.0", 0.12, color(2)), new DataSeriesItem("Chrome 8.0", 0.36, color(2)), new DataSeriesItem("Chrome 9.0", 0.32, color(2)), new DataSeriesItem("Chrome 10.0", 9.91, color(2)), new DataSeriesItem("Chrome 11.0", 0.50, color(2)), new DataSeriesItem("Chrome 12.0", 0.22, color(2)), new DataSeriesItem("Safari 5.0", 4.55, color(3)), new DataSeriesItem("Safari 4.0", 1.42, color(3)), new DataSeriesItem("Safari Win 5.0", 0.23, color(3)), new DataSeriesItem("Safari 4.1", 0.21, color(3)), new DataSeriesItem("Safari/Maxthon", 0.20, color(3)), new DataSeriesItem("Safari 3.1", 0.19, color(3)), new DataSeriesItem("Safari 4.1", 0.14, color(3)), new DataSeriesItem("Opera 9.x", 0.12, color(4)), new DataSeriesItem("Opera 10.x", 0.37, color(4)), new DataSeriesItem("Opera 11.x", 1.65, color(4)) /* @formatter:on */
    };
    outerSeries.setData(Arrays.asList(outerItems));
    return outerSeries;
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) DataLabels(com.vaadin.addon.charts.model.DataLabels) DataSeries(com.vaadin.addon.charts.model.DataSeries) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem)

Aggregations

DataLabels (com.vaadin.addon.charts.model.DataLabels)53 Chart (com.vaadin.addon.charts.Chart)46 Configuration (com.vaadin.addon.charts.model.Configuration)43 YAxis (com.vaadin.addon.charts.model.YAxis)31 DataSeries (com.vaadin.addon.charts.model.DataSeries)24 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)20 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)19 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)18 ListSeries (com.vaadin.addon.charts.model.ListSeries)17 XAxis (com.vaadin.addon.charts.model.XAxis)17 PlotOptionsPie (com.vaadin.addon.charts.model.PlotOptionsPie)13 Tooltip (com.vaadin.addon.charts.model.Tooltip)13 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)12 Style (com.vaadin.addon.charts.model.style.Style)11 Legend (com.vaadin.addon.charts.model.Legend)9 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)9 Labels (com.vaadin.addon.charts.model.Labels)6 Series (com.vaadin.addon.charts.model.Series)6 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)6 DrilldownCallback (com.vaadin.addon.charts.DrilldownCallback)4