Choose Language Hide Translation Bar

JSL to automate shaded axis range (reference line) based on date


I'm working with a number of control charts that are organized by date (but labeled by a serial number).  My control charts are phased by Quarter, but I would like the ability to highlight month (without phasing) by shading the x-axis.  I am able to manually do this, but I would like to learn a JSL script that will allow me to link the "max" and "min" values of that reference line to a column that contains "month".  So for example, if I would like to shade data for the month of September, the Min of my reference line is set equal to the start of all data in September and the Max is set equal to the end of all data in September.

I am new to JSL and am struggling on how to achieve this.  If there is a better way I'm open to ideas, but I cannot change the marker type or color to do this as my chart says a lot and uses too many marker types and colors already.



Super User ms
Super User

Re: JSL to automate shaded axis range (reference line) based on date

Not sure I understand what the shading should look like. But this example may give some ideas how to apply a graphics script dynamically with JSL.

// Example Data Table

dt = Open("$SAMPLE_DATA/Quality Control/Orange");

// Column with "subphases"

col = dt << New Column("subphase", Numeric, Formula(Round(:Sample / 5)), );

// Example Control Chart

cc = Control Chart Builder(

    Variables(Subgroup(:Sample), Y(:Conforming), Phase(:Phase)),



// Get limits

rcc = Report(cc);

ymin = rcc[Axisbox(2)] << get min;

ymax = rcc[Axisbox(2)] << get max;

Summarize(g = by(col), xmin = Min(:Sample), xmax = Max(:Sample));

// Shade every second subphase using Graphics Scripts

For(i = 1, i <= N Items(g), i = i + 2,


        Eval Expr(

            rcc[FrameBox(2)] << add graphics script(


                Fill Color("gray");

                Rect(xmin[Expr(i)] - 0.5, ymax, xmax[Expr(i)] + 0.5, ymin, 1);





Article Labels

    There are no labels assigned to this post.