Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android实时图形调整用户触摸屏_Android_Real Time_Graphing - Fatal编程技术网

Android实时图形调整用户触摸屏

Android实时图形调整用户触摸屏,android,real-time,graphing,Android,Real Time,Graphing,是否有任何现有的android图形库,可以让我画一条线,可以实时触摸和拖动可调数量的线段?我目前有一个使用androidplot的工作应用程序,它可以捕获我正在扫描的内容的图像,并将这些数据绘制成图形。我需要图形下的可调线段,以便用户可以选择从数据收集的曲线和可调线段之间的积分区域 我在androidplot中找不到任何可能允许我这样做的东西,如果需要的话,我可以切换图形库。尝试查看路径。这可能是最容易使用的类 class Graph extends View { Graph(Conte

是否有任何现有的android图形库,可以让我画一条线,可以实时触摸和拖动可调数量的线段?我目前有一个使用androidplot的工作应用程序,它可以捕获我正在扫描的内容的图像,并将这些数据绘制成图形。我需要图形下的可调线段,以便用户可以选择从数据收集的曲线和可调线段之间的积分区域


我在androidplot中找不到任何可能允许我这样做的东西,如果需要的话,我可以切换图形库。

尝试查看
路径。这可能是最容易使用的类

class Graph extends View {
    Graph(Context context) {
        super(context);
        // ... Init paints
    }

    @Override public void onDraw(Canvas canvas) {
        canvas.save(MATRIX_SAVE_FLAG);

        // Draw Y-axis
        canvas.drawLine(axisOffset, axisOffset, axisOffset, canvasHeight-axisOffset, paint);
        // Draw X-axis
        canvas.drawLine(axisOffset, canvasHeight-axisOffset, canvasWidth-axisOffset, canvasHeight-axisOffset, paint);
        canvas.drawPath(new RectF(0.0f, 0.0f, 1.0f, 1.0f), mPath, paint);
        canvas.restore();
    }

    Path mPath = new Path(); // your open path
    float canvasWidth = 1.0f;
    float canvasHeight= 1.0f;
    float axisOffset = 0.1f; // The offset from the border of the canvas

    public void registerDataPlot(int xCoord, int yCoord) {
        // You need to convert the plot data to a location on the canvas
        // Just find the percent value from the base of the axis
        float x = xCoord / (canvasWidth - (2*axisOffset));
        float y = yCoord / (canvasHeight - (2*axisOffset));
        mPath.lineTo(x, y);
    }

你是建议用路径覆盖吗?问题是,如何将路径线的位置与绘制到视图的图表上的相应区域相协调?图表上的点数取决于扫描图像的分辨率,图表的大小取决于分辨率和屏幕方向。是。我用你如何绘制数据更新了我的答案。解析仅仅基于调用
registerDataPlot(int,int)的频率你是说mPath.lineTo(x,y);?我一辈子都不知道如何在我的图形活动视图上绘制一幅透明的全屏画布,你能再详细一点吗?这是关于jist的。只要将图形视图添加到需要的位置即可。然后,当您获得数据时,调用
registerDataPlot(int,int)。如果需要移动图形,则创建一个偏移量变量并按该偏移量平移画布。如果你这样做,我会平移,画路径,然后画轴。