Android的路径,实时图表 [英] Android Paths for real time charting

查看:253
本文介绍了Android的路径,实时图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个实时图表android的效用,而且在大多数情况下它的工作原理,但我在我的路径它打破了openGL的一个得到太多的数据点。我使用的路径,因为我通过矩阵变换整个数据集时,在值传递的是图的当前范围之外。我要对这个错误的方式?是有这样的事情更好/更合适的API?我很乐意路径修剪如果这是可能的/我知道如何做到这一点目前边界。谢谢!

I'm trying to create a real-time charting utility in android, and for the most part it works, except that when I get too many data points in one of my Paths it breaks openGL. I'm using paths because I'm transforming the entire dataset via matrix when a passed in value is outside the current bounds of the graph. Am I going about this the wrong way? is there a better/more appropriate API for this sort of thing? I'd be happy to trim the path to the current bounds if that were possible/I knew how to do it. Thanks!

的onDraw:

  @Override
  protected void onDraw(Canvas canvas) {
    scaleX = getWidth()  / (maxX - minX);
    scaleY = getHeight() / (maxY - minY);
    // TODO: Use clips to draw x/y axis, allow color to be defined in attributes, etc.
    canvas.drawColor(0xFF000000);
    for (DataLine line : mPathList.values()) {
      canvas.drawPath(line, line.getPaint());
    }
  }

(的DataLine是包括画图对象路径的子类)

(DataLine is a subclass of Path that includes a Paint object)

问题的错误是从OpenGLRenderer的警告:
形路径太大,被渲染到纹理

Error in question is a warning from the OpenGLRenderer: "Shape path too large to be rendered into a texture"

推荐答案

如果你在你的日志看,你会发现像这样的错误:

If you looked in your logs you will notice an error like so:

10月4日至4日:39:06.314:W / OpenGLRenderer(6092):形状路径太大,
  渲染到纹理

04-04 10:39:06.314: W/OpenGLRenderer(6092): Shape path too large to be rendered into a texture

由于打开硬件加速一切都被呈现为质地和存在用于纹理的大小限制。如果你打破了更大的形状成小的,这将解决您的问题。或者只是关闭硬件加速。

Since turning on hardware acceleration everything gets rendered as a texture and there is a size limit for textures. If you break down the larger shapes into smaller ones, that will solve your problem. Or just turn off hardware acceleration.

android:hardwareAccelerated="false"

这篇关于Android的路径,实时图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆