View Javadoc
1   /*
2    * Copyright 2014 James Pether Sörling
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   *	$Id$
17   *  $HeadURL$
18   */
19  package com.hack23.cia.web.impl.ui.application.views.common.chartfactory.impl;
20  
21  import org.dussan.vaadin.dcharts.DCharts;
22  import org.dussan.vaadin.dcharts.data.DataSeries;
23  import org.springframework.beans.factory.annotation.Autowired;
24  import org.springframework.stereotype.Service;
25  
26  import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager;
27  import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartOptions;
28  import com.vaadin.ui.AbstractOrderedLayout;
29  
30  /**
31   * The Class ChartDataManagerImpl.
32   */
33  @Service
34  public final class ChartDataManagerImpl extends AbstractChartDataManagerImpl implements ChartDataManager {
35  
36  	/** The chart options. */
37  	@Autowired
38  	private ChartOptions chartOptions;
39  
40  	/**
41  	 * Instantiates a new chart data manager impl.
42  	 */
43  	public ChartDataManagerImpl() {
44  		super();
45  	}
46  
47  
48  	@Override
49  	public void createChartPanel(final AbstractOrderedLayout content,final DataSeries dataSeries, final String caption) {
50  
51  		final DCharts chart = new DCharts().setDataSeries(dataSeries).setOptions(chartOptions.createOptionsPieChart());
52  
53  		chart.show();
54  
55  		addChart(content,caption, chart);
56  
57  	}
58  
59  
60  }