0

I am new to android and trying to learn creation or plotting of graphs in android. I've come across 2 libraries:

  1. GraphView
  2. AndroidPlot.

My intent would be to receive some sound file and plot it on a graph. So, for this purpose which library would be better. Also I wanna know, where I can see the complete implementation or definitions of these libraries i.e. the structure and code for the API's used in the above libraries.

Also I have tried some sample codes available on net. But I'm looking for a more sophiticated code which I could develop on eclipse ADT and hence can learn something out of it.

Brais Gabin
  • 5,827
  • 6
  • 57
  • 92
user2537915
  • 11
  • 1
  • 3
  • what are you plotting the pitch? – DevZer0 Jul 01 '13 at 06:04
  • I just want to plot a sound file, over an interval of time. Could you please suggest which libraries/API's would be useful. You can also post your replies to rssinghji@gmail.com If possible provide a ssample code. – user2537915 Jul 01 '13 at 12:41

4 Answers4

1

My intent would be to receive some sound file and plot it on a graph

Neither library does this by default. The libraries are used to plot a graph given a set of data points. Getting the data points from the sound file is up to you.

So, for this purpose which library would be better.

Either library should be fine once you get the data points.

Also I wanna know, where I can see the complete implementation or definitions of these libraries i.e. the structure and code for the API's used in the above libraries.

Check out the sources for GraphView and AndroidPlot.

Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
1

I have used Achartengine some times and it works great. I modified it without difficulties.

Brais Gabin
  • 5,827
  • 6
  • 57
  • 92
0

If You are drawing simple Line Graph using canvas to draw the graph.

nilesh patel
  • 834
  • 1
  • 5
  • 10
0

Use AndroidPlot. This code draw the content of Vector(in this case filled of zeros). You only have to pass the info of the wav file to the vector. And you can check this thread for the reading issue. Android: Reading wav file and displaying its values

    plot = (XYPlot) findViewById(R.id.Grafica);
    plot.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 0.5);
    plot.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 1);

    plot.getGraphWidget().getGridBackgroundPaint().setColor(Color.rgb(255, 255, 255));
    plot.getGraphWidget().getDomainGridLinePaint().setColor(Color.rgb(255, 255, 255));
    plot.getGraphWidget().getRangeGridLinePaint().setColor(Color.rgb(255, 255, 255));

    plot.getGraphWidget().setDomainLabelPaint(null);
    plot.getGraphWidget().setRangeLabelPaint(null);
    plot.getGraphWidget().setDomainOriginLabelPaint(null);
    plot.getGraphWidget().setRangeOriginLabelPaint(null);
    plot.setBorderStyle(BorderStyle.NONE, null, null);

    plot.getLayoutManager().remove(plot.getLegendWidget());
    plot.getLayoutManager().remove(plot.getDomainLabelWidget());
    plot.getLayoutManager().remove(plot.getRangeLabelWidget());
    plot.getLayoutManager().remove(plot.getTitleWidget());


    //plot.getBackgroundPaint().setColor(Color.WHITE);
    //plot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE);

    plot.setRangeBoundaries(-25, 25, BoundaryMode.FIXED);// check that, these //boundaries wasn't for audio files 
    InicializarLasVariables();
    for(int i=0; i<min/11;i++){

        DatoY=0;
        Vector.add(DatoY);
        }
        XYSeries series = new SimpleXYSeries(Vector, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY,"");
        LineAndPointFormatter seriesFormat = new LineAndPointFormatter(Color.rgb(0, 0, 0), 0x000000, 0x000000, null);
        plot.clear();
        plot.addSeries(series, seriesFormat);
Community
  • 1
  • 1