Ejemplo n.º 1
0
  @Override
  protected void doForeGround() throws Exception {
    xValues.clear();
    yValues.clear();
    if (returnList != null) {
      Log.e(TAG, "returnList.size()=" + returnList.size());
      if (returnList.size() > 0) {
        getValues(returnList);
      } else {
        xValues.add(new double[] {1, 2, 3, 4, 5, 6});
        yValues.add(new double[] {0, 0, 0, 0, 0, 0});

        Log.e(TAG, "returnList.size()=0");
        ToastUtil.show(mContext, "无数据!");
        // return;
      }
    } else {

      xValues.add(new double[] {1, 2, 3, 4, 5, 6});
      yValues.add(new double[] {0, 0, 0, 0, 0, 0});

      Log.e(TAG, "returnList==null");
      ToastUtil.show(mContext, "网络连接异常!");
      // return;
    }
    double max = AppUtil.getMax(yValues);
    double xLimits = returnList.size();
    Log.d(TAG, "max=" + max);
    double maxPlus = max * 0.1;
    mRenderer.setYAxisMax(max + maxPlus);
    mRenderer.setPanLimits(new double[] {0, xLimits + 0.5, 0, mRenderer.getYAxisMax()});
    Log.e(TAG, "mRenderer.isClickEnabled()=" + mRenderer.isClickEnabled());
    initMultipleBar(xValues, yValues);
    Log.d(TAG, "mRenderer.getYAxisMax()=" + mRenderer.getYAxisMax());
    // mRenderer.setSelectableBuffer(35);
    // mRenderer.setClickEnabled(true);
    mChartView.repaint();
    mChartView.invalidate();
    /*
     * mChartView.setOnTouchListener(new OnTouchListener() {
     *
     * @Override public boolean onTouch(View v, MotionEvent event) { // TODO
     * Auto-generated method stub return false; } });
     */
  }
 public PlotBoundaries(@NotNull XYMultipleSeriesRenderer renderer) {
   this.xMin = renderer.getXAxisMin();
   this.yMin = renderer.getYAxisMin();
   this.xMax = renderer.getXAxisMax();
   this.yMax = renderer.getYAxisMax();
 }