Esempio n. 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pie_chart);
    // getActionBar().setDisplayHomeAsUpEnabled(true);

    final Context mContext = this;
    mRenderer.setApplyBackgroundColor(true);
    // mRenderer.setBackgroundColor(Color.argb(100, 80, 80, 50));
    mRenderer.setChartTitleTextSize(15);
    mRenderer.setLabelsTextSize(20);
    mRenderer.setLabelsColor(color.black);
    mRenderer.setDisplayValues(true);
    mRenderer.setLabelsColor(Color.BLACK);
    mRenderer.setLegendTextSize(20);
    mRenderer.setShowLabels(true);
    mRenderer.setMargins(new int[] {20, 30, 15, 0});
    mRenderer.setZoomButtonsVisible(true);
    mRenderer.setStartAngle(180);

    Calendar d = new GregorianCalendar();

    int yr = d.get(Calendar.YEAR);

    if (yr > 99) {
      mdate = d.get(Calendar.DATE) + "/" + d.get(Calendar.MONTH) + "/20" + (yr % 100);
    } else {
      mdate = d.get(Calendar.DATE) + "/" + d.get(Calendar.DAY_OF_MONTH) + "/19" + (yr % 100);
    }
    System.out.println("date is " + mdate);
    drawPieForSpecificDate();
    editText_specificDate = (EditText) this.findViewById(R.id.editText_specificDate);
    editText_specificDate.setCursorVisible(false);
    editText_specificDate.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // custom dialog
            flag = 1;

            final Calendar c = Calendar.getInstance();
            year = c.get(Calendar.YEAR);
            month = c.get(Calendar.MONTH);
            day = c.get(Calendar.DAY_OF_MONTH);
            DatePickerDialog datePickerDialog =
                new DatePickerDialog(mContext, PieChart_lower.this, year, month, day);

            datePickerDialog.show();
            flag = 1;
          }
        }); // button_specificDate setListener

    if (flag == 1) drawPieForSpecificDate();

    Button button_specificMonth = (Button) this.findViewById(R.id.button_specificMonth);
    alert = new AlertDialog.Builder(this);

    button_specificMonth.setVisibility(View.GONE);
  }
Esempio n. 2
0
 /**
  * Builds a category renderer to use the provided colors.
  *
  * @param colors the colors
  * @return the category renderer
  */
 public DefaultRenderer buildCategoryRenderer(int[] colors) {
   DefaultRenderer renderer = new DefaultRenderer();
   renderer.setLabelsTextSize(15);
   renderer.setLegendTextSize(15);
   renderer.setMargins(new int[] {20, 30, 15, 0});
   for (int color : colors) {
     SimpleSeriesRenderer r = new SimpleSeriesRenderer();
     r.setColor(color);
     renderer.addSeriesRenderer(r);
   }
   return renderer;
 }
Esempio n. 3
0
 protected DefaultRenderer BuildCategoryRenderer(int[] colors) {
   DefaultRenderer _Renderer = new DefaultRenderer();
   _Renderer.setZoomButtonsVisible(true);
   _Renderer.setLabelsTextSize(15);
   _Renderer.setLegendTextSize(15);
   _Renderer.setLabelsColor(Color.BLUE);
   _Renderer.setMargins(new int[] {20, 30, 15, 10});
   int _Color = 0;
   for (int i = 0; i < mModelCategoryTotal.size(); i++) {
     SimpleSeriesRenderer _R = new SimpleSeriesRenderer();
     _R.setColor(colors[_Color]);
     _Renderer.addSeriesRenderer(_R);
     _Color++;
     if (_Color > colors.length) {
       _Color = 0;
     }
   }
   return _Renderer;
 }