我用Java制作了vaadin 10图表。似乎有多个问题,所有问题都与它的大小有关。首先,它溢出了屏幕,没有我应用任何大小修饰符或任何东西。另外,当我垂直调整屏幕大小时,例如,当垂直拖动chrome的检查工具时,图表在垂直方向会变大,甚至不会恢复到其原始大小。然后,当我最小化菜单栏时,它保持相同的大小,但应在其容器中保持完整的大小。但是,只有容器的宽度增加,而图表本身没有增加。这是一些相关的代码:
chart.setTimeline(true);
List<PageInfo> elementsMiseEnLigne = ListElementsMiseEnLigne();
List<DataSeries> dataSeriesPerType = new ArrayList<>();
List<DataSeries> flagsListSeries = new ArrayList<>();
Configuration configuration = chart.getConfiguration();
configuration.getChart().setType(ChartType.AREASPLINE);
configuration.getChart().setBorderRadius(5);
configuration.getChart();
Navigator navigator = configuration.getNavigator();
navigator.setEnabled(false);
configuration.setTitle("Chronologie");
RangeSelector rangeSelector = new RangeSelector();
rangeSelector.setSelected(4);
configuration.setRangeSelector(rangeSelector);
configuration.getTooltip().setEnabled(true);
chart.addClassName("TimelineElements-chart");
int yAxisIncr = 0;
for (PageInfo elementMiseEnLigne : elementsMiseEnLigne) {
DataSeries elementsTypeDateSeries = new DataSeries();
DataSeries flagsOnSeries = new DataSeries();
dataSeriesPerType.add(elementsTypeDateSeries);
flagsListSeries.add(flagsOnSeries);
}
ElementCampagne.elementMappingService = homePagePresenter.getElementMappingService();
YAxis yAxis = new YAxis();
yAxis.setOffset(0);
yAxis.setMin(0);
yAxis.
configuration.addyAxis(yAxis);
dataSeriesPerType.get(0).setName(TITLE_BANDEAU);
dataSeriesPerType.get(1).setName(TITLE_EMPLOI);
dataSeriesPerType.get(2).setName(TITLE_NEOTV);
int i;
for (ElementCampagne elementMel : elementMels) {
//...
//Adding elements to dataSeriesPerType
//...
}
for (DataSeries dataSerie : dataSeriesPerType) {
configuration.addSeries(dataSerie);
}
Legend legend = new Legend();
legend.setAlign(HorizontalAlign.RIGHT);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setShadow(true);
configuration.setLegend(legend);
以下是一些屏幕截图: