|
From: Márcio V. d. S. <mv...@us...> - 2007-08-27 16:30:42
|
Update of /cvsroot/tail/Tail/src/java/net/sf/tail/graphics In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv4761/src/java/net/sf/tail/graphics Modified Files: SeriesChart.java StockAndCashFlowDataset.java CashFlowDataset.java SeriesDataset.java CombinedSeriesAndFlowChart.java StockAndCashFlowChart.java Log Message: problemas com o cvs Index: CombinedSeriesAndFlowChart.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/graphics/CombinedSeriesAndFlowChart.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CombinedSeriesAndFlowChart.java 19 Aug 2007 03:27:40 -0000 1.3 --- CombinedSeriesAndFlowChart.java 25 Aug 2007 12:30:01 -0000 1.4 *************** *** 60,79 **** combinedplot, true); ! //Setando labels em 90 graus ! CategoryAxis categoryAxis = seriesPlot.getDomainAxis(); ! categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); ! ! //Setando tamanho do grafico ! NumberAxis rangeAxis = (NumberAxis) seriesPlot.getRangeAxis(); ! rangeAxis.setAutoRangeIncludesZero(false); ! ! //Setando tamanho do label ! categoryAxis.setLabelFont(new Font("SansSerif", 0, 10)); ! ! //Setando tamanho do label de cada tick ! categoryAxis.setTickLabelFont(new Font("SansSerif", 0, 10)); ! //gerando pontos ! setSeriesShapes(); return jfreechart; --- 60,79 ---- combinedplot, true); ! // Setando labels em 90 graus ! CategoryAxis categoryAxis = seriesPlot.getDomainAxis(); ! categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); ! // Setando tamanho do grafico ! NumberAxis rangeAxis = (NumberAxis) seriesPlot.getRangeAxis(); ! rangeAxis.setAutoRangeIncludesZero(false); ! ! // Setando tamanho do label ! categoryAxis.setLabelFont(new Font("SansSerif", 0, 10)); ! ! // Setando tamanho do label de cada tick ! categoryAxis.setTickLabelFont(new Font("SansSerif", 0, 10)); ! ! // gerando pontos ! setSeriesShapes(); return jfreechart; Index: CashFlowDataset.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/graphics/CashFlowDataset.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CashFlowDataset.java 18 Aug 2007 14:36:17 -0000 1.1 --- CashFlowDataset.java 25 Aug 2007 12:30:01 -0000 1.2 *************** *** 13,17 **** public class CashFlowDataset extends AbstractDataset implements CategoryDataset { - private static final long serialVersionUID = -7204964027452086107L; --- 13,16 ---- *************** *** 25,29 **** private int lastIndex; ! private String name; --- 24,28 ---- private int lastIndex; ! private String name; *************** *** 43,47 **** private void loadValues(int firstIndex, int lastIndex) { ! data = new DefaultKeyedValues2D(); for (int j = firstIndex; j <= lastIndex; j++) { data.addValue(cashFlow.getValue(j), this.getName(), series.getTick(j).getDate().toString("hh:mm d/M/yyyy")); --- 42,46 ---- private void loadValues(int firstIndex, int lastIndex) { ! data = new DefaultKeyedValues2D(); for (int j = firstIndex; j <= lastIndex; j++) { data.addValue(cashFlow.getValue(j), this.getName(), series.getTick(j).getDate().toString("hh:mm d/M/yyyy")); *************** *** 90,102 **** public void moveRight() { - - if(lastIndex + 1 < series.getSize()){ - lastIndex++; - - data.addValue(cashFlow.getValue(lastIndex), this.getName() ,series.getTick(lastIndex).getDate().toString("hh:mm d/M/yyyy")); ! if(data.getColumnCount() >= DATASET_SIZE){ firstIndex++; data.removeColumn(0); --- 89,100 ---- public void moveRight() { + if (lastIndex + 1 < series.getSize()) { + lastIndex++; + data.addValue(cashFlow.getValue(lastIndex), this.getName(), series.getTick(lastIndex).getDate().toString( + "hh:mm d/M/yyyy")); ! if (data.getColumnCount() >= DATASET_SIZE) { firstIndex++; data.removeColumn(0); *************** *** 107,111 **** public void moveLeft() { ! if(firstIndex > 0){ firstIndex--; lastIndex--; --- 105,109 ---- public void moveLeft() { ! if (firstIndex > 0) { firstIndex--; lastIndex--; Index: StockAndCashFlowDataset.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/graphics/StockAndCashFlowDataset.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StockAndCashFlowDataset.java 20 Aug 2007 19:32:31 -0000 1.2 --- StockAndCashFlowDataset.java 25 Aug 2007 12:30:01 -0000 1.3 *************** *** 14,18 **** public class StockAndCashFlowDataset extends AbstractDataset implements CategoryDataset { - private static final long serialVersionUID = -7204964027452086107L; --- 14,17 ---- *************** *** 20,24 **** private Indicator<? extends Number> closePrice; ! private CashFlow cashFlow; --- 19,23 ---- private Indicator<? extends Number> closePrice; ! private CashFlow cashFlow; *************** *** 29,33 **** private TimeSeries series; ! public StockAndCashFlowDataset(TimeSeries series, Indicator<? extends Number> closePrice, CashFlow cashFlow, int firstIndex, int lastIndex) { this.data = new DefaultKeyedValues2D(); this.closePrice = closePrice; --- 28,33 ---- private TimeSeries series; ! public StockAndCashFlowDataset(TimeSeries series, Indicator<? extends Number> closePrice, CashFlow cashFlow, ! int firstIndex, int lastIndex) { this.data = new DefaultKeyedValues2D(); this.closePrice = closePrice; *************** *** 39,43 **** loadValues(); } ! public StockAndCashFlowDataset(TimeSeries series, Indicator<? extends Number> closePrice, CashFlow cashFlow) { this.data = new DefaultKeyedValues2D(); --- 39,43 ---- loadValues(); } ! public StockAndCashFlowDataset(TimeSeries series, Indicator<? extends Number> closePrice, CashFlow cashFlow) { this.data = new DefaultKeyedValues2D(); *************** *** 52,62 **** private void loadValues() { ! data = new DefaultKeyedValues2D(); ! for (int i = firstIndex; i <= lastIndex; i++) { ! data.addValue(closePrice.getValue(i), closePrice.getName() ,series.getTick(i).getDate().toString("hh:mm d/M/yyyy")); ! } ! for (int i = firstIndex; i <= lastIndex; i++) { ! data.addValue(cashFlow.getValue(i), "Money Amount", series.getTick(i).getDate().toString("hh:mm d/M/yyyy")); ! } } --- 52,63 ---- private void loadValues() { ! data = new DefaultKeyedValues2D(); ! for (int i = firstIndex; i <= lastIndex; i++) { ! data.addValue(closePrice.getValue(i), closePrice.getName(), series.getTick(i).getDate().toString( ! "hh:mm d/M/yyyy")); ! } ! for (int i = firstIndex; i <= lastIndex; i++) { ! data.addValue(cashFlow.getValue(i), "Money Amount", series.getTick(i).getDate().toString("hh:mm d/M/yyyy")); ! } } Index: StockAndCashFlowChart.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/graphics/StockAndCashFlowChart.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StockAndCashFlowChart.java 20 Aug 2007 22:25:41 -0000 1.3 --- StockAndCashFlowChart.java 25 Aug 2007 12:30:01 -0000 1.4 *************** *** 15,23 **** import org.jfree.data.general.DatasetChangeListener; ! public class StockAndCashFlowChart implements DatasetChangeListener ! { private CategoryDataset dataSet; private CategoryPlot plot; private LineAndShapeRenderer lineAndShapeRenderer; --- 15,24 ---- import org.jfree.data.general.DatasetChangeListener; ! public class StockAndCashFlowChart implements DatasetChangeListener { private CategoryDataset dataSet; + private CategoryPlot plot; + private LineAndShapeRenderer lineAndShapeRenderer; *************** *** 27,57 **** this.lineAndShapeRenderer = new LineAndShapeRenderer(true, true); } - - public JFreeChart createChart(String chartName) - { - JFreeChart jfreechart = ChartFactory.createLineChart(chartName, "Date", "Value", dataSet, PlotOrientation.VERTICAL, true, true, false); - ! plot = (CategoryPlot)jfreechart.getPlot(); ! plot.setBackgroundPaint(Color.WHITE); ! //Setando labels em 90 graus ! CategoryAxis categoryAxis = plot.getDomainAxis(); ! ! //Setando tamanho do grafico ! NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); ! rangeAxis.setAutoRangeIncludesZero(false); ! ! //Setando tamanho do label ! categoryAxis.setLabelFont(new Font("Arial", 0, 10)); ! ! //Setando tamanho do label de cada tick ! categoryAxis.setTickLabelFont(new Font("Arial", 0, 10)); ! ! //gerando setas ! setSeriesShapes(); ! ! return jfreechart; ! } /** --- 28,57 ---- this.lineAndShapeRenderer = new LineAndShapeRenderer(true, true); } ! public JFreeChart createChart(String chartName) { ! JFreeChart jfreechart = ChartFactory.createLineChart(chartName, "Date", "Value", dataSet, ! PlotOrientation.VERTICAL, true, true, false); ! plot = (CategoryPlot) jfreechart.getPlot(); ! plot.setBackgroundPaint(Color.WHITE); ! ! // Setando labels em 90 graus ! CategoryAxis categoryAxis = plot.getDomainAxis(); ! ! // Setando tamanho do grafico ! NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); ! rangeAxis.setAutoRangeIncludesZero(false); ! ! // Setando tamanho do label ! categoryAxis.setLabelFont(new Font("Arial", 0, 10)); ! ! // Setando tamanho do label de cada tick ! categoryAxis.setTickLabelFont(new Font("Arial", 0, 10)); ! ! // gerando setas ! setSeriesShapes(); ! ! return jfreechart; ! } /** *************** *** 62,66 **** lineAndShapeRenderer.setSeriesShapesVisible(0, false); lineAndShapeRenderer.setSeriesShapesVisible(1, false); ! plot.setRenderer(lineAndShapeRenderer); } --- 62,66 ---- lineAndShapeRenderer.setSeriesShapesVisible(0, false); lineAndShapeRenderer.setSeriesShapesVisible(1, false); ! plot.setRenderer(lineAndShapeRenderer); } *************** *** 68,70 **** setSeriesShapes(); } ! } --- 68,70 ---- setSeriesShapes(); } ! } Index: SeriesDataset.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/graphics/SeriesDataset.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SeriesDataset.java 4 Aug 2007 02:34:18 -0000 1.4 --- SeriesDataset.java 25 Aug 2007 12:30:01 -0000 1.5 *************** *** 15,19 **** public class SeriesDataset extends AbstractDataset implements CategoryDataset { - private static final long serialVersionUID = -7204964027452086107L; --- 15,18 ---- *************** *** 43,52 **** } ! ! ! public SeriesDataset(TimeSeries timeSeries, List<Indicator<? extends Number>> indicators, int firstIndex, int lastIndex, List<Trade> trades) { ! ! this(timeSeries,indicators,firstIndex,lastIndex); this.trades = trades; --- 42,49 ---- } + public SeriesDataset(TimeSeries timeSeries, List<Indicator<? extends Number>> indicators, int firstIndex, + int lastIndex, List<Trade> trades) { ! this(timeSeries, indicators, firstIndex, lastIndex); this.trades = trades; *************** *** 54,78 **** } - - - - private void loadTrade(int firstIndex, int lastIndex) { for (Trade trade : trades) { ! Operation buy = trade.getEntry(); ! if(buy.getIndex() >= firstIndex && buy.getIndex() <= lastIndex) ! data.addValue(series.getTick(buy.getIndex()).getClosePrice(),"Buy", series.getTick(buy.getIndex()).getDate().toString("hh:mm d/M/yyyy") ); Operation sell = trade.getExit(); ! if(sell.getIndex() >= firstIndex && sell.getIndex() <= lastIndex) ! data.addValue(series.getTick(sell.getIndex()).getClosePrice(), "Sell", series.getTick(sell.getIndex()).getDate().toString("hh:mm d/M/yyyy")); } } private void loadValues(int firstIndex, int lastIndex) { ! data = new DefaultKeyedValues2D(); for (int i = 0; i < indicators.size(); i++) { for (int j = firstIndex; j <= lastIndex; j++) { ! data.addValue(indicators.get(i).getValue(j), indicators.get(i).getName() ,series.getTick(j).getDate().toString("hh:mm d/M/yyyy")); } } --- 51,74 ---- } private void loadTrade(int firstIndex, int lastIndex) { for (Trade trade : trades) { ! Operation buy = trade.getEntry(); ! if (buy.getIndex() >= firstIndex && buy.getIndex() <= lastIndex) ! data.addValue(series.getTick(buy.getIndex()).getClosePrice(), "Buy", series.getTick(buy.getIndex()) ! .getDate().toString("hh:mm d/M/yyyy")); Operation sell = trade.getExit(); ! if (sell.getIndex() >= firstIndex && sell.getIndex() <= lastIndex) ! data.addValue(series.getTick(sell.getIndex()).getClosePrice(), "Sell", series.getTick(sell.getIndex()) ! .getDate().toString("hh:mm d/M/yyyy")); } } private void loadValues(int firstIndex, int lastIndex) { ! data = new DefaultKeyedValues2D(); for (int i = 0; i < indicators.size(); i++) { for (int j = firstIndex; j <= lastIndex; j++) { ! data.addValue(indicators.get(i).getValue(j), indicators.get(i).getName(), series.getTick(j).getDate() ! .toString("hh:mm d/M/yyyy")); } } *************** *** 121,132 **** public void moveRight() { ! if(lastIndex + 1 < series.getSize()){ lastIndex++; for (Indicator<? extends Number> indicator : indicators) { ! data.addValue(indicator.getValue(lastIndex), indicator.getName() ,series.getTick(lastIndex).getDate().toString("hh:mm d/M/yyyy")); } ! ! if(data.getColumnCount() >= DATASET_SIZE){ firstIndex++; data.removeColumn(0); --- 117,128 ---- public void moveRight() { ! if (lastIndex + 1 < series.getSize()) { lastIndex++; for (Indicator<? extends Number> indicator : indicators) { ! data.addValue(indicator.getValue(lastIndex), indicator.getName(), series.getTick(lastIndex).getDate() ! .toString("hh:mm d/M/yyyy")); } ! if (data.getColumnCount() >= DATASET_SIZE) { firstIndex++; data.removeColumn(0); *************** *** 139,143 **** public void moveLeft() { ! if(firstIndex > 0){ firstIndex--; lastIndex--; --- 135,139 ---- public void moveLeft() { ! if (firstIndex > 0) { firstIndex--; lastIndex--; *************** *** 146,150 **** loadTrade(firstIndex, lastIndex); - fireDatasetChanged(); } --- 142,145 ---- Index: SeriesChart.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/graphics/SeriesChart.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SeriesChart.java 7 Jul 2007 18:45:23 -0000 1.1 --- SeriesChart.java 25 Aug 2007 12:30:01 -0000 1.2 *************** *** 18,26 **** import org.jfree.data.general.DatasetChangeListener; ! public class SeriesChart implements DatasetChangeListener ! { private CategoryDataset dataSet; private CategoryPlot plot; private LineAndShapeRenderer lineAndShapeRenderer; --- 18,27 ---- import org.jfree.data.general.DatasetChangeListener; ! public class SeriesChart implements DatasetChangeListener { private CategoryDataset dataSet; + private CategoryPlot plot; + private LineAndShapeRenderer lineAndShapeRenderer; *************** *** 30,62 **** this.lineAndShapeRenderer = new LineAndShapeRenderer(true, true); } - - public JFreeChart createChart(String chartName) - { - JFreeChart jfreechart = ChartFactory.createLineChart(chartName, "Date", "Value", dataSet, PlotOrientation.VERTICAL, true, true, false); - ! plot = (CategoryPlot)jfreechart.getPlot(); ! plot.setBackgroundPaint(Color.BLACK); ! //Setando labels em 90 graus ! CategoryAxis categoryAxis = plot.getDomainAxis(); ! categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); ! ! //Setando tamanho do grafico ! NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); ! rangeAxis.setAutoRangeIncludesZero(false); ! ! //Setando tamanho do label ! categoryAxis.setLabelFont(new Font("SansSerif", 0, 10)); ! ! //Setando tamanho do label de cada tick ! categoryAxis.setTickLabelFont(new Font("SansSerif", 0, 10)); ! ! //gerando setas ! setSeriesShapes(); ! ! return jfreechart; ! } /** --- 31,61 ---- this.lineAndShapeRenderer = new LineAndShapeRenderer(true, true); } ! public JFreeChart createChart(String chartName) { ! JFreeChart jfreechart = ChartFactory.createLineChart(chartName, "Date", "Value", dataSet, ! PlotOrientation.VERTICAL, true, true, false); ! plot = (CategoryPlot) jfreechart.getPlot(); ! plot.setBackgroundPaint(Color.BLACK); ! // Setando labels em 90 graus ! CategoryAxis categoryAxis = plot.getDomainAxis(); ! categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); ! ! // Setando tamanho do grafico ! NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); ! rangeAxis.setAutoRangeIncludesZero(false); ! ! // Setando tamanho do label ! categoryAxis.setLabelFont(new Font("SansSerif", 0, 10)); ! ! // Setando tamanho do label de cada tick ! categoryAxis.setTickLabelFont(new Font("SansSerif", 0, 10)); ! ! // gerando setas ! setSeriesShapes(); ! ! return jfreechart; ! } /** *************** *** 65,79 **** */ private void setSeriesShapes() { ! ! for (int i = 0; i < dataSet.getRowCount(); i++) { ! ! if (dataSet.getRowKey(i).equals("Buy")) ! lineAndShapeRenderer.setSeriesShape(i,ShapeFactory.getDownArrow()); ! else if (dataSet.getRowKey(i).equals("Sell")) ! lineAndShapeRenderer.setSeriesShape(i,ShapeFactory.getUpperArrow()); ! else ! lineAndShapeRenderer.setSeriesShape(i,ShapeFactory.getPoint()); } ! plot.setRenderer(lineAndShapeRenderer); } --- 64,78 ---- */ private void setSeriesShapes() { ! ! for (int i = 0; i < dataSet.getRowCount(); i++) { ! ! if (dataSet.getRowKey(i).equals("Buy")) ! lineAndShapeRenderer.setSeriesShape(i, ShapeFactory.getDownArrow()); ! else if (dataSet.getRowKey(i).equals("Sell")) ! lineAndShapeRenderer.setSeriesShape(i, ShapeFactory.getUpperArrow()); ! else ! lineAndShapeRenderer.setSeriesShape(i, ShapeFactory.getPoint()); } ! plot.setRenderer(lineAndShapeRenderer); } *************** *** 81,83 **** setSeriesShapes(); } ! } --- 80,82 ---- setSeriesShapes(); } ! } |