Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Graduating Panel with Varying Intervals

$
0
0

@dustinormond wrote:

Is it possible to have a graduating panel with varying intervals? What I want to do is have the interval based on the month. For example, if the month is January then the interval would be 31, February would be 28 or 29, and so on. Currently, I have the interval set to 28 (i.e. 4 weeks). As you can see in the image below, the months don’t line up with the first day of each month rather they line up with every four weeks due to my 28 interval:

Here is my code for the month textblock:

// creates the dates textblock
$(go.TextBlock,
    {
        interval: 28,
        name: "months",
        font: "10pt sans-serif",
        stroke: textColor,
        height: cellHeight,
        width: cellWidth * 28,
        verticalAlignment: go.Spot.Center,
        alignmentFocus: new go.Spot(0, 0, -2, cellHeight),
        graduatedFunction: function(v) {
            var d = new Date(Date.parse(startDate));
            d.setDate(d.getDate() + Math.ceil(v / 26 * 7));
            return d.toLocaleDateString("en-US", { month: "short", year: "numeric" });
        }
    }
)

Posts: 8

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles