-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
Description
We used the charts constructed via java code at the server with a fixed size, but all various probed ratio's width/height did not help to get the X-Axis labels and/or X-axis title rendered completely. I do not know if this is a high chart issue or vaadin wrapper issue, see the wrong results:
and:
Do we something wrong??
pom.xml:
...
<vaadin.version>8.12.3</vaadin.version>
...
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-charts</artifactId>
<version>4.2.1</version>
</dependency>
The chart java configuration:
Chart riskChart = new Chart(ChartType.HEATMAP);
String chartWidth = "400px";
String chartHeight = "430px";
riskChart.setWidth(chartWidth);
riskChart.setHeight(chartHeight);
Configuration
conf = riskChart.getConfiguration();
conf.setTitle("Risikokartierung");
conf.getChart().setMarginTop(40);
conf.getChart().setMarginBottom(40);
conf.getChart().setBackgroundColor(new SolidColor("#e7e6e6"));
GradientColor g = GradientColor.createLinear(1, 0, 0, 1);
g.addColorStop(0.23, new SolidColor(240, 59, 9)); // rot
g.addColorStop(0.5, new SolidColor(255, 224, 80)); // orange
g.addColorStop(0.99, new SolidColor(13, 163, 35)); // gelb
g.addColorStop(1, new SolidColor(217, 186, 50)); // grün
conf.getChart().setPlotBackgroundColor(g);
conf.getLegend().setEnabled(false); // Disable legend
xaxis = conf.getxAxis();
xaxis.setType(AxisType.CATEGORY);
xaxis.setCategories("Vernachlässigbar", "Überschaubar", "Signifikant", "Substantiell", "Irreversibel");
//TODO That title gets "cutted"; why?? Bug?
xaxis.setTitle("Schweregrad des Risikos (Schadensausmaß und Reputation)");
xaxis.setCeiling(4); // do not show more than "Irreversibel", e.g. not the "5"
xaxis.setFloor(0); // do not show fewer than "0", e.g. not the "-1"
xaxis.setGridLineColor(SolidColor.WHITE);
xaxis.setGridLineWidth(1);
yaxis = conf.getyAxis();
yaxis.setTitle("Risiko Eintrittswahrscheinlichkeit");
yaxis.setCategories("Vernachlässigbar", "Geringfügig", "Überschaubar", "Signifikant", "Maximal");
yaxis.setCeiling(4); // do not show more than "Maximal", e.g. not the "5"
yaxis.setFloor(0); // do not show fewer than "0", e.g. not the "-1"
PlotOptionsBubble pob = new PlotOptionsBubble();
pob.setColor(SolidColor.RED);
pob.setDisplayNegative(false);
DataSeries seriesBubble = new DataSeries("Datenverlust");
seriesBubble.setPlotOptions(pob);
DataSeriesItem3d dsi = new DataSeriesItem3d( 0.25, 0.75, 0.75 ); // x, y, z
dsi.setName("(D)");
DataLabels dala = new DataLabels(true);
dala.setFormatter("this.point.name");
dsi.setDataLabels(dala);
seriesBubble.add(dsi );
conf.addSeries(seriesBubble);
pob = new PlotOptionsBubble();
pob.setColor(SolidColor.RED);
pob.setDisplayNegative(false);
seriesBubble = new DataSeries("Unrechtmäßiger Zugriff auf Daten");
seriesBubble.setPlotOptions(pob);
dsi = new DataSeriesItem3d( 2.75, 1.5, 1 ); // x, y, z
dsi.setName("(Z)");
dala = new DataLabels(true);
dala.setFormatter("this.point.name");
dsi.setDataLabels(dala);
seriesBubble.add(dsi );
conf.addSeries(seriesBubble);
pob = new PlotOptionsBubble();
pob.setColor(SolidColor.BLACK);
pob.setDisplayNegative(false);
seriesBubble = new DataSeries("Unerwünschte Veränderung der Daten");
seriesBubble.setPlotOptions(pob);
dsi = new DataSeriesItem3d( 2.5, 3.8, 1 ); // x, y, z
dsi.setName("(V)");
dala = new DataLabels(true);
dala.setFormatter("this.point.name");
dsi.setDataLabels(dala);
seriesBubble.add(dsi );
conf.addSeries(seriesBubble);
panel.addComponent(riskChart);
