nmxprime
nmxprime

Reputation: 1506

graphview unable to zoom

Following is a simple sine wave graph display. I want to zoom in and out using pinch zoom gesture.

        data = new GraphViewData[num];
        double v=0;
        for (int i=0; i<num; i++) {
            v = 2*Math.PI*30*i;
            data[i] = new GraphViewData(i, Math.sin(v/num));
        }
            graphView = new LineGraphView(this, "GraphViewDemo");
        // add data
        graphView.addSeries(new GraphViewSeries(data));
        // set view port, here num = 256
        graphView.setViewPort(0, num-1);
        graphView.setScrollable(true);
        LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
        layout.addView(graphView);

Is there any property to be enabled to use zoom feature, or should i implement setViewPort() manually and handle zoom feature?

Upvotes: 1

Views: 1881

Answers (1)

user4149477
user4149477

Reputation:

graphView.setScalable(true);

Add this line for zooming the graph.

Upvotes: 5

Related Questions