Docs

Documentation versions (currently viewingVaadin 25)
Documentation translations (currently viewing)

Cette page a été traduite automatiquement à partir de la documentation officielle, qui se trouve sur https://vaadin.com/docs. Elle peut contenir des erreurs, des inexactitudes, ou des affirmations incorrectes. Vaadin ne garantit pas et ne fait aucune déclaration concernant l’exactitude, la fiabilité, ou l’actualité de la traduction.

Bullet Charts

Charts qui affichent une valeur ainsi qu’une valeur cible.

Les bullet charts affichent une valeur et une valeur cible. Ils nécessitent l’utilisation de DataSeriesItemBullet.

Bullet Chart montre un bullet chart configuré.

charts bullet
Bullet Chart

Le type de chart d’un bullet chart est ChartType.BULLET. Ses options peuvent être configurées dans un objet PlotOptionsBullet.

Source code
Java
// Create a bullet chart
Chart chart = new Chart(ChartType.BULLET);
chart.setHeight("115px");

// Modify the default configuration
Configuration conf = chart.getConfiguration();
conf.setTitle("2020 YTD");
conf.getChart().setInverted(true);
conf.getLegend().setEnabled(false);
conf.getTooltip().setPointFormat(
        "<b>{point.y}</b> (with target at {point.target})");

// Add data
PlotOptionsBullet options = new PlotOptionsBullet();
options.setPointPadding(0.25);
options.setBorderWidth(0);
options.setColor(SolidColor.BLACK);
options.getTargetOptions().setWidth("200%");
DataSeries series = new DataSeries();
series.add(new DataSeriesItemBullet(275, 250));
series.setPlotOptions(options);
conf.addSeries(series);

// Configure the axes
YAxis yAxis = conf.getyAxis();
yAxis.setGridLineWidth(0);
yAxis.setTitle("");
yAxis.addPlotBand(new PlotBand(0, 150, new SolidColor("#666666")));
yAxis.addPlotBand(new PlotBand(150, 225, new SolidColor("#999999")));
yAxis.addPlotBand(new PlotBand(225, 9e9, new SolidColor("#bbbbbb")));
conf.getxAxis().addCategory(
        "<span style=\"font-size: 13px; font-weight: bold;\">Revenue</span><br/>U.S. $ (1,000s)");

Exemple de Bullet

Source code
ChartTypeBullet.java