List of usage examples for org.jfree.data.time TimePeriodValuesCollection getItemCount
@Override public int getItemCount(int series)
From source file:net.commerce.zocalo.freechart.ChartGenerator.java
static public File writeMultiStepChartFile(String webDirName, String chartDirName, final int chartSize, Date lastTrade, final Claim claim) throws IOException { String chartStyle = "p"; final String market = claim.getName(); final File existingPngFile = pngFile(webDirName, chartDirName, market, chartStyle); if (isFileMoreRecent(lastTrade, existingPngFile)) { return existingPngFile; }//from w ww.ja v a 2s.c o m Callable<Boolean> worker = new Callable<Boolean>() { public Boolean call() throws Exception { List trades = HibernateUtil.tradeListForJsp(market); TimePeriodValuesCollection prices = ChartGenerator.getOpenCloseValues(trades, claim); JFreeChart chart = EMPTY_CHART; if (prices.getItemCount(0) != 0) { chart = multiStepChart(prices); } try { writeChartAsPNG(chartSize, chart, existingPngFile); new NewChart(market); return true; } catch (IOException e) { Logger log = Logger.getLogger("trace"); log.error("Couldn't save updated chart for '" + market + "'.", e); return false; } } }; ChartScheduler sched = ChartScheduler.create(market, worker); sched.generateNewChart(); return existingPngFile; }
From source file:net.commerce.zocalo.freechart.ChartGenerator.java
public static File updateChartFile(String webDirName, String chartDirName, Date lastTrade, final String claimName, final boolean scalePrices, final int chartHeight, final int chartWidth) throws IOException { String chartStyle = "pv"; final File existingPngFile = pngFile(webDirName, chartDirName, claimName, chartStyle); if (isFileMoreRecent(lastTrade, existingPngFile)) { return existingPngFile; }/*from ww w.j a va 2s. c o m*/ Callable<Boolean> worker = new Callable<Boolean>() { public Boolean call() throws Exception { List trades = HibernateUtil.tradeListForJsp(claimName); TimePeriodValuesCollection prices = ChartGenerator.getHistoricalPrices(claimName, trades); JFreeChart chart = EMPTY_CHART; if (prices.getItemCount(0) != 0) { TimePeriodValuesCollection volumes = ChartGenerator.getHistoricalVolumes(claimName, trades); chart = priceVolumeHistoryChart("", prices, volumes, scalePrices); } try { writeChartAsPNG(chartWidth, chartHeight, chart, existingPngFile); new NewChart(claimName); return true; } catch (IOException e) { Logger log = Logger.getLogger("trace"); log.error("Couldn't save updated chart for '" + claimName + "'.", e); return false; } } }; ChartScheduler sched = ChartScheduler.create(claimName, worker); sched.generateNewChart(); return existingPngFile; }
From source file:net.commerce.zocalo.freechart.ChartGenerator.java
static public File writeChartFile(String webDirName, String chartDirName, String name, TimePeriodValuesCollection prices, int chartSize, Date lastTrade) throws IOException { String chartStyle = "p"; File existingPngFile = pngFile(webDirName, chartDirName, name, chartStyle); if (isFileMoreRecent(lastTrade, existingPngFile)) { return existingPngFile; }//from ww w .j av a 2 s . c om JFreeChart chart = EMPTY_CHART; if (prices.getItemCount(0) != 0) { chart = priceHistoryChart(name, prices); } return writeChartAsPNG(chartSize, chart, existingPngFile); }
From source file:net.commerce.zocalo.freechart.ChartGenerator.java
static public File writeMultiChartFile(String webDirName, String chartDirName, String name, TimePeriodValuesCollection prices, int chartSize, Date lastTrade) throws IOException { String chartStyle = "p"; File existingPngFile = pngFile(webDirName, chartDirName, name, chartStyle); if (isFileMoreRecent(lastTrade, existingPngFile)) { return existingPngFile; }//from w ww . j av a 2 s . c o m JFreeChart chart = EMPTY_CHART; if (prices.getItemCount(0) != 0) { chart = multiPriceHistoryChart(prices); } return writeChartAsPNG(chartSize, chart, existingPngFile); }
From source file:net.commerce.zocalo.freechart.ChartGenerator.java
static public File writeMultiStepChartFile(String webDirName, String chartDirName, String name, TimePeriodValuesCollection prices, int chartSize, Date lastTrade) throws IOException { String chartStyle = "p"; File existingPngFile = pngFile(webDirName, chartDirName, name, chartStyle); if (isFileMoreRecent(lastTrade, existingPngFile)) { return existingPngFile; }/*from www .j a v a2s. c om*/ JFreeChart chart = EMPTY_CHART; if (prices.getItemCount(0) != 0) { chart = multiStepChart(prices); } return writeChartAsPNG(chartSize, chart, existingPngFile); }