Search in sources :

Example 6 with Options3d

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

the class ThreeDAxisConfiguration method createScatterChart.

private Chart createScatterChart() {
    final Chart scatterChart = new Chart(ChartType.SCATTER);
    scatterChart.setWidth("450px");
    scatterChart.setId("chart");
    scatterChart.getConfiguration().disableCredits();
    scatterChart.getConfiguration().setTitle("Points of a sphere");
    PlotOptionsScatter scatterOptions = new PlotOptionsScatter();
    scatterOptions.setAnimation(false);
    scatterOptions.setPointStart(1);
    DataSeries higherX = new DataSeries();
    higherX.setName("Higher X");
    DataSeries higherY = new DataSeries();
    higherY.setName("Higher Y");
    DataSeries higherZ = new DataSeries();
    higherZ.setName("Higher Z");
    fillSeries(higherX, higherY, higherZ);
    scatterChart.getConfiguration().addSeries(higherX);
    scatterChart.getConfiguration().addSeries(higherY);
    scatterChart.getConfiguration().addSeries(higherZ);
    XAxis x = scatterChart.getConfiguration().getxAxis();
    x.setGridLineWidth(1);
    x.setExtremes(-3, 3);
    if (getCurrentTheme().getxAxis().getGridLineColor() != null) {
        x.setGridLineColor(getCurrentTheme().getxAxis().getGridLineColor());
    }
    setAxisConfiguration(scatterChart.getConfiguration().getxAxis());
    setAxisConfiguration(scatterChart.getConfiguration().getyAxis());
    setAxisConfiguration(scatterChart.getConfiguration().getzAxis());
    Options3d options3d = new Options3d();
    options3d.setEnabled(true);
    options3d.setAlpha(10);
    options3d.setBeta(60);
    options3d.setDepth(200);
    options3d.setViewDistance(40);
    Frame frame = new Frame();
    Bottom bottom = new Bottom();
    bottom.setSize(1);
    frame.setBottom(bottom);
    options3d.setFrame(frame);
    scatterChart.getConfiguration().getChart().setOptions3d(options3d);
    scatterChart.drawChart();
    return scatterChart;
}
Also used : Frame(com.vaadin.addon.charts.model.Frame) PlotOptionsScatter(com.vaadin.addon.charts.model.PlotOptionsScatter) Bottom(com.vaadin.addon.charts.model.Bottom) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) Options3d(com.vaadin.addon.charts.model.Options3d)

Example 7 with Options3d

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

the class PointClickCoordinatesScatterChart method createChart.

@Override
protected Chart createChart() {
    Chart chart = super.createChart();
    Configuration conf = chart.getConfiguration();
    XAxis x = conf.getxAxis();
    x.setGridLineWidth(1);
    x.setExtremes(-3, 3);
    if (getCurrentTheme().getxAxis().getGridLineColor() != null) {
        x.setGridLineColor(getCurrentTheme().getxAxis().getGridLineColor());
    }
    YAxis y = conf.getyAxis();
    y.setExtremes(-1, 1);
    ZAxis z = conf.getzAxis();
    z.setMin(-1);
    z.setMax(1);
    Options3d options3d = new Options3d();
    options3d.setEnabled(true);
    options3d.setAlpha(10);
    options3d.setBeta(30);
    options3d.setDepth(80);
    options3d.setViewDistance(40);
    Frame frame = new Frame();
    Bottom bottom = new Bottom();
    bottom.setSize(1);
    frame.setBottom(bottom);
    options3d.setFrame(frame);
    conf.getChart().setOptions3d(options3d);
    chart.drawChart();
    return chart;
}
Also used : Frame(com.vaadin.addon.charts.model.Frame) Configuration(com.vaadin.addon.charts.model.Configuration) ZAxis(com.vaadin.addon.charts.model.ZAxis) Bottom(com.vaadin.addon.charts.model.Bottom) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) Options3d(com.vaadin.addon.charts.model.Options3d) YAxis(com.vaadin.addon.charts.model.YAxis)

Example 8 with Options3d

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

the class Basic3DColumnWithGradientBackground method getChart.

@Override
protected Component getChart() {
    Chart chart = new Chart(ChartType.COLUMN);
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Monthly Average Rainfall");
    conf.setSubTitle("Source: WorldClimate.com");
    XAxis x = new XAxis();
    x.setCategories(new String[] { "Jan", "Feb", "Mar", "Apr" });
    conf.addxAxis(x);
    YAxis y = new YAxis();
    y.setMin(0);
    y.setTitle("Rainfall (mm)");
    conf.addyAxis(y);
    Tooltip tooltip = new Tooltip();
    tooltip.setFormatter("this.x +': '+ this.y +' mm'");
    conf.setTooltip(tooltip);
    PlotOptionsColumn plot = new PlotOptionsColumn();
    plot.setPointPadding(0.2);
    plot.setBorderWidth(0);
    plot.setGroupZPadding(10);
    conf.setPlotOptions(plot);
    Options3d options3d = new Options3d();
    options3d.setEnabled(true);
    options3d.setAlpha(5);
    options3d.setBeta(30);
    options3d.setDepth(100);
    options3d.setViewDistance(200);
    Frame frame = new Frame();
    options3d.setFrame(frame);
    frame.setBack(new Back());
    GradientColor c = GradientColor.createLinear(0, 0, 1, 0);
    c.addColorStop(0, SolidColor.RED);
    c.addColorStop(1, SolidColor.AQUAMARINE);
    frame.getBack().setColor(c);
    frame.getBack().setSize(1);
    conf.getChart().setOptions3d(options3d);
    conf.addSeries(new ListSeries("Tokyo", 49.9, 71.5, 106.4, 129.2));
    chart.drawChart(conf);
    return chart;
}
Also used : Frame(com.vaadin.addon.charts.model.Frame) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsColumn(com.vaadin.addon.charts.model.PlotOptionsColumn) GradientColor(com.vaadin.addon.charts.model.style.GradientColor) ListSeries(com.vaadin.addon.charts.model.ListSeries) Tooltip(com.vaadin.addon.charts.model.Tooltip) Back(com.vaadin.addon.charts.model.Back) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) Options3d(com.vaadin.addon.charts.model.Options3d) YAxis(com.vaadin.addon.charts.model.YAxis)

Example 9 with Options3d

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

the class BasicUse method basicUse3dDataSnippet1.

public void basicUse3dDataSnippet1() {
    Chart chart = new Chart(ChartType.PIE);
    Configuration conf = chart.getConfiguration();
    Options3d options3d = new Options3d();
    double[][] points = { // x, y, z
    { 0.0, 0.0, 0.0 }, { 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0 }, { -1.0, 0.0, 0.0 }, { 0.0, -1.0, 0.0 }, { 0.0, 0.0, -1.0 } };
    DataSeries series = new DataSeries();
    for (int i = 0; i < points.length; i++) {
        double x = points[i][0];
        double y = points[i][1];
        double z = points[i][2];
        // Scale the depth coordinate, as the depth axis is
        // not scaled automatically
        DataSeriesItem3d item = new DataSeriesItem3d(x, y, z * options3d.getDepth().doubleValue());
        series.add(item);
    }
    conf.addSeries(series);
}
Also used : DataSeriesItem3d(com.vaadin.addon.charts.model.DataSeriesItem3d) Configuration(com.vaadin.addon.charts.model.Configuration) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart) Options3d(com.vaadin.addon.charts.model.Options3d)

Example 10 with Options3d

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

the class BasicUse method basicUse3dSnippet1.

public void basicUse3dSnippet1() {
    Chart chart = new Chart(ChartType.SCATTER);
    Configuration conf = chart.getConfiguration();
    // In 3D!
    Options3d options3d = new Options3d();
    options3d.setEnabled(true);
    options3d.setAlpha(10);
    options3d.setBeta(30);
    // Default is 100
    options3d.setDepth(135);
    // Default
    options3d.setViewDistance(100);
    conf.getChart().setOptions3d(options3d);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart) Options3d(com.vaadin.addon.charts.model.Options3d)

Aggregations

Options3d (com.vaadin.addon.charts.model.Options3d)10 Chart (com.vaadin.addon.charts.Chart)8 Configuration (com.vaadin.addon.charts.model.Configuration)6 Frame (com.vaadin.addon.charts.model.Frame)6 DataSeries (com.vaadin.addon.charts.model.DataSeries)5 XAxis (com.vaadin.addon.charts.model.XAxis)5 YAxis (com.vaadin.addon.charts.model.YAxis)4 Bottom (com.vaadin.addon.charts.model.Bottom)3 Back (com.vaadin.addon.charts.model.Back)2 DataSeriesItem3d (com.vaadin.addon.charts.model.DataSeriesItem3d)2 ListSeries (com.vaadin.addon.charts.model.ListSeries)2 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)2 PlotOptionsScatter (com.vaadin.addon.charts.model.PlotOptionsScatter)2 Tooltip (com.vaadin.addon.charts.model.Tooltip)2 ZAxis (com.vaadin.addon.charts.model.ZAxis)2 PointClickEvent (com.vaadin.addon.charts.PointClickEvent)1 PointClickListener (com.vaadin.addon.charts.PointClickListener)1 DataLabels (com.vaadin.addon.charts.model.DataLabels)1 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)1 Marker (com.vaadin.addon.charts.model.Marker)1