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);
}
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());
}
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;
}
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;
}
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;
}
Aggregations