示例#1
0
 private TimePeriodValuesCollection makeCollection() {
   TimePeriodValuesCollection values = new TimePeriodValuesCollection();
   values.addSeries(new TimePeriodValues("Open"));
   values.addSeries(new TimePeriodValues("Close"));
   values.addSeries(new TimePeriodValues("Best Bid"));
   values.addSeries(new TimePeriodValues("Best Ask"));
   return values;
 }
示例#2
0
 public void add(Date date, double open, double close) {
   if (posValues.keySet().size() != 1) {
     return;
   }
   Position pos = (Position) posValues.keySet().iterator().next();
   TimePeriodValuesCollection values = getCollection(pos);
   TimePeriod time = new SimpleTimePeriod(date, date);
   values.getSeries(PriceHistoryRecord.OPEN).add(time, open);
   values.getSeries(PriceHistoryRecord.CLOSE).add(time, close);
 }
示例#3
0
 public void add(
     Date date,
     Position pos,
     double open,
     double close,
     double bestBidAfter,
     double bestAskAfter) {
   TimePeriodValuesCollection v = getCollection(pos);
   TimePeriod time = new SimpleTimePeriod(date, date);
   v.getSeries(PriceHistoryRecord.OPEN).add(time, open);
   v.getSeries(PriceHistoryRecord.CLOSE).add(time, close);
   v.getSeries(PriceHistoryRecord.BEST_BID).add(time, bestBidAfter);
   v.getSeries(PriceHistoryRecord.BEST_ASK).add(time, bestAskAfter);
 }
  /** Resets the display. */
  @Override
  void resetUI() {
    super.resetUI();
    XYPlot xyPlot = mChart.getXYPlot();

    AbstractXYItemRenderer br = new XYBarRenderer();
    mDatasetsSyncHist = new TimePeriodValues[NUM_AUTHS + 1];

    @SuppressWarnings("unchecked")
    Map<SimpleTimePeriod, Integer> mTimePeriodMapTmp[] = new HashMap[NUM_AUTHS + 1];
    mTimePeriodMap = mTimePeriodMapTmp;

    TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection();
    xyPlot.setDataset(tpvc);
    xyPlot.setRenderer(br);

    for (int i = 0; i < NUM_AUTHS + 1; i++) {
      br.setSeriesPaint(i, AUTH_COLORS[i]);
      mDatasetsSyncHist[i] = new TimePeriodValues(AUTH_NAMES[i]);
      tpvc.addSeries(mDatasetsSyncHist[i]);
      mTimePeriodMap[i] = new HashMap<SimpleTimePeriod, Integer>();
    }
  }
示例#5
0
 public static void addToSeries(
     TimePeriodValuesCollection vals, int series, TimePeriod time, double val) {
   vals.getSeries(series).add(time, val);
 }
示例#6
0
 public void add(Date date, Position pos, double open, double close) {
   TimePeriodValuesCollection v = getCollection(pos);
   TimePeriod time = new SimpleTimePeriod(date, date);
   v.getSeries(PriceHistoryRecord.OPEN).add(time, open);
   v.getSeries(PriceHistoryRecord.CLOSE).add(time, close);
 }