{ From user kmull, Model Color_map_example at 19-Oct-2017 11:38:01 AM, encoding="UTF-8" } SoftwareVersion 5.0.16 { System Variables with non-default values: } SampleSize := 1000 TypeChecking := 1 Checking := 1 SaveOptions := 2 SaveValues := 0 NodeInfo FormNode: 1,0,0,1,0,0,0,,0,0,,0,0 AskAttribute Value,Variable,Yes {!40700|AskAttribute CellFormatExpression,Variable,Yes} Model Color_map_example Title: Color map example Description: Create a spectrum of colors based on three inputs: R G B. Author: kmull Date: Tue, Sep 26, 2017 2:26 PM SaveAuthor: kmull SaveDate: Thu, Oct 19, 2017 11:38 AM DiagState: 2,49,15,719,273,17 DiagramColor: 65535,65535,65535 FontStyle: Arial,15 FileInfo: 0,Model Color_map_example,2,2,0,0,C:\Users\kmull\Downloads\Color_map.ana FormNode Fo1506467503 Title: alpha1 Definition: 0 NodeLocation: 140,48,1 NodeSize: 124,16 NodeInfo: 1,,,,,,0,72,,,,,,0 NodeColor: 65535,65535,65535 Original: alpha1 FormNode Fo1506467510 Title: step size Definition: 0 NodeLocation: 140,128,1 NodeSize: 124,16 NodeColor: 65535,65535,65535 Original: step_size FormNode Fo1506467536 Title: Color Map Definition: 1 NodeLocation: 140,240,1 NodeSize: 124,16 NodeInfo: 1,,,,,,0,72,,,,,,0 NodeColor: 65535,32766,1 Original: color_map FormNode Fo1506546942 Title: Luminance threshold Definition: 0 NodeLocation: 140,88,1 NodeSize: 124,16 NodeColor: 65535,65535,65535 Original: Luminance_threshold Variable R Title: R Description: Red color component. Definition: if mod( 255, step_size ) <> 0 then~ concat( Sequence( 0, 255, step_size ), 255)~ else~ Sequence(0, 255, step_size ) NodeLocation: 512,120,1 NodeSize: 48,24 NumberFormat: 2,G,4,2,0,0,4,0,$,0,"ABBREV",0,,,0,0,15 Domain: DomDiscreteNumeric {!40300|DomainExpr: Integer()} {!40000|Att_PrevIndexValue: [0,45,90,135,180,225,255]} Variable G Title: G Description: Green color component. Definition: if mod( 255, step_size ) <> 0 then~ concat( Sequence( 0, 255, step_size ), 255)~ else~ Sequence(0, 255, step_size ) NodeLocation: 512,176,1 NodeSize: 48,24 NumberFormat: 2,G,4,2,0,0,4,0,$,0,"ABBREV",0,,,0,0,15 Domain: DomDiscreteNumeric {!40300|DomainExpr: Integer()} {!40300|Att_SlicerPopupSize: 227,154} {!40000|Att_PrevIndexValue: [0,45,90,135,180,225,255]} Variable B {!40000|Att_PrevIndexValue: [0,30,60,90,120,150,180,210,240,255]} Title: B Description: Blue color component. Definition: if mod( 255, step_size ) <> 0 then~ concat( Sequence( 0, 255, step_size ), 255)~ else~ Sequence(0, 255, step_size ) NodeLocation: 512,232,1 NodeSize: 48,24 Domain: DomDiscreteNumeric {!40300|DomainExpr: Integer()} {!40300|Att_SlicerPopupSize: 227,154} Decision step_size Title: Step size Description: In the Sequence() formula, the integer to be added with each step between 0 and 255. A larger step size results in a smaller number of rows and columns. For computational purposes, choose a step size of 15 or greater, as the fill colour is going to be calculated (255/stepsize)^3 times. Definition: 45 NodeLocation: 352,176,1 NodeSize: 64,24 WindState: 2,330,51,720,350 Aliases: FormNode Fo1506467510 Domain: DomDiscreteNumeric {!40300|DomainExpr: Integer(1,255)} Variable color_map Title: Color Map Description: An array with three indexes: R, G, and B. The cell fill in each element is determined by these indexes. The result is a color map. Step through the z-axis index to see how the colors change, too. You could, for example, use a slice of this map to define a range of colors for a graph, or in another CellFill() instance as a heatmap to show low to high values.~ ~ The font color is dependent on the 'luminance' of the cell fill color. Definition: R*2^16 + G*2^8 + B NodeLocation: 656,176,1 NodeSize: 48,24 WindState: 2,395,88,609,491 ValueState: 2,650,96,615,488,0,MIDM Aliases: FormNode Fo1506467536 ReformVal: [R,G] NumberFormat: 2,H,6,2,0,0,6,0,$,0,"ABBREV",0,,,0,0,15 {!40000|Att_ResultSliceState: [B,4,G,1,R,1]} {!40700|CellFormatExpression: CellFormats(~ /* Fill color calculation based on red, green, blue input value */~ CellFill(color: (R*2^16 + G*2^8 + B), alpha: alpha1),~ ~ /* Font color is black or white to contrast against light or dark cell fill color */~ IF ( R*0.299 + G*0.587 + B*0.114 ) < Luminance_threshold ~ THEN CellFont( color: 'White' ) ~ ELSE CellFont( color: 'Black' ),~ ~ /* Increase cell fornt size from the default */~ CellFont(size:14)~ )} {!40700|Att_CellFormat: CellFormats(CellSpan(R,CellSpan(G,CellFont(color:0xffffffff),1,header:0),1,header:0),CellSpan(R,CellSpan(G,CellFont(color:0xffffffff),1,header:0),1,header:0),CellSpan(G,CellFont(color:0xffffffff),1,header:0),CellFill(0xff00ff40),CellAlignment('Center',vert:'bottom'))} {!50000|Att_ColumnWidths: [,R,\([70,,,70,,,70])]} {!50000|Att_RowHeights: [,R,\([31,,,,,,31]),B,\([37,37,37,37,37,37,37,37,37,37]),G,\([51,51,51,51,51,51,51])]} Decision alpha1 Title: Transparency Description: Level of transparency (alpha parameter) applied to the cell fill. A value of 1 means there is no transparency. Definition: 1 NodeLocation: 352,64,1 NodeSize: 64,24 Aliases: FormNode Fo1506467503 Domain: DomContinuous {!40300|DomainExpr: Continuous(0.1,1)} Decision Luminance_threshold Title: Luminance threshold Description: Luminance is a measure of how bright something is, and this parameter is the brightness below which the text will be displaed in black rather than white text. If you find the contrast between the text and the background color in the cells too low, adjust this number downwards. Definition: 142 NodeLocation: 352,120,1 NodeSize: 64,24 Aliases: FormNode Fo1506546942 Domain: DomContinuous {!40300|DomainExpr: Continuous(0,255)} Text Te1507588839 Title: User Input NodeLocation: 140,136,-1 NodeSize: 132,128 NodeInfo: 1,0,0,1,1,1,0,,0,,0,,, NodeColor: 62258,62258,62258 Text Te1507588929 Title: Model NodeLocation: 496,136,-1 NodeSize: 216,128 NodeInfo: 1,0,0,1,1,1,0,,0,,0,,, NodeColor: 62258,62258,62258 Close Color_map_example