0

i'm using

GraphViewSeries g1 = new GraphViewSeries("",
    new GraphViewSeriesStyle(Color.WHITE, 1/3),new GraphViewData[] {
            new GraphViewData(-5,0d),
            new GraphViewData(5,0d),

    });

GraphViewSeries g2 = new GraphViewSeries("",
    new GraphViewSeriesStyle(Color.WHITE, 1/3),new GraphViewData[] {
            new GraphViewData(0,-5d),
            new GraphViewData(0,5d),

    });

GraphViewSeries g3 = new GraphViewSeries("",
    new GraphViewSeriesStyle(Color.WHITE, 1/3),new GraphViewData[] {
            new GraphViewData(-5,-5d),
            new GraphViewData(5,-5d),

    });

    graphView.getGraphViewStyle().setNumVerticalLabels(11);
    graphView.getGraphViewStyle().setNumHorizontalLabels(11);
    graphView.setManualYAxisBounds(5, -5);
    graphView.setViewPort(-5,10); 



    int screenX = (int)event.getX();
    int screenY =(int) event.getY();

I set the labels 11 for both horizontal and vertical .. using this getX() and GetY() method I got the values like 414,403 and etc..it shows the values beyond the i'm mentioned values how can i get x,y values like 1,0 and -1,3 etc.. that means i given GraphViewData..

Kousik
  • 21,485
  • 7
  • 36
  • 59
Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48

1 Answers1

0

For setting up y axies you can do

graphView.setManualYAxisBounds(5, -5); // min=-5, max=5
graphView.getGraphViewStyle().setNumVerticalLabels(11); // will have 11 y axis lables

the above code will make y axis with values -5, -4, -3, .... , 4, 5. (and they will remain like this always).

and for x axis use

setViewPort(-5, 1); // start position=-5, size=1

above code starts will make x axis start from -5 with size of 1.

Kushal Sharma
  • 5,978
  • 5
  • 25
  • 41
  • i need to getX() and getY().. when i'm touch the graphview co-ordinate 0,0 means it should show x=0,y=0 at toast view but it gives value like 263,215 .. how can i get the exact co-ordinate values – Sathish Kumar J Sep 18 '14 at 04:32