package org.zkoss.zssex.util;

import java.awt.BasicStroke;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.zkoss.zss.model.SChart;
import org.zkoss.zss.model.chart.SGeneralChartData;

public class LineChartExportEngine extends ZssChartExportEngine {

	private static final BasicStroke STROKE = new BasicStroke(new Integer(2));
	
	public LineChartExportEngine(SChart chartInfo) {
		super(chartInfo);
	}
	
	protected boolean prepareJFreeChart(JFreeChart jfchart) {
		super.prepareJFreeChart(jfchart);
		final LineAndShapeRenderer renderer = (LineAndShapeRenderer) ((CategoryPlot) jfchart.getPlot()).getRenderer();
		final int count = ((SGeneralChartData) _chartInfo.getData()).getNumOfSeries();
		for(int j = 0; j < count; ++j) {
			renderer.setSeriesStroke(j, STROKE);
			renderer.setSeriesShapesVisible(j, true);
		}
		return false;
	}

}
