Search in sources :

Example 11 with Marker

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

the class BasicUse method basicUsePlotOptionsSnippet1.

public void basicUsePlotOptionsSnippet1() {
    Chart chart = new Chart(ChartType.COLUMN);
    Configuration conf = chart.getConfiguration();
    PlotOptionsLine plotOptions = new PlotOptionsLine();
    plotOptions.setMarker(new Marker(false));
    conf.setPlotOptions(plotOptions);
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine) Marker(com.vaadin.addon.charts.model.Marker) Chart(com.vaadin.addon.charts.Chart)

Example 12 with Marker

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

the class Sparkline method configureAsSparkline.

protected void configureAsSparkline() {
    getConfiguration().setTitle("");
    getConfiguration().setLegend(new Legend(false));
    getConfiguration().getChart().setBackgroundColor(new SolidColor(0, 0, 0, 0));
    getConfiguration().getChart().setMargin(0);
    Series series = getConfiguration().getSeries().get(0);
    PlotOptionsLine options = new PlotOptionsLine();
    options.setEnableMouseTracking(false);
    options.setMarker(new Marker(false));
    options.setShowInLegend(false);
    options.setAnimation(false);
    options.setShadow(false);
    series.setPlotOptions(options);
    configureXAxis(getConfiguration().getxAxis());
    configureYAxis(getConfiguration().getyAxis());
}
Also used : ListSeries(com.vaadin.addon.charts.model.ListSeries) Series(com.vaadin.addon.charts.model.Series) Legend(com.vaadin.addon.charts.model.Legend) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Marker(com.vaadin.addon.charts.model.Marker)

Example 13 with Marker

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

the class MasterDetailChart method getDetailChart.

private Chart getDetailChart() {
    Chart detailChart = new Chart();
    detailChart.setHeight("100%");
    detailChart.setWidth("100%");
    Configuration configuration = detailChart.getConfiguration();
    configuration.getCredits().setEnabled(false);
    configuration.setTitle("Historical USD to EUR Exchange Rate");
    configuration.setSubTitle("Select an area by dragging across the lower chart");
    configuration.getxAxis().setType(AxisType.DATETIME);
    configuration.getyAxis().setTitle(new AxisTitle((String) null));
    configuration.getyAxis().setMinRange(0.1);
    configuration.getTooltip().setFormatter("function() {var point = this.points[0];return '<b>'+ point.series.name +'</b><br/>'+Highcharts.dateFormat('%A %B %e %Y', this.x) + ':<br/>'+'1 USD = '+ Highcharts.numberFormat(point.y, 2) +' EUR';}");
    configuration.getTooltip().setShared(true);
    PlotOptionsLine series = new PlotOptionsLine();
    series.setPointInterval(DAY_IN_MILLIS);
    configuration.setPlotOptions(series);
    States states = new States();
    Hover hover = new Hover();
    hover.setRadius(3);
    states.setHover(hover);
    Marker marker = series.getMarker();
    marker.setEnabled(false);
    marker.setStates(states);
    marker.setRadius(2);
    series.setAnimation(false);
    ListSeries seriesList = new ListSeries();
    PlotOptionsLine plotOptionsLine = new PlotOptionsLine();
    plotOptionsLine.setPointInterval(DAY_IN_MILLIS);
    plotOptionsLine.setPointStart(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
    seriesList.setPlotOptions(plotOptionsLine);
    seriesList.setName("USD to EUR");
    seriesList.setData(FULL_DEMO_DATA_SET);
    configuration.getLegend().setEnabled(false);
    configuration.setExporting(false);
    configuration.addSeries(seriesList);
    detailChart.drawChart(configuration);
    return detailChart;
}
Also used : States(com.vaadin.addon.charts.model.States) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsLine(com.vaadin.addon.charts.model.PlotOptionsLine) ListSeries(com.vaadin.addon.charts.model.ListSeries) Hover(com.vaadin.addon.charts.model.Hover) Marker(com.vaadin.addon.charts.model.Marker) AxisTitle(com.vaadin.addon.charts.model.AxisTitle) Chart(com.vaadin.addon.charts.Chart)

Example 14 with Marker

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

the class MasterDetailChart method getMasterChart.

private Chart getMasterChart() {
    Chart masterChart = new Chart(ChartType.AREA);
    masterChart.setHeight("80px");
    masterChart.setWidth("100%");
    masterChart.setId("master-chart");
    Configuration configuration = masterChart.getConfiguration();
    configuration.getChart().setZoomType(ZoomType.X);
    configuration.getChart().setReflow(false);
    configuration.getChart().setBorderWidth(0);
    configuration.getChart().setBackgroundColor(null);
    configuration.getChart().setMarginLeft(50);
    configuration.getChart().setMarginRight(20);
    configuration.getTitle().setText("");
    configuration.getxAxis().setType(AxisType.DATETIME);
    configuration.getxAxis().setShowLastLabel(true);
    configuration.getxAxis().setMinRange(14 * DAY_IN_MILLIS);
    configuration.getxAxis().setTitle(new AxisTitle(""));
    PlotBand mask = new PlotBand();
    mask.setColor(new SolidColor(0, 0, 0, 0.2));
    mask.setFrom(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
    mask.setTo(Util.toHighchartsTS(DEMO_DATASET_END.atStartOfDay().toInstant(ZoneOffset.UTC)));
    configuration.getxAxis().setPlotBands(mask);
    YAxis yAxis = configuration.getyAxis();
    yAxis.setGridLineWidth(0);
    yAxis.setLabels(new Labels(false));
    yAxis.setTitle(new AxisTitle(""));
    yAxis.setMin(0.6);
    yAxis.setShowFirstLabel(false);
    configuration.getTooltip().setEnabled(false);
    configuration.getLegend().setEnabled(false);
    configuration.getCredits().setEnabled(false);
    PlotOptionsArea plotOptions = new PlotOptionsArea();
    plotOptions.setLineWidth(1);
    plotOptions.setShadow(false);
    Hover hover = new Hover();
    hover.setLineWidth(1);
    States states = new States();
    states.setHover(hover);
    plotOptions.setStates(states);
    plotOptions.setEnableMouseTracking(false);
    plotOptions.setAnimation(false);
    configuration.setPlotOptions(plotOptions);
    ListSeries ls = new ListSeries();
    PlotOptionsArea masterPlotOptions = new PlotOptionsArea();
    GradientColor fillColor = GradientColor.createLinear(0, 0, 0, 1);
    fillColor.addColorStop(0, new SolidColor(69, 114, 167, 1));
    fillColor.addColorStop(1, new SolidColor(69, 114, 167, 0.5));
    masterPlotOptions.setFillColor(fillColor);
    masterPlotOptions.setPointInterval(24 * 3600 * 1000);
    masterPlotOptions.setMarker(new Marker(false));
    masterPlotOptions.setPointStart(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
    ls.setPlotOptions(masterPlotOptions);
    ls.setName("USD to EUR");
    ls.setData(FULL_DEMO_DATA_SET);
    configuration.addSeries(ls);
    masterChart.drawChart(configuration);
    return masterChart;
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) GradientColor(com.vaadin.addon.charts.model.style.GradientColor) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Labels(com.vaadin.addon.charts.model.Labels) Marker(com.vaadin.addon.charts.model.Marker) States(com.vaadin.addon.charts.model.States) PlotOptionsArea(com.vaadin.addon.charts.model.PlotOptionsArea) ListSeries(com.vaadin.addon.charts.model.ListSeries) Hover(com.vaadin.addon.charts.model.Hover) AxisTitle(com.vaadin.addon.charts.model.AxisTitle) PlotBand(com.vaadin.addon.charts.model.PlotBand) Chart(com.vaadin.addon.charts.Chart) YAxis(com.vaadin.addon.charts.model.YAxis)

Example 15 with Marker

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

the class ModifyOnePoint method getChart.

@Override
protected Component getChart() {
    final Chart chart = new Chart();
    chart.setHeight("300px");
    chart.setWidth("100%");
    final Configuration configuration = chart.getConfiguration();
    configuration.setTitle("One point is different");
    configuration.getTooltip().setEnabled(false);
    configuration.getChart().setType(ChartType.SPLINE);
    series = new DataSeries();
    series.add(createBasicPoint(1, 4));
    series.add(new DataSeriesItem(3, 4));
    dataSeriesItem = new DataSeriesItem(4, 4);
    Marker marker = new Marker(true);
    marker.setRadius(10);
    marker.setFillColor(new SolidColor("red"));
    dataSeriesItem.setMarker(marker);
    dataSeriesItem.setName("Special point");
    series.add(dataSeriesItem);
    series.add(new DataSeriesItem(8, 3));
    configuration.setSeries(series);
    chart.drawChart(configuration);
    return chart;
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) DataSeries(com.vaadin.addon.charts.model.DataSeries) Marker(com.vaadin.addon.charts.model.Marker) Chart(com.vaadin.addon.charts.Chart) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem)

Aggregations

Marker (com.vaadin.addon.charts.model.Marker)29 Chart (com.vaadin.addon.charts.Chart)23 Configuration (com.vaadin.addon.charts.model.Configuration)22 YAxis (com.vaadin.addon.charts.model.YAxis)16 AxisTitle (com.vaadin.addon.charts.model.AxisTitle)15 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)14 DataSeries (com.vaadin.addon.charts.model.DataSeries)13 Hover (com.vaadin.addon.charts.model.Hover)11 ListSeries (com.vaadin.addon.charts.model.ListSeries)11 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)9 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)9 States (com.vaadin.addon.charts.model.States)9 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)8 PlotOptionsSpline (com.vaadin.addon.charts.model.PlotOptionsSpline)7 XAxis (com.vaadin.addon.charts.model.XAxis)7 PlotOptionsLine (com.vaadin.addon.charts.model.PlotOptionsLine)5 Labels (com.vaadin.addon.charts.model.Labels)4 PlotBand (com.vaadin.addon.charts.model.PlotBand)3 Color (com.vaadin.addon.charts.model.style.Color)3 ParseException (java.text.ParseException)3