Android paths for real-time charting

I am trying to create a realtime graphing utility in android and for the most part it works except that when I get too many data points in one of its paths it breaks openGL. I am using paths because I am converting the entire dataset through a matrix when the passed value is outside the current bounds of the plot. Am I wrong? is there a better API for this kind of thing? I would be happy to cut the path to the current boundaries if it was possible / I knew how to do it. Thank!


  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.
    for (DataLine line : mPathList.values()) {
      canvas.drawPath(line, line.getPaint());


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

The error in question is a warning from OpenGLRenderer: "The path is too long to render the texture"


source to share

1 answer

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

04-04 10: 39: 06.314: W / OpenGLRenderer (6092): Image path too long to be converted to texture

From the moment you enable hardware acceleration, everything is processed as a texture, and there is a size limitation for textures. If you break large shapes into smaller ones, this will solve your problem. Or just turn off hardware acceleration:





All Articles