@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.data_layout);

    d_pb_ll = (LinearLayout) findViewById(R.id.data_progressbar_ll);
    dataUsedText = (TextView) findViewById(R.id.dataUsedText);
    mProgress = (ProgressBar) findViewById(R.id.percentDataUsed);
    dell = (LinearLayout) findViewById(R.id.data_error);
    detv = (TextView) findViewById(R.id.tv_failure);
    deb = (Button) findViewById(R.id.button_send_data);
    actionbar = getSupportActionBar();
    actionbar.setTitle("Data Usage");
    actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionbar.setHomeButtonEnabled(true);
    actionbar.setDisplayHomeAsUpEnabled(true);

    graph = (XYPlot) findViewById(R.id.mySimpleXYPlot);
    graph.setOnTouchListener(this);
    graph.setMarkupEnabled(false);

    labels = new Long[288];
    downdata = new Float[288];
    totaldata = new Float[288];

    httpclient = ConnectionHelper.getThreadSafeClient();
    httpclient.getCookieStore().clear();
    BasicClientCookie cookie =
        new BasicClientCookie("AUTHCOOKIE", ConnectionHelper.getPNAAuthCookie(this, httpclient));
    cookie.setDomain(".pna.utexas.edu");
    httpclient.getCookieStore().addCookie(cookie);
    new fetchDataTask(httpclient).execute();
    new fetchProgressTask(httpclient).execute();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.zoomscrollgraph);
    mySimpleXYPlot = (XYPlot) findViewById(R.id.mySimpleXYPlot);
    mySimpleXYPlot.setOnTouchListener(this);

    // Plot layout configurations
    mySimpleXYPlot.getGraphWidget().setTicksPerRangeLabel(1);
    mySimpleXYPlot.getGraphWidget().setTicksPerDomainLabel(1);
    mySimpleXYPlot.getGraphWidget().setRangeValueFormat(new DecimalFormat("#####.##"));
    mySimpleXYPlot.getGraphWidget().setDomainValueFormat(new DecimalFormat("#####.##"));
    mySimpleXYPlot.getGraphWidget().setRangeLabelWidth(25);
    mySimpleXYPlot.setRangeLabel("");
    mySimpleXYPlot.setDomainLabel("");
    mySimpleXYPlot.disableAllMarkup();

    // Creation of the series
    final Vector<Double> vector = new Vector<Double>();
    for (double x = 0.0; x < Math.PI * 5; x += Math.PI / 20) {
      vector.add(x);
      vector.add(Math.sin(x));
    }
    mySeries = new SimpleXYSeries(vector, ArrayFormat.Y_VALS_ONLY, "Series Name");

    // colors: (line, vertex, fill)
    mySimpleXYPlot.addSeries(
        mySeries,
        LineAndPointRenderer.class,
        new LineAndPointFormatter(
            Color.rgb(0, 200, 0), Color.rgb(200, 0, 0), Color.argb(100, 0, 0, 100)));

    // Enact all changes
    mySimpleXYPlot.redraw();

    // Set of internal variables for keeping track of the boundaries
    mySimpleXYPlot.calculateMinMaxVals();
    m_viewPort = new Viewport(mySimpleXYPlot);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.bar_plot_example);

    // initialize our XYPlot reference:
    plot = (XYPlot) findViewById(R.id.plot);

    formatter1 = new MyBarFormatter(Color.rgb(100, 150, 100), Color.LTGRAY);
    formatter1.setMarginLeft(PixelUtils.dpToPix(1));
    formatter1.setMarginRight(PixelUtils.dpToPix(1));
    formatter2 = new MyBarFormatter(Color.rgb(100, 100, 150), Color.LTGRAY);
    formatter2.setMarginLeft(PixelUtils.dpToPix(1));
    formatter2.setMarginRight(PixelUtils.dpToPix(1));
    selectionFormatter = new MyBarFormatter(Color.YELLOW, Color.WHITE);

    selectionWidget =
        new TextLabelWidget(
            plot.getLayoutManager(),
            NO_SELECTION_TXT,
            new Size(
                PixelUtils.dpToPix(100), SizeMode.ABSOLUTE,
                PixelUtils.dpToPix(100), SizeMode.ABSOLUTE),
            TextOrientation.HORIZONTAL);

    selectionWidget.getLabelPaint().setTextSize(PixelUtils.dpToPix(16));

    // add a dark, semi-transparent background to the selection label widget:
    Paint p = new Paint();
    p.setARGB(100, 0, 0, 0);
    selectionWidget.setBackgroundPaint(p);

    selectionWidget.position(
        0,
        HorizontalPositioning.RELATIVE_TO_CENTER,
        PixelUtils.dpToPix(45),
        VerticalPositioning.ABSOLUTE_FROM_TOP,
        Anchor.TOP_MIDDLE);
    selectionWidget.pack();

    // reduce the number of range labels
    plot.setLinesPerRangeLabel(3);
    plot.setRangeLowerBoundary(0, BoundaryMode.FIXED);

    plot.setLinesPerDomainLabel(2);

    // setup checkbox listers:
    series1CheckBox = (CheckBox) findViewById(R.id.s1CheckBox);
    series1CheckBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            onS1CheckBoxClicked(b);
          }
        });

    series2CheckBox = (CheckBox) findViewById(R.id.s2CheckBox);
    series2CheckBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            onS2CheckBoxClicked(b);
          }
        });

    plot.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
              onPlotClicked(new PointF(motionEvent.getX(), motionEvent.getY()));
            }
            return true;
          }
        });

    spRenderStyle = (Spinner) findViewById(R.id.spRenderStyle);
    ArrayAdapter<BarRenderer.BarOrientation> adapter =
        new ArrayAdapter<BarRenderer.BarOrientation>(
            this, android.R.layout.simple_spinner_item, BarRenderer.BarOrientation.values());
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spRenderStyle.setAdapter(adapter);
    spRenderStyle.setSelection(BarRenderer.BarOrientation.OVERLAID.ordinal());
    spRenderStyle.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            updatePlot();
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });

    spWidthStyle = (Spinner) findViewById(R.id.spWidthStyle);
    ArrayAdapter<BarRenderer.BarGroupWidthMode> adapter1 =
        new ArrayAdapter<BarRenderer.BarGroupWidthMode>(
            this, android.R.layout.simple_spinner_item, BarRenderer.BarGroupWidthMode.values());
    adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spWidthStyle.setAdapter(adapter1);
    spWidthStyle.setSelection(BarRenderer.BarGroupWidthMode.FIXED_WIDTH.ordinal());
    spWidthStyle.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            if (BarRenderer.BarGroupWidthMode.FIXED_WIDTH.equals(spWidthStyle.getSelectedItem())) {
              sbFixedWidth.setVisibility(View.VISIBLE);
              sbVariableWidth.setVisibility(View.INVISIBLE);
            } else {
              sbFixedWidth.setVisibility(View.INVISIBLE);
              sbVariableWidth.setVisibility(View.VISIBLE);
            }
            updatePlot();
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });

    spSeriesSize = (Spinner) findViewById(R.id.spSeriesSize);
    ArrayAdapter<SeriesSize> adapter11 =
        new ArrayAdapter<SeriesSize>(
            this, android.R.layout.simple_spinner_item, SeriesSize.values());
    adapter11.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spSeriesSize.setAdapter(adapter11);
    spSeriesSize.setSelection(SeriesSize.TEN.ordinal());
    spSeriesSize.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            final SeriesSize selectedSize = (SeriesSize) arg0.getSelectedItem();
            switch (selectedSize) {
              case TEN:
                series1Numbers = series1Numbers10;
                series2Numbers = series2Numbers10;
                break;
              case TWENTY:
                series1Numbers = series1Numbers20;
                series2Numbers = series2Numbers20;
                break;
              case SIXTY:
                series1Numbers = series1Numbers60;
                series2Numbers = series2Numbers60;
                break;
              default:
                break;
            }
            updatePlot(selectedSize);
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {}
        });

    sbFixedWidth = (SeekBar) findViewById(R.id.sbFixed);
    sbFixedWidth.setProgress(50);
    sbFixedWidth.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            updatePlot();
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}
        });

    sbVariableWidth = (SeekBar) findViewById(R.id.sbVariable);
    sbVariableWidth.setProgress(1);
    sbVariableWidth.setVisibility(View.INVISIBLE);
    sbVariableWidth.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {
          @Override
          public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            updatePlot();
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {}
        });

    plot.getGraph()
        .getLineLabelStyle(XYGraphWidget.Edge.BOTTOM)
        .setFormat(
            new NumberFormat() {
              @Override
              public StringBuffer format(double value, StringBuffer buffer, FieldPosition field) {
                int year = (int) (value + 0.5d) / 12;
                int month = (int) ((value + 0.5d) % 12);
                return new StringBuffer(
                    DateFormatSymbols.getInstance().getShortMonths()[month] + " '0" + year);
              }

              @Override
              public StringBuffer format(long value, StringBuffer buffer, FieldPosition field) {
                throw new UnsupportedOperationException("Not yet implemented.");
              }

              @Override
              public Number parse(String string, ParsePosition position) {
                throw new UnsupportedOperationException("Not yet implemented.");
              }
            });
    updatePlot();
  }