use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class ChartPluginExamples method createHeatMap.
public static Chart createHeatMap() {
final Chart chart = new Chart(CustomChartTypes.MAP);
chart.setWidth("800px");
chart.setHeight("500px");
final Configuration configuration = chart.getConfiguration();
ChartModel model = new ChartModel();
configuration.setChart(model);
model.setType(CustomChartTypes.MAP);
model.setBorderWidth(1);
model.setZoomType(ZoomType.XY);
model.setInverted(false);
configuration.getTitle().setText("Vaadin Charts Test for complex highcharts plugin");
XAxis xAxis = configuration.getxAxis();
xAxis.setEndOnTick(false);
xAxis.setGridLineWidth(0);
xAxis.getLabels().setEnabled(false);
xAxis.setLineWidth(0);
xAxis.setMinPadding(0);
xAxis.setMaxPadding(0);
xAxis.setStartOnTick(false);
xAxis.setTickWidth(0);
YAxis yAxis = configuration.getyAxis();
yAxis.setEndOnTick(false);
yAxis.setGridLineWidth(0);
yAxis.getLabels().setEnabled(false);
yAxis.setLineWidth(0);
yAxis.setMinPadding(0);
yAxis.setMaxPadding(0);
yAxis.setStartOnTick(false);
yAxis.setTickWidth(0);
yAxis.setTitle("");
yAxis.setReversed(true);
Legend legend = configuration.getLegend();
legend.setHorizontalAlign(HorizontalAlign.LEFT);
legend.setVerticalAlign(VerticalAlign.BOTTOM);
legend.setFloating(true);
legend.setLayout(LayoutDirection.VERTICAL);
configuration.setExporting(false);
MapSeries series = new MapSeries();
series.addValueRange(new ValueRange(null, 3, new SolidColor(19, 64, 117, 0.05)));
series.addValueRange(new ValueRange(3, 10, new SolidColor(19, 64, 117, 0.2)));
series.addValueRange(new ValueRange(10, 30, new SolidColor(19, 64, 117, 0.4)));
series.addValueRange(new ValueRange(30, 100, new SolidColor(19, 64, 117, 0.5)));
series.addValueRange(new ValueRange(100, 300, new SolidColor(19, 64, 117, 0.6)));
series.addValueRange(new ValueRange(300, 1000, new SolidColor(19, 64, 117, 0.8)));
series.addValueRange(new ValueRange(1000, null, new SolidColor(19, 64, 117, 1)));
Random random = new Random();
for (String c : Locale.getISOCountries()) {
DataSeriesItem p = new DataSeriesItem(c.toLowerCase(), random.nextInt(1200));
series.add(p);
}
configuration.addSeries(series);
chart.drawChart(configuration);
return chart;
}
use of com.vaadin.addon.charts.model.style.SolidColor 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;
}
use of com.vaadin.addon.charts.model.style.SolidColor 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);
Labels dataLabels = new Labels();
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;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class ChartTypes method chartTypesWaterfallDataModel.
public void chartTypesWaterfallDataModel() {
// Define the colors
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
// The data
DataSeries series = new DataSeries();
// The beginning balance
DataSeriesItem start = new DataSeriesItem("Start", 306503);
SolidColor balanceColor = SolidColor.KHAKI;
start.setColor(balanceColor);
series.add(start);
// Deltas
series.add(new DataSeriesItem("Predators", -3330));
series.add(new DataSeriesItem("Slaughter", -103332));
series.add(new DataSeriesItem("Reproduction", +104052));
WaterFallSum end = new WaterFallSum("End");
end.setColor(balanceColor);
// Not intermediate (default)
end.setIntermediate(false);
series.add(end);
conf.addSeries(series);
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class ChartTypes method chartTypesScatterMarkerPropertiesSnippet1.
public void chartTypesScatterMarkerPropertiesSnippet1() {
double x = 1.0;
double y = 1.2;
double z = 1.45;
DataSeries series = new DataSeries();
DataSeriesItem point = new DataSeriesItem(x, y);
Marker marker = new Marker();
// Set line width and color
// Normally zero width
marker.setLineWidth(1);
marker.setLineColor(SolidColor.BLACK);
// Set RGB fill color
int level = (int) Math.round((1 - z) * 127);
marker.setFillColor(new SolidColor(255 - level, 0, level));
point.setMarker(marker);
marker.setRadius((z + 1) * 5);
series.add(point);
}
Aggregations