@Override
  public void onCreate(Bundle savedInstanceState) {

    // android boilerplate stuff
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dynamicxyplot_example);

    // get handles to our View defined in layout.xml:
    dynamicPlot = (XYPlot) findViewById(R.id.dynamicXYPlot);

    plotUpdater = new MyPlotUpdater(dynamicPlot);

    // only display whole numbers in domain labels
    dynamicPlot.getGraphWidget().setDomainValueFormat(new DecimalFormat("0"));

    // getInstance and position datasets:
    data = new SampleDynamicXYDatasource();
    SampleDynamicSeries sine1Series = new SampleDynamicSeries(data, 0, "Sine 1");
    SampleDynamicSeries sine2Series = new SampleDynamicSeries(data, 1, "Sine 2");

    LineAndPointFormatter formatter1 =
        new LineAndPointFormatter(Color.rgb(0, 0, 0), null, null, null);
    formatter1.getLinePaint().setStrokeJoin(Paint.Join.ROUND);
    formatter1.getLinePaint().setStrokeWidth(10);
    dynamicPlot.addSeries(sine1Series, formatter1);

    LineAndPointFormatter formatter2 =
        new LineAndPointFormatter(Color.rgb(0, 0, 200), null, null, null);
    formatter2.getLinePaint().setStrokeWidth(10);
    formatter2.getLinePaint().setStrokeJoin(Paint.Join.ROUND);

    // formatter2.getFillPaint().setAlpha(220);
    dynamicPlot.addSeries(sine2Series, formatter2);

    // hook up the plotUpdater to the data model:
    data.addObserver(plotUpdater);

    // thin out domain tick labels so they dont overlap each other:
    dynamicPlot.setDomainStepMode(XYStepMode.INCREMENT_BY_VAL);
    dynamicPlot.setDomainStepValue(5);

    dynamicPlot.setRangeStepMode(XYStepMode.INCREMENT_BY_VAL);
    dynamicPlot.setRangeStepValue(10);

    dynamicPlot.setRangeValueFormat(new DecimalFormat("###.#"));

    // uncomment this line to freeze the range boundaries:
    dynamicPlot.setRangeBoundaries(-100, 100, BoundaryMode.FIXED);

    // create a dash effect for domain and range grid lines:
    DashPathEffect dashFx =
        new DashPathEffect(new float[] {PixelUtils.dpToPix(3), PixelUtils.dpToPix(3)}, 0);
    dynamicPlot.getGraphWidget().getDomainGridLinePaint().setPathEffect(dashFx);
    dynamicPlot.getGraphWidget().getRangeGridLinePaint().setPathEffect(dashFx);
  }
Example #2
0
  /**
   * DESCRIPTION: Creates the graph.
   *
   * @see android.app.Activity#onCreate(android.os.Bundle)
   */
  public void onCreate(Bundle savedInstanceState, Activity parent, XYPlot xyplot) {
    this.activity = parent;
    this.plot = xyplot;

    // get current units of measurement
    units = new Units(Settings.KEY_UNITS);

    // create a formatter to use for drawing the plot series
    plotFormatter =
        new BarFormatter(
            activity.getResources().getColor(R.color.plot_fill_color),
            activity.getResources().getColor(R.color.plot_line_color));

    // create a formatter for average label
    float hOffset = 50f;
    float vOffset = -10f;
    avgLabelFormatter =
        new PointLabelFormatter(
            activity.getResources().getColor(R.color.plot_avgline_color), hOffset, vOffset);

    // create a formatter to use for drawing the average line
    avgFormatter =
        new LineAndPointFormatter(
            activity.getResources().getColor(R.color.plot_avgline_color),
            null,
            null,
            avgLabelFormatter);

    // white background for the plot
    plot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE);

    // remove the series legend
    plot.getLayoutManager().remove(plot.getLegendWidget());

    // make room for bigger labels
    // TODO: is there a better way to do this?
    float width = plot.getGraphWidget().getRangeLabelWidth() * 2f;
    plot.getGraphWidget().setRangeLabelWidth(width);
    width = plot.getGraphWidget().getDomainLabelWidth() * 1.5f;
    plot.getGraphWidget().setDomainLabelWidth(width);
    float margin = plot.getGraphWidget().getMarginTop() * 3f;
    plot.getGraphWidget().setMarginTop(margin);
    margin = plot.getGraphWidget().getMarginBottom() * 3f;
    plot.getGraphWidget().setMarginBottom(margin);

    // define plot axis labels
    plot.setRangeLabel(units.getLiquidVolumeLabel());
    plot.setDomainLabel(activity.getString(R.string.months_label));

    // specify format of axis value labels
    plot.setRangeValueFormat(ylabels);
    plot.setDomainValueFormat(xlabels);

    // plot the data
    drawPlot();
  }
Example #3
0
  @SuppressWarnings("deprecation")
  public void drawGraph(
      XYPlot plot, List<Number> xseries, List<Number> yseries, String datatitle, String title) {
    //		Log.d(SystemInfo.TIG, TAG + "::drawGraph()");

    // set up data series
    plot.removeSeries(series);

    series = new SimpleXYSeries(xseries, yseries, datatitle);

    // create a formatter
    // TODO solve deprecation waring
    LineAndPointFormatter format =
        new LineAndPointFormatter(
            Color.rgb(0, 200, 0) // line color
            ,
            Color.rgb(0, 100, 0) // point color
            ,
            Color.rgb(150, 190, 150)); // fill color (optional)

    // add series1 and series2 to the XYPlot
    plot.addSeries(series, format);

    // Reduce the number of range labels
    plot.setTicksPerRangeLabel(3);
    plot.getBackgroundPaint().setAlpha(0);
    plot.getGraphWidget().getBackgroundPaint().setAlpha(0);
    plot.getGraphWidget().getGridBackgroundPaint().setAlpha(0);

    // TODO implement an on-the-fly refresh of the plot
    // this is just a small "stubbed" redraw for demonstration purposes
    plot.setDomainStepMode(XYStepMode.SUBDIVIDE);
    plot.setDomainStepValue(1);
    plot.setGridPadding(0, 5, 0, 5);

    plot.setDomainLabel("Time [s]");
    if (title.equals(SystemInfo.DB_TABLENAME_BATTERY)) {
      plot.setTitle(SystemInfo.DB_TABLENAME_BATTERY);
      plot.setRangeLabel("[%]");
      plot.setRangeBoundaries(0, 100, BoundaryMode.FIXED);

    } else if (title.equals(SystemInfo.DB_TABLENAME_WIFI)) {
      plot.setTitle(SystemInfo.DB_TABLENAME_WIFI);
      plot.setRangeLabel("[~mW]");
      plot.setRangeBoundaries(0, 500, BoundaryMode.FIXED);

    } else if (title.equals(SystemInfo.DB_TABLENAME_THREEG)) {
      plot.setTitle(SystemInfo.DB_TABLENAME_THREEG);
      plot.setRangeLabel("[~mW]");
      plot.setRangeBoundaries(0, 500, BoundaryMode.FIXED);

    } else if (title.equals(SystemInfo.DB_TABLENAME_BLUETOOTH)) {
      plot.setTitle(SystemInfo.DB_TABLENAME_BLUETOOTH);
      plot.setRangeLabel("[~mW]");
      plot.setRangeBoundaries(0, 500, BoundaryMode.FIXED); // XXX scale
    }
    plot.redraw();
  }
    // Constructor sets up the series
    public mPlotUpdater(XYPlot plot) {
      this.plot = plot;
      // only display whole numbers in domain labels
      plot.getGraphWidget().setDomainValueFormat(new DecimalFormat("0"));

      // Line plot
      if (dispForm == "WAVE") {
        LineAndPointFormatter maxFormat =
            new LineAndPointFormatter(
                Color.rgb(0, 25, 250), // line color
                Color.rgb(0, 25, 250), // point color
                null); // fill color (optional)

        LineAndPointFormatter minFormat =
            new LineAndPointFormatter(
                Color.rgb(250, 25, 0), // line color
                Color.rgb(250, 25, 0), // point color
                null); // fill color (optional)

        LineAndPointFormatter audioFormat =
            new LineAndPointFormatter(
                Color.rgb(25, 250, 0), // line color
                Color.rgb(25, 250, 0), // point color
                null); // fill color (optional)

        plot.addSeries(audioHistSeries, audioFormat);
        plot.addSeries(maxSeries, maxFormat);
        plot.addSeries(minSeries, minFormat);
      }
      // Bar plot
      if (dispForm == "FFT") {
        plot.addSeries(
            audioHistSeries,
            BarRenderer.class,
            new BarFormatter(Color.argb(100, 0, 200, 0), Color.rgb(0, 80, 0)));
      }

      // thin out domain/range tick labels so they don't overlap each other:
      plot.setGridPadding(5, 0, 5, 0);
      plot.setTicksPerDomainLabel(5);
      plot.setTicksPerRangeLabel(3);
      plot.disableAllMarkup();

      // freeze the range boundaries:
      plot.setDomainStepMode(XYStepMode.INCREMENT_BY_VAL);
      plot.setDomainStepValue(1);
      plot.setTicksPerRangeLabel(6);
      if (dispForm == "WAVE") plot.setDomainLabel("Time");
      if (dispForm == "FFT ") plot.setDomainLabel("Frequency");
      plot.getDomainLabelWidget().pack();
      plot.setRangeLabel("Amplitude");
      plot.getRangeLabelWidget().pack();
      plot.disableAllMarkup();
    }
  @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);
  }
Example #6
0
  /** DESCRIPTION: Adjust font sizes used for plot labels to reflect shared preferences. */
  private void setPlotFontSizes() {
    PlotFontSize size = new PlotFontSize(activity, Settings.KEY_PLOT_FONT_SIZE);

    // plot title label
    PaintUtils.setFontSizeDp(plot.getTitleWidget().getLabelPaint(), size.getSizeDp());
    plot.getTitleWidget().pack();

    // axis step value labels
    PaintUtils.setFontSizeDp(plot.getGraphWidget().getRangeLabelPaint(), size.getSizeDp());
    PaintUtils.setFontSizeDp(plot.getGraphWidget().getDomainLabelPaint(), size.getSizeDp());

    // axis origin value labels
    PaintUtils.setFontSizeDp(plot.getGraphWidget().getRangeOriginLabelPaint(), size.getSizeDp());
    PaintUtils.setFontSizeDp(plot.getGraphWidget().getDomainOriginLabelPaint(), size.getSizeDp());

    // axis title labels
    PaintUtils.setFontSizeDp(plot.getRangeLabelWidget().getLabelPaint(), size.getSizeDp());
    PaintUtils.setFontSizeDp(plot.getDomainLabelWidget().getLabelPaint(), size.getSizeDp());
    plot.getRangeLabelWidget().pack();
    plot.getDomainLabelWidget().pack();

    // average point label
    avgLabelFormatter.getTextPaint().setTextSize(PixelUtils.dpToPix(size.getSizeDp()));
  }
Example #7
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.poincare);

    // Rellenar vector RR1
    for (int i = 1; i < Representar.RR.size(); i++) {
      RR1.add(Representar.RR.get(i));
    }
    // Rellenar vector RRaux
    for (int i = 0; i < Representar.RR.size() - 1; i++) {
      RRaux.add(Representar.RR.get(i));

      Log.i("RRaux", String.valueOf(Representar.RR.get(i)));
    }

    // Declarar el Plot
    mySimpleXYPlot = (XYPlot) findViewById(R.id.plotPoincare);

    // Configurar el Plot
    XYSeries series1 =
        new SimpleXYSeries(
            RRaux, // Vector a representar en el eje X
            RR1, // Vector a representar en el eje Y
            "Poincaré"); // Etiqueta

    LineAndPointFormatter series1Format =
        new LineAndPointFormatter(
            Color.TRANSPARENT, // Color de la línea
            Color.rgb(
                Representar.color0, Representar.color1, Representar.color2), // Color de los puntos
            null); // Color de relleno

    // Propiedades para configurar el Plot
    mySimpleXYPlot.addSeries(series1, series1Format);
    mySimpleXYPlot.setTicksPerRangeLabel(4);
    mySimpleXYPlot.disableAllMarkup();
    mySimpleXYPlot.getBackgroundPaint().setAlpha(0);
    mySimpleXYPlot.getGraphWidget().getBackgroundPaint().setAlpha(0);
    mySimpleXYPlot.getGraphWidget().getGridBackgroundPaint().setAlpha(0);
    // Redibujar el Plot
    mySimpleXYPlot.redraw();

    // Configuración boundaries
    mySimpleXYPlot.calculateMinMaxVals();
    // Cálculo del valor mínimo y máximo
    minXY =
        new PointF(
            mySimpleXYPlot.getCalculatedMinX().floatValue(),
            mySimpleXYPlot.getCalculatedMinY().floatValue());
    maxXY =
        new PointF(
            mySimpleXYPlot.getCalculatedMaxX().floatValue(),
            mySimpleXYPlot.getCalculatedMaxY().floatValue());
    mySimpleXYPlot.setScrollbarFadingEnabled(true);
    mySimpleXYPlot.setScrollContainer(true);

    mySimpleXYPlot.getLayoutManager().remove(mySimpleXYPlot.getLegendWidget());
    // Etiquetas vertical y horizontal
    mySimpleXYPlot.setRangeLabel("RR N+1");
    mySimpleXYPlot.setDomainLabel("RR N");
    mySimpleXYPlot.getLayoutManager().remove(mySimpleXYPlot.getTitleWidget());
    // Márgenes del Plot
    mySimpleXYPlot.setPlotMargins(10, 10, 10, 10);
    mySimpleXYPlot.setPlotPadding(10, 10, 10, 10);
    // Comienzo y fin del plot
    mySimpleXYPlot.setDomainBoundaries(
        mySimpleXYPlot.getCalculatedMinX().floatValue() - 10.0,
        mySimpleXYPlot.getCalculatedMaxX().floatValue() + 10.0,
        BoundaryMode.FIXED);
    mySimpleXYPlot.setRangeBoundaries(
        mySimpleXYPlot.getCalculatedMinY().floatValue() - 10.0,
        mySimpleXYPlot.getCalculatedMaxY().floatValue() + 10.0,
        BoundaryMode.FIXED);
  }
Example #8
0
  private void ShowPlot() {
    mySimpleXYPlot = (XYPlot) findViewById(R.id.chartPlot);
    mySimpleXYPlot.setTitle("Weight");

    if (plotLine != null) mySimpleXYPlot.removeSeries(plotLine);

    mySimpleXYPlot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE);
    mySimpleXYPlot.getGraphWidget().getGridLinePaint().setColor(Color.BLACK);
    mySimpleXYPlot
        .getGraphWidget()
        .getGridLinePaint()
        .setPathEffect(new DashPathEffect(new float[] {1, 1}, 1));
    mySimpleXYPlot.getGraphWidget().getDomainOriginLinePaint().setColor(Color.BLACK);
    mySimpleXYPlot.getGraphWidget().getRangeOriginLinePaint().setColor(Color.BLACK);

    mySimpleXYPlot.setBorderStyle(Plot.BorderStyle.SQUARE, null, null);
    mySimpleXYPlot.getBorderPaint().setStrokeWidth(1);
    mySimpleXYPlot.getBorderPaint().setAntiAlias(false);
    mySimpleXYPlot.getBorderPaint().setColor(Color.WHITE);
    mySimpleXYPlot.getGraphWidget().setPaddingRight(5);

    // Create a formatter to use for drawing a series using LineAndPointRenderer:
    LineAndPointFormatter series1Format =
        new LineAndPointFormatter(
            Color.rgb(0, 100, 0), // line color
            Color.rgb(0, 100, 0), // point color
            Color.rgb(100, 200, 0)); // fill color

    // setup our line fill paint to be a slightly transparent gradient:
    Paint lineFill = new Paint();
    lineFill.setAlpha(200);
    lineFill.setShader(
        new LinearGradient(0, 0, 0, 250, Color.WHITE, Color.GREEN, Shader.TileMode.MIRROR));

    LineAndPointFormatter formatter =
        new LineAndPointFormatter(Color.rgb(0, 0, 0), Color.BLUE, Color.RED);
    formatter.setFillPaint(lineFill);

    plotLine = new SimpleXYSeries(Arrays.asList(dates), Arrays.asList(weights), "Weight over time");
    mySimpleXYPlot.addSeries(plotLine, formatter);
    mySimpleXYPlot.redraw();

    // draw a domain tick for each year:
    int min = DomainMin();
    int max = DomainMax();
    int domainStep = domainStep(min, max);
    mySimpleXYPlot.setDomainStep(XYStepMode.SUBDIVIDE, domainStep);
    // mySimpleXYPlot.setDomainBoundaries(min, max, BoundaryMode.AUTO);

    // customize our domain/range labels
    mySimpleXYPlot.setDomainLabel("Date");
    mySimpleXYPlot.setRangeLabel("Weight");

    Double minimum = FindMinimum();
    Double maximum = FindMaximum();
    Double stepSize = FindStep(maximum, minimum);
    mySimpleXYPlot.setRangeBoundaries(minimum, maximum, BoundaryMode.FIXED);
    mySimpleXYPlot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, stepSize);

    mySimpleXYPlot.setDomainValueFormat(
        new Format() {
          private SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM");

          @Override
          public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {

            // because our timestamps are in seconds and SimpleDateFormat expects milliseconds
            // we multiply our timestamp by 1000:
            long timestamp = ((Number) obj).longValue() * 1000;
            Date date = new Date(timestamp);
            return dateFormat.format(date, toAppendTo, pos);
          }

          @Override
          public Object parseObject(String source, ParsePosition pos) {
            return null;
          }
        });

    // by default, AndroidPlot displays developer guides to aid in laying out your plot.
    // To get rid of them call disableAllMarkup():
    mySimpleXYPlot.disableAllMarkup();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // fun little snippet that prevents users from taking screenshots
    // on ICS+ devices :-)
    // getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
    //        WindowManager.LayoutParams.FLAG_SECURE);

    setContentView(R.layout.simple_xy_plot_example);

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

    StockProvider sHelper = new StockProvider(this);
    Uri stockUri = null;

    String stockName = getIntent().getStringExtra("KEY");
    plot.setTitle(stockName);
    switch (stockName) {
      case "IBM":
        stockUri = StockContract.StockEntry.CONTENT_URI_IBM;
        break;
      case "MSFT":
        stockUri = StockContract.StockEntry.CONTENT_URI_MSFT;
        break;
      case "GOOG":
        stockUri = StockContract.StockEntry.CONTENT_URI_GOOG;
        break;
      case "AAPL":
        stockUri = StockContract.StockEntry.CONTENT_URI_AAPL;
    }

    Cursor values = sHelper.query(stockUri, null, null, null, null);

    ArrayList<Double> open = new ArrayList<Double>();
    ArrayList<Double> high = new ArrayList<Double>();
    ArrayList<Double> low = new ArrayList<Double>();
    ArrayList<Double> close = new ArrayList<Double>();

    for (values.moveToFirst(); !values.isAfterLast(); values.moveToNext()) {

      open.add(Double.parseDouble(values.getString(2)));
      high.add(Double.parseDouble(values.getString(3)));
      low.add(Double.parseDouble(values.getString(4)));
      close.add(Double.parseDouble(values.getString(5)));
    }
    Double[] openArray = new Double[open.size()];
    Double[] highArray = new Double[open.size()];
    Double[] lowArray = new Double[open.size()];
    Double[] closeArray = new Double[open.size()];
    double openI = open.get(0);
    for (int i = 0; i < open.size(); i++) {
      openArray[i] = open.get(i) / openI * 100;
      highArray[i] = high.get(i);
      lowArray[i] = low.get(i);
      closeArray[i] = close.get(i);
    }
    Double[] open5Array = new Double[open.size() / 5 + 1];
    Double[] high5Array = new Double[open.size() / 5 + 1];
    Double[] low5Array = new Double[open.size() / 5 + 1];
    Double[] close5Array = new Double[open.size() / 5 + 1];

    for (int i = 0; i < open.size(); i += 5) {
      open5Array[i / 5] = open.get(i) / openI * 100;
      double localHigh = high.get(i);
      double localLow = low.get(i);
      for (int j = 0; j < 5; j++) {
        if (i + j > 387) break;
        if ((i + j) < 388 && localHigh < high.get(i + j)) {
          localHigh = high.get(i + j);
        }
        if ((i + j) < 388 && localLow < low.get(i + j)) {
          localLow = low.get(i + j);
        }
        if (j == 4) {
          close5Array[i / 5] = close.get(i + j);
        }
      }
      high5Array[i / 5] = localHigh;
      low5Array[i / 5] = localLow;
    }

    // Create a couple arrays of y-values to plot:
    Number[] series1Numbers = open5Array; // {1, 8, 5, 2, 7, 4};
    Number[] series2Numbers = high5Array; // {4, 6, 3, 8, 2, 10};
    Number[] series3Numbers = low5Array;
    Number[] series4Numbers = close5Array;

    // Turn the above arrays into XYSeries':
    XYSeries series1 =
        new SimpleXYSeries(
            Arrays.asList(series1Numbers),
            SimpleXYSeries.ArrayFormat.Y_VALS_ONLY,
            "Open"); // Set the display title of the series

    XYSeries series2 =
        new SimpleXYSeries(
            Arrays.asList(series2Numbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "High");
    XYSeries series3 =
        new SimpleXYSeries(
            Arrays.asList(series3Numbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Low");
    XYSeries series4 =
        new SimpleXYSeries(
            Arrays.asList(series4Numbers), SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Close");

    // Create a formatter to use for drawing a series using LineAndPointRenderer
    // and configure it from xml:
    myLineAndPointFormatter series1Format = new myLineAndPointFormatter();
    series1Format.setPointLabelFormatter(new myPointLabelFormatter());
    series1Format.configure(getApplicationContext(), R.xml.line_point_formatter_with_plf1);

    // add a new series' to the xyplot:
    plot.addSeries(series1, series1Format);
    //
    //        // same as above:
    //        myLineAndPointFormatter series2Format = new myLineAndPointFormatter();
    //        series2Format.setPointLabelFormatter(new myPointLabelFormatter() );
    //        series2Format.configure(getApplicationContext(),
    //                R.xml.line_point_formatter_with_plf2);
    //        plot.addSeries(series2, series2Format);
    //
    //        myLineAndPointFormatter series3Format = new myLineAndPointFormatter();
    //        series3Format.setPointLabelFormatter(new myPointLabelFormatter() );
    //        series3Format.configure(getApplicationContext(),
    //                R.xml.line_point_formatter_with_plf3);
    //        plot.addSeries(series3, series3Format);
    //
    //        myLineAndPointFormatter series4Format = new myLineAndPointFormatter();
    //        series4Format.setPointLabelFormatter(new myPointLabelFormatter() );
    //        series4Format.configure(getApplicationContext(),
    //                R.xml.line_point_formatter_with_plf4);
    //        plot.addSeries(series4, series4Format);

    // reduce the number of range labels
    plot.setTicksPerRangeLabel(1);
    plot.getGraphWidget().setDomainLabelOrientation(-90);
    plot.getGraphWidget().setDomainValueFormat(new DecimalFormat("####"));
  }