Repeat multiple times one dc.fillPolygon?


Hi,
is there any way to render a dc.fillPolygon object multiple times?

My dc.fillPolygon:

dc.setColor(Graphics.COLOR_RED, Graphics.COLOR_TRANSPARENT);
dc.fillPolygon(
[
[x + 132, y - 25],
[x + 154, y - 25],
[x + 151, y - 20],
[x + 129, y - 20]
]);

They need this drawn object to show me 7x.

I used this:

for (var i = 0 as integer; i < 7; i++)
{

, but unsuccessfully.

Thanks for the information.

  •  100,     
       -44,    
        -20,  
           4,     
           27,  
           52
            77   

    These are the coordinates of the individual days of the week, position x = xLocations[day].

    var xLocations =
            [
            100,       // - Sunday
            -44,     // - Monday
            -20,    // - Tuesday
            4,     // - Wednesday
            27,   // - Thursday
            52,  // - Friday
            77  // -  Saturday  
            ];
  • So what do you see when you run this?

    If you have View.onUpdate(dc) in your onUpdate(), the dc.fillPolygon calls must be after that.

  • But everything works for me.

    The only thing I'm trying to do is not to have to draw dc.fillPolygon 7 times

    what I'm talking about is this:

    MO TU WE TH FR SA SU

    -  -  -  -  -  -  -

    This is like an outline so the color: dc.setColor(Graphics.COLOR_DK_GRAY, Graphics.COLOR_TRANSPARENT);

    and the current day is black dc.fillPolygon.

    I only need to make the outline 7x...


    Simply, if someone advises me how to repeat one dc.fillPolygon several times side by side, they will be happy.

  • I think it would be simpler to use dc.drawRectangle

    let's say ou have xpos=[0,10,20,30,40,50,60]

    for(var i=0,i<7,i++){dc.drawRectangle(xpos[i],y,width,height);}

    where width is the width of your recatngle, and height the height of your rectangle

  • for your polygone:

    for(var i = 0;i<7;i++){

    dc.fillPolygon(
    [
    [xpos[i] + 132, y - 25],
    [xpos[i] + 154, y - 25],
    [xpos[i] + 151, y - 20],
    [xpos[i] + 129, y - 20]
    ]);

    }

    and if you want ouline instead of black, use drawLine

  • Hello,
    thank you for the great help, after a small fix everything works fine for me.
    I finally decided to use the dc.fillRectangle object.Tophat