Here is a script that creates what you want for an output graph. I added a sample data table, as you had, but with one addition. The trick to get Graph Builder to use the same colors as the row state color, is actually to set the value colors for Part_ID to the colors you want. Then Graph Builder uses those colors for the Overlay. Also added to the Graph Builder code are axis reference lines. Now, the code I am providing is static code, but JSL could easily generate the platform code you need by reading the data table and figuring out the reference lines that are needed, and then to just modify the Graph Builder code as required. Finally, I modified the actual line colors manually, and then saved the whole Graph Builder script.. From your question, I assumed you wanted to see how to get the results you want. Thus my response. Creating the graph from generic data tables is not included in my response, but it can certainly be scripted.
Names Default to Here( 1 );
New Table( "Sample",
Add Rows( 20 ),
New Column( "Part ID",
Numeric,
"Nominal",
Format( "Best", 12 ),
Set Property( "Value Colors", {1 = 3, 2 = 3, 3 = 5, 4 = 5, 5 = 5, 6 = 5, 7 = 5, 8 = 5, 9 = 3, 10 = 3} ),
Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] )
),
New Column( "X1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] )
),
New Column( "X2",
Character,
"Nominal",
Set Values(
{"cold", "cold", "cold", "cold", "cold", "cold", "cold", "cold", "cold", "cold", "medium", "medium", "medium",
"medium", "medium", "medium", "medium", "medium", "medium", "medium"}
)
),
New Column( "Y",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( If( :X2 == "cold", Random Normal() + 10, :X2 == "medium", Random Normal() + 12, Random Normal() ) )
),
New Column( "Y_USL",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16] )
),
New Column( "Y_LSL",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6] )
),
Set Row States(
[768, 768, 1280, 1280, 1280, 1280, 1280, 1280, 768, 768, 768, 768, 1280, 1280, 1280, 1280, 1280, 1280, 768, 768]
)
);
Graph Builder(
Size( 509, 443 ),
Show Control Panel( 0 ),
Variables( X( :Y ), Y( :Part ID ), Overlay( :Part ID ) ),
Elements( Line( X, Y, Legend( 4 ), Row order( 1 ) ), Points( X, Y, Legend( 6 ), Jitter( 0 ) ) ),
SendToReport(
Dispatch(
{},
"Y",
ScaleBox,
{Min( 5.43667408790577 ), Max( 16.635593220339 ), Inc( 2 ), Minor Ticks( 0 ),
Add Ref Line( 16, "Dashed", "Red", "", 2 ), Add Ref Line( 15, "Solid", "Medium Dark Blue", "", 2 ),
Add Ref Line( 7, "Solid", "Medium Dark Blue", "", 2 ), Add Ref Line( 6, "Dashed", "Medium Dark Red", "", 2 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
4,
Properties( 0, {Line Color( 0 )} ),
Properties( 1, {Line Color( 0 )} ),
Properties( 2, {Line Color( 0 )} ),
Properties( 3, {Line Color( 0 )} ),
Properties( 4, {Line Color( 0 )} ),
Properties( 5, {Line Color( 0 )} ),
Properties( 6, {Line Color( 0 )} ),
Properties( 7, {Line Color( 0 )} ),
Properties( 8, {Line Color( 0 )} ),
Properties( 9, {Line Color( 0 )} )
), Legend Model(
6,
Properties( 0, {Marker( "FilledCircle" )} ),
Properties( 1, {Marker( "FilledCircle" )} ),
Properties( 2, {Marker( "FilledCircle" )} ),
Properties( 3, {Marker( "FilledCircle" )} ),
Properties( 4, {Marker( "FilledCircle" )} ),
Properties( 5, {Marker( "FilledCircle" )} ),
Properties( 6, {Marker( "FilledCircle" )} ),
Properties( 7, {Marker( "FilledCircle" )} ),
Properties( 8, {Marker( "FilledCircle" )} ),
Properties( 9, {Marker( "FilledCircle" )} )
)}
)
)
);
Jim