hisLimitChart = new Chart();
hisLimitChart.addStyleName("limit-hisLimitChart");
chartLayout.addComponent(hisLimitChart);
//加载内容的方法;
private void initChartContent() {
Configuration conf = hisLimitChart.getConfiguration();
// 加载图表需要的数据
DataSeries series = new DataSeries();
List<Limit> limits = limitManageProcess.getListByName(comLimit_name.getValue().toString());
// set limit info
limitInfo.setValue(limits.get(0).getTxtDescription());
for (Limit limit : limits) {
double value = limit.getAmtLimit();
DataSeriesItem item = new DataSeriesItem();
item.setX(limit.getDtStart());
item.setY(value);
series.add(item);
}
series.setName("限额金额");
conf.addSeries(series);
// 将数据render到图表中;X轴设置未关键期限中最早日期到最晚日期的区间;obj
conf.getChart().setType(ChartType.LINE);
conf.getSubTitle().setAlign(HorizontalAlign.CENTER);
conf.setTitle("");
XAxis xAxis = conf.getxAxis();
// xAxis.getLabels().setFormat("{value:%Y-%m-%d}");
xAxis.getLabels().setFormat("{value:%Y}");
xAxis.setTitle("");
YAxis yAxis = conf.getyAxis();
yAxis.setMin(0);
yAxis.getLabels().setFormat("{value}");
yAxis.setTitle(new AxisTitle("限额金额("+limits.get(0).getCdLimitUnit()+")"));
yAxis.getTitle().setAlign(VerticalAlign.MIDDLE);
conf.getxAxis().setType(AxisType.DATETIME);
conf.getTooltip().setXDateFormat("%Y-%m-%d");
conf.getLegend().setEnabled(false);
PlotOptionsLine plotOptions = new PlotOptionsLine();
plotOptions.getDataLabels().setEnabled(false);
conf.setPlotOptions(plotOptions);
hisLimitChart.drawChart(conf);
}