Skip to content

Modify dotted lines to continuous lines #29

Open
@phdv61

Description

@phdv61

Thank you for sharing your very useful code.

Instead of having dotted lines being plotted, I prefer continuous lines.
I modifed this section of your code accordingly as follows :

// Do actual data plotting

// 1 - Is the rolling buffer full of data ?

if ( this.currPoints < this.maxPoints ) // Not yet

for ( int i = 0; i < this.numVars; i++ )
{
    this.parent.stroke( this.colors[i] );
    for ( int j = 0; j < this.currPoints-1; j++ )
    {
	this.parent.line( (float)(this.posX + (this.data[j][i][0]*xScale - xOffset)), (float)(this.posY + yOffset - data[j][i][1]*yScale),
                    (float)(this.posX + (this.data[j+1][i][0]*xScale - xOffset)), (float)(this.posY + yOffset - data[j+1][i][1]*yScale) );
    }
}	

else // 2 YES, roll-back did start continuous plotting must be done in two halves

{
for ( int i = 0; i < this.numVars; i++ )
{
this.parent.stroke( this.colors[i] );
for ( int j = this.index ; j < this.maxPoints-1; j++ )
{
this.parent.line( (float)(this.posX + (this.data[j][i][0]*xScale - xOffset)), (float)(this.posY + yOffset - data[j][i][1]*yScale),
(float)(this.posX + (this.data[j+1][i][0]*xScale - xOffset)), (float)(this.posY + yOffset - data[j+1][i][1]*yScale) );
}
}
for ( int i = 0; i < this.numVars; i++ )
{
this.parent.stroke( this.colors[i] );
for ( int j = 0; j < this.index-1; j++ )
{
this.parent.line( (float)(this.posX + (this.data[j][i][0]*xScale - xOffset)), (float)(this.posY + yOffset - data[j][i][1]*yScale),
(float)(this.posX + (this.data[j+1][i][0]*xScale - xOffset)), (float)(this.posY + yOffset - data[j+1][i][1]*yScale) );
}
}

}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions