Skip to content

Use line for smoother graphs #43

Open
@ratatoeskr666

Description

@ratatoeskr666

for ( int j = 0; j < this.currPoints; j++ )

Hi, just an quick&dirty idea, I don't know if there are any caveats using this. For me it worked:

`for ( int j = 0; j < this.currPoints; j++ )
{
float x1 = (float)(this.posX + (this.data[j][i][0]*xScale - xOffset));
float y1 = (float)(this.posY + yOffset - data[j][i][1]*yScale);

    // Skip the first 2 pixels otherwise you will see lines between first and last pixel
    if (j > 0 && x1 > this.posX + 2) {          
      float x2 = (float)(this.posX + (this.data[j-1][i][0]*xScale - xOffset));          
      float y2 = (float)(this.posY + yOffset - data[j-1][i][1]*yScale);
      this.parent.line(x1, y1, x2, y2);
    } else {
      this.parent.point(x1, y1);
    }

}`

This makes the graph rendering smoother if you wish rendering interpolation between the data points.

This is just some kind of contribution. Thank you for this outstanding library and for making it free for all of us! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions